Re: Pango and non-system fonts



On 8/23/07, Mike Branciforte <branciforte m gmail com> wrote:
> On 8/22/07, Behdad Esfahbod <behdad behdad org> wrote:
> > On Wed, 2007-08-22 at 11:55 -0400, Mike Branciforte wrote:
> > > We are exploring the possibility of using Cairo+Pango to render pages
> > > from a PDF document.
> >
> > You don't need / shouldn't use pango for rendering PDF.  Pango is used
> > to convert characters to glyphs and to lay text out.  PDF on the other
> > hand, includes layed-out glyphs.  Just show it, using
> > cairo_show_glyphs()
>
> You lost me. Where are the "layed-out glyphs" in this PDF fragment
> that would show the string "Where are the glyphs?" in a PDF viewer?
>
> q
> BT
> 50 792 Td
> 0 -18 Td
> /F1 12 Tf
> (Where are the glyphs?)Tj
> ET
> Q
>
> It seems that in order to use cairo_show_glyphs() then I would have to
> create an array of glyphs, one "glyph" for each character in the
> phrase "Where are the glyphs?"? That means I would have to compute the
> x and y position for each glyph? Sounds like a lot of work. Am I
> missing something?

The above is not really a request to draw the string "Where are the
glyphs?" It's actually a request to display particular glyphs from the
font in a way that is precisely defined by the PDF standard. It just
so happens that way that glyph indices are encoded happens to be
human-readable. That may sound like a technical detail, but it becomes
a lot more evident when you have text where the characters and glyphs
aren't 1:1 - as is common for many languages.

Even for English, you can have PDF files where the encoding of the
glyphs doesn't show look like readable text in the file. The only way
to correctly interpret a PDF file is to follow the encoding and glyph
layout rules in the spec. And so, yes, you need to manually position
your glyphs, and it is quite a bit of work to do it all correctly.

- Owen



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]