[poppler] [PATCH]

Albert Astals Cid aacid at kde.org
Tue Dec 11 09:59:55 PST 2012


El Dilluns, 10 de desembre de 2012, a les 15:03:40, Takuma TANAKA va escriure:
> 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.

Which poppler are you using? Which pdftoppm command line options? I get the 3 
here just fine.

Cheers,
  Albert

> 
> 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


More information about the poppler mailing list