[HarfBuzz] harfbuzz: Branch 'pango'

Simon Hausmann hausmann at kemper.freedesktop.org
Thu Jul 12 11:37:24 PDT 2007


 pango/pango-harfbuzz.c |   25 +++++++++++++++++--------
 1 files changed, 17 insertions(+), 8 deletions(-)

New commits:
diff-tree d907643d465381545db00734812e37ee6a2799c9 (from 6c21a114944d88073cf3bee723d501fe69d181cc)
Author: Simon Hausmann <shausman at trolltech.com>
Date:   Thu Jul 12 20:37:38 2007 +0200

    Reverse the output glyphs in rtl context.

diff --git a/pango/pango-harfbuzz.c b/pango/pango-harfbuzz.c
index df3ec70..add5384 100644
--- a/pango/pango-harfbuzz.c
+++ b/pango/pango-harfbuzz.c
@@ -245,7 +245,8 @@ basic_engine_shape (PangoEngineShape *en
   HB_Fixed *hb_advances;
   HB_FixedPoint *hb_offsets;
   unsigned short *hb_logClusters;
-
+  int outGlyphIndex;
+  int outGlyphIncrement;
 
   g_return_if_fail (font != NULL);
   g_return_if_fail (text != NULL);
@@ -312,13 +313,21 @@ basic_engine_shape (PangoEngineShape *en
   }
 
   pango_glyph_string_set_size(glyphs, shaper_item.num_glyphs);
-  for (i = 0; i < shaper_item.num_glyphs; ++i) {
-      glyphs->glyphs[i].glyph = shaper_item.glyphs[i];
-      glyphs->glyphs[i].geometry.width = HB_FIXED_TO_PANGO(shaper_item.advances[i]);
-      glyphs->glyphs[i].geometry.x_offset = HB_FIXED_TO_PANGO(shaper_item.offsets[i].x);
-      glyphs->glyphs[i].geometry.y_offset = HB_FIXED_TO_PANGO(shaper_item.offsets[i].y);
-      glyphs->glyphs[i].attr.is_cluster_start = shaper_item.attributes[i].clusterStart;
-      glyphs->log_clusters[i] = shaper_item.log_clusters[i];
+
+  outGlyphIndex = 0;
+  outGlyphIncrement = 1;
+  if (analysis->level % 2) {
+      outGlyphIndex = shaper_item.num_glyphs - 1;
+      outGlyphIncrement = -1;
+  }
+
+  for (i = 0; i < shaper_item.num_glyphs; ++i, outGlyphIndex += outGlyphIncrement) {
+      glyphs->glyphs[outGlyphIndex].glyph = shaper_item.glyphs[i];
+      glyphs->glyphs[outGlyphIndex].geometry.width = HB_FIXED_TO_PANGO(shaper_item.advances[i]);
+      glyphs->glyphs[outGlyphIndex].geometry.x_offset = HB_FIXED_TO_PANGO(shaper_item.offsets[i].x);
+      glyphs->glyphs[outGlyphIndex].geometry.y_offset = HB_FIXED_TO_PANGO(shaper_item.offsets[i].y);
+      glyphs->glyphs[outGlyphIndex].attr.is_cluster_start = shaper_item.attributes[i].clusterStart;
+      glyphs->log_clusters[outGlyphIndex] = shaper_item.log_clusters[i];
   }
 
   g_free(hb_glyphs);



More information about the HarfBuzz mailing list