Re: OpenType Patches



Eric Mader <mader jtcsv com> writes:

> At 07:10 PM 8/30/2002, I wrote:
> > I've been chasing an obscure bug having to do with accent
> > positioning in OpenType fonts. The symptom is that sometimes,
> > accents are positioned too far to left. After chasing my tail for
> > quite a while, I've narrowed this bug down to the fact that the face
> > the indic-ot shaper passes to the OpenType routines has
> > face->size.metrics.x_scale == 0. (actually everything in the metrics
> > record is zero) This causes the OT code which returns anchor points
> > to return them all as zero 'cause it multiplies to co-ordinates by
> > x_scale. My shaper gets the face like this:
> >
> >     face = pango_xft_font_lock_face (font);
> >
> > So I assume that the problem is somewhere in
> > pango_xft_font_lock_face... does anybody have any idea where I
> > should start looking?
> 
> I've tracked this some more; pango_xft_font_lock_face ends up calling
> _XftLockFile, which may call FT_New_Face if f->face is null. I assume
> that the face returned by FT_New_Face would have
> face->size->metrics.x_scale == 0. Can anybody confirm that this is
> indeed the problem? Better still, does anybody have any idea what to
> do about this?

Looks like the right diagnosis to me ... the fix needs to be in
Xft. Untested patch attached. 

[
Some code cleanup on top of this is possible:

 a) Replace the _XftLockFile/_XftSetFace pair in XftFontOpenInfo
    with a single XftLockFace() call.

 b) Remove the _XftSetFace() call from xftglyphs.c
]

Regards,
                                        Owen

--- Xft/xftfreetype.c.lockface	Fri Sep  6 10:05:48 2002
+++ Xft/xftfreetype.c	Fri Sep  6 10:08:17 2002
@@ -294,7 +294,19 @@
 XftLockFace (XftFont *public)
 {
     XftFontInt	*font = (XftFontInt *) public;
-    return _XftLockFile (font->info.file);
+    XftFontInfo	*fi = &font->info;
+    FT_Face *face;
+
+    face = _XftLockFile (fi->file);
+    if (!face)
+	return 0;
+
+    if (!_XftSetFace (fi->file, fi->xsize, fi->ysize, &fi->matrix)) {
+	_XftUnlockFile (fi->file);
+	return 0;
+    }
+
+    return face;
 }
 
 void


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