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 > > Cheers, > > Stefan Thomas > CTO > > TxtBear AG Switzerland | www.txtbear.com | [email protected] _______________________________________________ poppler mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/poppler
