Issue 126686

Summary: Page number displayed incorrectly when changing font size
Product: Writer Reporter: Andrew Konecny <akonecny2013>
Component: viewingAssignee: AOO issues mailing list <issues>
Status: CONFIRMED --- QA Contact:
Severity: Minor    
Priority: P5 (lowest) CC: ballard2014, buddymatula, hmack2012, orcmid, ralmeida2013
Version: 4.1.1   
Target Milestone: ---   
Hardware: PC   
OS: All   
Issue Type: DEFECT Latest Confirmation in: 4.1.2
Developer Difficulty: ---
Attachments:
Description Flags
Sample doc to test with none

Description Andrew Konecny 2015-11-24 13:30:49 UTC
When I entered the maximum amount of characters in size 2 font into Writer, and then I selected all of the characters and change the font to 999.9, and then repeated that process 3 or more times, every time I change to the larger font the number of pages the document contains is shown to be less than actually there.

Steps to Reproduce:
1. Hold any key down until you have about three lines of a character.
2. Select all of the characters, change the font to size 2.
3. Copy the selection and then paste until the program won't allow any more characters.
4. Hit ctrl+a to select all of the characters, and then change the font to 999.9.
5. Record the number of pages used, which is displayed in the bottom left hand of the screen.
6. Repeat steps 4 and 5 more than twice.
7. Notice how the page number is not constant unless you are to scroll down to the last page.

Additional Details:
When I tested this, I let sufficient time pass after each font size change, about ten seconds longer than it took the first time to change the font and scroll to the bottom, which in every case had the page number sitting constant for about 8 of those seconds.
Comment 1 Hunter 2015-11-24 18:34:04 UTC
Created attachment 85159 [details]
Sample doc to test with

OS: Windows 10
Open Office 4.1.0 Build: 9764
I was able to re-create this bug by following these steps.
1. created the attached document
2. use ctrl+a to select all
3. change font to 2pt font, wait, change font back to 12pt font

This caused the current page and number of pages from the smaller font to be displayed after changing the font to a larger font. This also cut off access to the new pages for about 10 seconds, then Open Office displayed the correct number of pages and current page. Suggested follow up tests should be done by varying the difference in size between the smaller font size and the larger font size, and the size of the document itself. This may lead to discovering a relationship between font size difference/document size and the amount of time Open Office displays the incorrect number of pages.
Comment 2 Ramon Almeida 2016-02-16 07:40:26 UTC
OS: Windows 10
OpenOffice 4.1.2 Build: 9781

I was able to reproduce this bug following Andrew's steps with some slight modifications.
Steps: 
1. Type about 2 pages of characters in 12 pt font. (I just pressed the letter "T" until I had a couple of lines and then copy and pasted until I had 2 pages.) 
2. Press Ctrl + A to select all the text.
3. Change the font to 999.
4. Record the page number on the bottom left corner of the page.
5. Change the font back to 12.
6. Change the font back to 999.
7. Confirm that the numbers are different when they should be the same.

Details worth noting:
I noticed that it is not necessary to change the font to such a big number like 999. This will unnecessarily stress your computer. After a certain number, the program only outputs one character per page. So anything bigger will still use the same amount of pages. This number tends to be around 400 or 500 depending on the width of the character. I noticed this when I switched the font size from something like 500 to 900 and the page numbers did not change. (Note: This only works with most letters. But when you try to do it with a letter like "I" which has a small width you would need to go to a really big font size in order to only see one letter per page.) The reason why I find this worth mentioning is because this can help you know if the page number is accurate when working with big fonts. When you work with a big font that only allows one character per page, you can Ctrl + A to select all the text and go to tools > word count. The number of characters should equal the number of pages. (Again, this is only when you are working with huge fonts that only allows one character per page.) Another important detail is that the number of pages of text you need in order to see the bug will depend on how fast your system is. On a slower computer, I could replicate the bug with only one page of text. On a faster computer it took me 2 pages. What usually happens after you switch to a large font is the page numbers will start to increase and then it will stop. Sometimes after you move the scroll bar, the page numbers will change and only after this will it show the correct number of pages.
Comment 3 Brent Allard 2016-02-16 15:50:59 UTC
Replicated in OSX 10.10.5

My replication was very similar:
1) create a new writer document with X (not 'x', this is a variable. Explanation below...) characters at 2 (or some other small) font.
2) highlight all the characters (I just used my mouse)
3) change the font size to anywhere between 600 and 999 using the [...] icon above the font size box in the properties panel, to the right of the screen.
- If you change the font size using the text box itself, you aren't changing directly to 999. You're changing to 9, then 99, then 999.

THE BUG:
At a font size of 600-999, one character should take up one page. If the page count after changing the font is less than the number of characters, you're seeing the bug.

Observe what happens in such a case as you continue scrolling downwards with the scroll bar. When you reach what Writer thinks is the 'max' page, the 'max' value will increment by ten. This repeats until you scroll down to the true bottom of the document, at which point the page count will be correct.

On my machine, an X value of about 140 was the lowest I could go and still observe issues. (it thought there were 132 pages). The problem exacerbates as X->INFINITY. For example, at 10,000 characters, Writer only thought there were 209 page.

OBSERVATIONS (IMPORTANT):
Any arbitrary font size conversion I chose (2 to 300, 50 to 900) didn't seem to change how the bug manifested. The ratio of the 'before' size to the 'after' size merely has to be large enough that you're generating at least 140-200 new pages. It didn't matter in my test cases whether I was jumping from 1 page to 200, or 200 to 400.
Comment 4 orcmid 2016-02-16 17:10:36 UTC
Page counting is done asynchronously and is probably more of an estimate unless the end of the document is actually reached.  The use of font sizes that are not actually renderable on a single page is likely to confuse matters too.

It will be interesting to see what happens, when the page count appears to be too low, when you do a Save As ... to a new file, close AOO, then open AOO with the new file.  Then wait until the page count stabilizes.  Or go to the last page using Ctrl-End.  That should get there relatively quickly and provide the correct count.  (Try Ctrl-End in some of the demonstrations of the defect too.)

Another question: How disruptive is this in reality?  The demonstrations are all bizarre cases.  Is there an issue with ordinary document working when the page count should be able to keep up?.

Or is knowing how to get to the last page and check the count there good enough as a practical work-around?
Comment 5 Theodore Matula 2016-04-26 01:38:19 UTC
Since multiple people in this report were able to reproduce this bug, I am moving it to confirmed.