[HarfBuzz] harfbuzz: Branch 'pango' - 2 commits

Simon Hausmann hausmann at kemper.freedesktop.org
Mon Jul 9 14:58:20 PDT 2007


 pango/pango-harfbuzz.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+)

New commits:
diff-tree 0fdcdc4cb730b73f2780f9780d29989ad7f799c7 (from dac0b1c8f5bab7cf7aa0d6f3de193fcae6bd3258)
Author: Simon Hausmann <shausman at trolltech.com>
Date:   Mon Jul 9 23:58:25 2007 +0200

    Implemented getSFntTable, don't seem to get scalable fonts somehow though. weird.

diff --git a/pango/pango-harfbuzz.c b/pango/pango-harfbuzz.c
index 19eae95..df3ec70 100644
--- a/pango/pango-harfbuzz.c
+++ b/pango/pango-harfbuzz.c
@@ -118,6 +118,16 @@ static HB_Bool hb_canRender(HB_Font font
 
 static HB_Error hb_getSFntTable(void *font, HB_Tag tableTag, HB_Byte *buffer, HB_UInt *length)
 {
+    FT_Face face = (FT_Face)font;
+    FT_ULong ftlen = *length;
+    FT_Error error = 0;
+
+    if (!FT_IS_SFNT(face))
+        return HB_Err_Invalid_Argument;
+
+    error = FT_Load_Sfnt_Table(face, tableTag, 0, buffer, &ftlen);
+    *length = ftlen;
+    return (HB_Error)error;
 }
 
 HB_Error hb_getPointInOutline(HB_Font font, HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints)
diff-tree dac0b1c8f5bab7cf7aa0d6f3de193fcae6bd3258 (from 52cb8939644203c9dd5366b7aca17e7ba285511e)
Author: Simon Hausmann <shausman at trolltech.com>
Date:   Mon Jul 9 22:41:21 2007 +0200

    Implemented the canRender callback.

diff --git a/pango/pango-harfbuzz.c b/pango/pango-harfbuzz.c
index cd1b00d..19eae95 100644
--- a/pango/pango-harfbuzz.c
+++ b/pango/pango-harfbuzz.c
@@ -99,6 +99,20 @@ static void hb_getAdvances(HB_Font font,
 
 static HB_Bool hb_canRender(HB_Font font, const HB_UChar16 *string, hb_uint32 length)
 {
+    PangoFcFont *fc_font = PANGO_FC_FONT (font->faceData);
+    hb_uint32 i;
+    for (i = 0; i < length; ++i) {
+        gunichar ch;
+        if (HB_IsHighSurrogate(string[i]) && i < length - 1
+            && HB_IsLowSurrogate(string[i + 1])) {
+            ch = HB_SurrogateToUcs4(string[i], string[i + 1]);
+        } else {
+            ch = string[i];
+        }
+
+        if (!pango_fc_font_get_glyph(fc_font, ch))
+            return FALSE;
+    }
     return TRUE;
 }
 



More information about the HarfBuzz mailing list