[poppler] [PATCH]

Takuma TANAKA takuma.tanaka at toppan.co.jp
Sun Dec 9 22:03:40 PST 2012


Dear Folks,

I have got the pdf that has invalid font weight.

The number of one character in the pdf is 850,
and pdftoppm result can not rasterize.
Please see attached the documents (FontWeight850.pdf and summary.jpg).

I hope the patch that Mr. Stefan Thomas offered 2 years ago is applied.
But I also understand that such a font weight number isn't described in
pdf specification.
If poppler's policy doesn't accept such a font weight, I will handle 
locally.

Thanks.

 > Albert Astals Cid wrote:
 > > A Divendres, 30 d'abril de 2010, Stefan Thomas va escriure:
 > > Hey folks,
 > >
 > > Got a quick patch. The GfxFont parses the FontWeight as per the PDF
 > > Specification, allowing only certain discrete values and raising an
 > > error otherwise. We've encountered PDFs in the wild that don't 
adhere to
 > > the standard. Acroread seems to handle the case gracefully, falling 
back
 > > to the nearest valid font weight. Poppler raises an error and ignores
 > > the FontWeight property altogether.
 > >
 > > This patch adds the same graceful handling to Poppler. I don't see a
 > > reason not to allow non-standard font weights. Poppler is a renderer,
 > > not a validator. If we can handle this case gracefully and 
transparently
 > > to the user, we should.
 > >
 > > However, one could make an argument for adding a basic bounds check for
 > > values outside of 50-950 or so. Personally I'm from the school of 
trying
 > > to handle problems as locally as possible, but if a PDF has a font
 > > weight with nonsensical values, perhaps that would be better handled
 > > with an error. We opted to go without the bounds check for simplicity,
 > > but it would be easy enough to add:
 > >
 > > if (obj2.getNum() < 50 || obj2.getNum() > 950) error(-1, "Invalid Font
 > > Weight");
 > > else if (obj2.getNum() <= 150) weight = W100;
 > > [..etc..]
 >
 >
 > Is there any chance we can get such a PDF?
 >
 > Albert
-- 
TAKUMA TANAKA
Toppan Printing co., ltd.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: FontWeight850.pdf
Type: application/pdf
Size: 2350743 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20121210/83f669ca/attachment-0001.pdf>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: summary.jpg
Type: image/jpeg
Size: 75094 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/poppler/attachments/20121210/83f669ca/attachment-0001.jpg>


More information about the poppler mailing list