[Poppler-bugs] [Bug 81748] FreeText annotation ignores font

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Wed May 9 07:10:27 UTC 2018


https://bugs.freedesktop.org/show_bug.cgi?id=81748

--- Comment #1 from Tobias Deiminger <haxtibal at posteo.de> ---
Thanks for you report! You're right. The only case where poppler renders
FreeText font correct is when the annotation was generated by an external PDF
tool that embedded an appearance stream (/AP) into annotation dictionaries.
That's not the case with your attached file. If there's no /AP, poppler
generates in-memory appearance dynamically where the font is ignored.

Basically, to select a font in the absence of /AP, these things need to be
done:
* If no /AP is there, the appearance string /DA determines the font. /DA must
have at least an operator Tf to select font name and size in points.
* (optional) If we want to fine tune a font, /DA can have some more operators,
e.g. Tc, Tw, Tz, TL, Ts, Tr.
* poppler must dynamically construct an appearance stream that respects /DA.
* The chosen font name must have a corresponding entry in the global catalogs
AcroForm resource dictionary, see poppler/Catalog.h, Catalog::getAcroForm.
* If font is not a member of Base14 fonts, the font must be embedded into the
document.

Poppler ignores the font at multiple places:
* AnnotFreeText::parseAppearanceString only extracts fontsize and fontcolor
from appearanceString. But not the font name.
* AnnotFreeText::generateFreeTextAppearance dynamically generates in-memory
appearance stream into Annot::appearStreams where font is hardcoded as
/AnnotDrawFont = Helvetica, Type0, WinAnsiEncoding.
* If you're using poppler Qt5 frontend to create a FreeText annotation,
TextAnnotationPrivate::toAppearanceString constructs a wrong /DA string
GooString::format("/Invalid_font {0:d} Tf", font.pointSize()). That
"Invalid_font" is passed to AnnotFreeText Ctor and ends up in
AnnotFreeText::dict["DA"] and member AnnotFreeText::appearanceString.
* Page::addAnnotation and AnnotFreeText::AnnotFreeText don't provide a path to
add a font entry to the catalogs AcroForm resource dictionary, nor to embedded
a font in case if it's not a Base14 font
* cpp and glib frontend don't let you create FreeText annotations at all
(really? or am I missing something)

Currently we're running an Okular GSoC project [0] that's probably affected by
this bug. Maybe we can contribute to solve it, but can't promise.

[0] https://summerofcode.withgoogle.com/projects/#6053164340477952

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/poppler-bugs/attachments/20180509/c62b2184/attachment.html>


More information about the Poppler-bugs mailing list