Re: Ligatures and Pango?
- From: Han-Wen Nienhuys <hanwen xs4all nl>
- To: gtk-i18n-list gnome org
- Cc: gtk-i18n-list gnome org
- Subject: Re: Ligatures and Pango?
- Date: Wed, 30 Nov 2005 13:04:00 +0100
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.
--
Han-Wen Nienhuys - hanwen xs4all nl - http://www.xs4all.nl/~hanwen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]