[HarfBuzz] harfbuzz: Branch 'pango' - 6 commits
Simon Hausmann
hausmann at kemper.freedesktop.org
Thu Jul 12 12:07:46 PDT 2007
pango/pango-harfbuzz.c | 65 +++++++++++++++++++++++++++++++++++++++++++------
1 files changed, 58 insertions(+), 7 deletions(-)
New commits:
diff-tree bbfaa6127cb91b4e342ee951d680ab6544f012f9 (from 59d2dcdf31f6051f83ba91204b402af847b403b3)
Author: Simon Hausmann <shausman at trolltech.com>
Date: Thu Jul 12 21:07:34 2007 +0200
Implemented getPointInOutline callback
diff --git a/pango/pango-harfbuzz.c b/pango/pango-harfbuzz.c
index 3e84e5c..80e6c05 100644
--- a/pango/pango-harfbuzz.c
+++ b/pango/pango-harfbuzz.c
@@ -136,6 +136,35 @@ static HB_Error hb_getSFntTable(void *fo
HB_Error hb_getPointInOutline(HB_Font font, HB_Glyph glyph, int flags, hb_uint32 point, HB_Fixed *xpos, HB_Fixed *ypos, hb_uint32 *nPoints)
{
+ PangoFcFont *fc_font = PANGO_FC_FONT (font->faceData);
+ HB_Error error = HB_Err_Ok;
+ FT_Face face = pango_fc_font_lock_face (fc_font);
+
+ int load_flags = (flags & HB_ShaperFlag_UseDesignMetrics) ? FT_LOAD_NO_HINTING : FT_LOAD_DEFAULT;
+
+ if ((error = (HB_Error)FT_Load_Glyph(face, glyph, load_flags)))
+ goto done;
+
+ if (face->glyph->format != ft_glyph_format_outline) {
+ error = (HB_Error)HB_Err_Invalid_GPOS_SubTable;
+ goto done;
+ }
+
+ *nPoints = face->glyph->outline.n_points;
+ if (*nPoints) {
+ if (point > *nPoints) {
+ error = (HB_Error)HB_Err_Invalid_GPOS_SubTable;
+ goto done;
+ }
+
+ *xpos = face->glyph->outline.points[point].x;
+ *ypos = face->glyph->outline.points[point].y;
+ }
+
+ error = HB_Err_Ok;
+done:
+ pango_fc_font_unlock_face (fc_font);
+ return error;
}
void hb_getGlyphMetrics(HB_Font font, HB_Glyph glyph, HB_GlyphMetrics *metrics)
diff-tree 59d2dcdf31f6051f83ba91204b402af847b403b3 (from 43e33e3bbd43c8e67803293f8e156cf5fbce5618)
Author: Simon Hausmann <shausman at trolltech.com>
Date: Thu Jul 12 21:00:37 2007 +0200
Implemented single glyph metrics callback
diff --git a/pango/pango-harfbuzz.c b/pango/pango-harfbuzz.c
index 2b994d5..3e84e5c 100644
--- a/pango/pango-harfbuzz.c
+++ b/pango/pango-harfbuzz.c
@@ -140,6 +140,17 @@ HB_Error hb_getPointInOutline(HB_Font fo
void hb_getGlyphMetrics(HB_Font font, HB_Glyph glyph, HB_GlyphMetrics *metrics)
{
+ PangoFont *pfont = PANGO_FONT (font->faceData);
+
+ PangoRectangle logRect;
+ PangoRectangle inkRect;
+ pango_font_get_glyph_extents(pfont, glyph, &inkRect, &logRect);
+ metrics->x = PANGO_TO_HB_FIXED(logRect.x);
+ metrics->y = PANGO_TO_HB_FIXED(logRect.y);
+ metrics->width = PANGO_TO_HB_FIXED(logRect.width);
+ metrics->height = PANGO_TO_HB_FIXED(logRect.height);
+ metrics->xOffset = PANGO_TO_HB_FIXED(inkRect.x);
+ metrics->yOffset = PANGO_TO_HB_FIXED(inkRect.y);
}
HB_Fixed hb_getFontMetric(HB_Font font, HB_FontMetric metric)
diff-tree 43e33e3bbd43c8e67803293f8e156cf5fbce5618 (from e9ef9d6ade218efdaa0b82c3fd91c52be0f20b68)
Author: Simon Hausmann <shausman at trolltech.com>
Date: Thu Jul 12 20:50:46 2007 +0200
Removed unused variables
diff --git a/pango/pango-harfbuzz.c b/pango/pango-harfbuzz.c
index c9a908a..2b994d5 100644
--- a/pango/pango-harfbuzz.c
+++ b/pango/pango-harfbuzz.c
@@ -245,12 +245,6 @@ basic_engine_shape (PangoEngineShape *en
{
PangoFcFont *fc_font;
FT_Face face;
- PangoOTRulesetDescription desc;
- const PangoOTRuleset *ruleset;
- PangoOTBuffer *buffer;
- glong n_chars;
- const char *p;
- int cluster = 0;
hb_uint32 i;
HB_Face hbFace;
HB_FontRec hbFont;
diff-tree e9ef9d6ade218efdaa0b82c3fd91c52be0f20b68 (from 137ddfea6c50d2cbec48f874330d358193c19fdd)
Author: Simon Hausmann <shausman at trolltech.com>
Date: Thu Jul 12 20:49:25 2007 +0200
Include freetype headers to fix warning about implicitly declared load_sfnt_table function
diff --git a/pango/pango-harfbuzz.c b/pango/pango-harfbuzz.c
index c74f35c..c9a908a 100644
--- a/pango/pango-harfbuzz.c
+++ b/pango/pango-harfbuzz.c
@@ -32,6 +32,10 @@
#include <harfbuzz-external.h>
#include <harfbuzz-shaper.h>
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include FT_TRUETYPE_TABLES_H
+
/* No extra fields needed */
typedef PangoEngineShape BasicEngineHarfBuzz;
typedef PangoEngineShapeClass BasicEngineHarfBuzzClass;
diff-tree 137ddfea6c50d2cbec48f874330d358193c19fdd (from 6f8418195a2fcd2bc75b4cae46b64846bb8311a8)
Author: Simon Hausmann <shausman at trolltech.com>
Date: Thu Jul 12 20:47:38 2007 +0200
Fix compiler warning
diff --git a/pango/pango-harfbuzz.c b/pango/pango-harfbuzz.c
index c8682c5..c74f35c 100644
--- a/pango/pango-harfbuzz.c
+++ b/pango/pango-harfbuzz.c
@@ -247,7 +247,7 @@ basic_engine_shape (PangoEngineShape *en
glong n_chars;
const char *p;
int cluster = 0;
- int i;
+ hb_uint32 i;
HB_Face hbFace;
HB_FontRec hbFont;
HB_ShaperItem shaper_item;
diff-tree 6f8418195a2fcd2bc75b4cae46b64846bb8311a8 (from d907643d465381545db00734812e37ee6a2799c9)
Author: Simon Hausmann <shausman at trolltech.com>
Date: Thu Jul 12 20:47:00 2007 +0200
Implemented font metric callback
diff --git a/pango/pango-harfbuzz.c b/pango/pango-harfbuzz.c
index add5384..c8682c5 100644
--- a/pango/pango-harfbuzz.c
+++ b/pango/pango-harfbuzz.c
@@ -140,6 +140,19 @@ void hb_getGlyphMetrics(HB_Font font, HB
HB_Fixed hb_getFontMetric(HB_Font font, HB_FontMetric metric)
{
+ PangoFont *pfont = PANGO_FONT (font->faceData);
+ PangoFontMetrics *metrics = pango_font_get_metrics(pfont, NULL);
+ HB_Fixed value = 0;
+
+ switch (metric) {
+ case HB_FontAscent:
+ value = PANGO_TO_HB_FIXED(pango_font_metrics_get_ascent(metrics));
+ break;
+ }
+
+ pango_font_metrics_unref(metrics);
+
+ return value;
}
const HB_FontClass hb_fontClass = {
More information about the HarfBuzz
mailing list