[poppler] FontScanner::scan()

Pino Toscano toscano.pino at tiscali.it
Mon Jul 9 03:24:47 PDT 2007


Hi,

while testing some new okular feature, I discovered that scan(int) actually 
scans one page more than what was specified as argument.
This is my explanation (of course correct me if I'm wrong):
- FontScanner uses 1..n indeces for the pages, so in the constructor 
currentPage is initialized to 1
line 41: lastPage = currentPage + nPages;
  init the "last" page (or upper bound) of the scanning

line 46: for (pg = currentPage; pg <= lastPage; ++pg) {
  this scans either the current page, the pages between currentPage and
  lastPage, but lastPage as well!
  Example: currentPage = 3, and we request nPages = 2 (scan 2 pages),
  it should scan the pages 3,4, while this for() would scan pages 3,4,5.

line 66: currentPage = lastPage + 1;
  the current page becomes the pages after the "last" page

I propose two patches :)
A: makes sure lastPage is always the page after the last page in every 
scanning
B: lastPage is the past page to be actually scanned in each scanning

What do you think?
If possible, I'd like to have it fixed before the final release.

Thanks,
-- 
Pino Toscano
-------------- next part --------------
A non-text attachment was scrubbed...
Name: poppler-fontinfo-A.diff
Type: text/x-diff
Size: 971 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/poppler/attachments/20070709/9d20ea14/attachment.diff 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: poppler-fontinfo-B.diff
Type: text/x-diff
Size: 533 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/poppler/attachments/20070709/9d20ea14/attachment-0001.diff 


More information about the poppler mailing list