Re: Ligatures and Pango?



On Wed, 2005-11-30 at 13:04 +0100, Han-Wen Nienhuys wrote:
> Owen Taylor wrote:
> > The correct positioning algorithm for Pango is
> > 
> >  int x = 0;
> >  for (i = 0; i < glyph_string->num_glyphs; i++) 
> >    {
> >       PangoGlyph *glyph = &glyph_string->glyphs[i];
> >       show_glyph(glyph->glyph, x + glyph->geometry.x, glyph->geometry.y);
> >     
> >       x += glyph->geometry.width;
> >    }
> > 
> > So, there are two problems with your code 
> > 
> >  A) You are taking the x_offset/y_offset as cumulative, which they aren't.
> >  B) By using the implicit advance of the current point from glyph_show,
> >     you are using the natural width of the character instead of the
> >     kerned width in glyph->geometry.width
> 
> This is essentially the same as the other code snippet I posted, which is
> 
>    gsave <id> glyphshow grestore <width> 0 rmoveto
> 
> Since this doesn't quite work, I must have a scaling error somewhere. 
> I'll investigate.
> 
> > You could convert a PangoGlyphString to postscript using a separate
> > moveto for each character, but to make it efficient, you generally want
> > use xshow or xyshow. 
> 
> I agree that xshow is better, however using glyphshow frees me of 
> dealing with all the bizarre ways of (re)encoding fonts in PostScript.
> When libgnomeprint (or its successor) becomes suitable for inclusion in 
> a non-GUI tool, we'll switch to that.

What about libgnomeprint isn't suitable for inclusion in a non-GUI tool?

						Owen





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