[reportlab-users] Incorrect character composition
Glenn Linderman
v+python at g.nevcal.com
Thu Apr 16 02:37:39 EDT 2015
On 4/15/2015 10:46 PM, Glenn Linderman wrote:
> On 4/15/2015 2:02 AM, Andy Robinson wrote:
>> Glenn, my apologies - I had assumed you were discussing "unusual
>> languages" without re-reading the original email carefully. It might
>> not be that bad.
> 2. Composite glyph positioning
>
> Regarding composite characters made from multiple glyphs, the only
> scheme I can now find to adjust Y position is described at the very
> end of this link:
> https://www.safaribooksonline.com/library/view/developing-with-pdf/9781449327903/ch04.html
> That shows the use of Td operator to do both X & Y position between
> glyphs, but doesn't show how to calculate X & Y from font metrics. It
> would seem that only linear kerning was a concern and was optimized in
> operators when the PDF format was designed (since it predates
> Unicode). The idea of composing glyphs on the fly probably hadn't
> crossed any English-speaking minds, back then. The first couple
> paragraphs at that link hint at that likelihood.
>
> Speculation: Maybe there is some mechanism to create composite glyphs
> from the individual glyphs for the composite character codes, and
> embed that composite glyph in the PDF and use its internal code
> instead of positioning them in the stream via the Td operator... but I
> haven't found that... only a few things that seemed to hint at it.
> While Unicode didn't do that, because of the character code explosion
> that would result, any given PDF only needs to deal with the
> characters (individual or composite) actually used in any particular
> document. So there _might_ be a tradeoff between complexity of font
> embedding versus the complexity of font display.
>
http://www.alanwood.net/unicode/combining_diacritical_marks.html is an
interesting page. It is intended to test broswer capabilities to display
combining characters... it seems to display well in Firefox on Windows.
Firefox is open source. However, it might well use OS services on
various platforms to assist?
If it does, maybe that is the thing to do for reportlab too? Or maybe
not, if the OS services translate Unicode string→displayed bits on
screen. But if the OS services translate Unicode string→sequence of
glyphs and positions, then it could be really handy.
On the other hand, if it uses other libraries to do the placement, maybe
they would be available for reportlab as well, since FF is open source.
I converted the above page to PDF using the PDFize plugin for Firefox,
the result is at nevcal.com/temporary/Combining Diacritical Marks – Test
for Unicode support in Web browsers.pdf
<nevcal.com/temporary/Combining+Diacritical+Marks+%E2%80%93+Test+for+Unicode+support+in+Web+browsers.pdf>
and it looks pretty good, although I don't know how useful it will be to
you. My understanding is that FF uses the Cairo graphics package to do
screen rendering and the extension plugs in to that to do PDF rendering
also. Caveats about kerning and screen resolution sources apply.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist2.pair.net/pipermail/reportlab-users/attachments/20150415/b412be97/attachment.html>
More information about the reportlab-users
mailing list