[PATCH] Determine if glyph is diacritic from GDEF table

Khaled Hosny (via Code Review) gerrit at gerrit.libreoffice.org
Sun Apr 21 01:19:42 PDT 2013


Hi,

I have submitted a patch for review:

    https://gerrit.libreoffice.org/3519

To pull it, you can do:

    git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/19/3519/1

Determine if glyph is diacritic from GDEF table

GDEF table should have the definitive answer about glyph class,
including if it is a mark (diacritic[sic]) or not. Though I don't know
what GlyphItem::IS_DIACRITIC flag is used for, if at all.

Change-Id: Ib935dd571e2191eb5f8ae72650394293dd248140
---
M vcl/generic/glyphs/gcach_layout.cxx
1 file changed, 3 insertions(+), 2 deletions(-)



diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx
index 02392c2..8fbe9d7 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -34,6 +34,7 @@
 #if ENABLE_HARFBUZZ
 #include <hb-ft.h>
 #include <hb-icu.h>
+#include <hb-ot.h>
 #else
 #include <layout/LayoutEngine.h>
 #include <layout/LEFontInstance.h>
@@ -166,6 +167,7 @@
         meScriptCode = eScriptCode;
 
         hb_font_t *aHbFont = hb_ft_font_create(aFace, NULL);
+        hb_face_t *aHbFace = hb_font_get_face(aHbFont);
 
         LanguageTag aLangTag(rArgs.meLanguage);
         OString sLanguage = OUStringToOString(aLangTag.getLanguage(), RTL_TEXTENCODING_UTF8);
@@ -220,8 +222,7 @@
             if (bInCluster)
                 nGlyphFlags |= GlyphItem::IS_IN_CLUSTER;
 
-            // XXX: query GDEF glyph class? Do we even need this?
-            if (aHbPositions[i].x_advance == 0)
+            if (hb_ot_layout_get_glyph_class(aHbFace, nGlyphIndex) == HB_OT_LAYOUT_GLYPH_CLASS_MARK)
                 nGlyphFlags |= GlyphItem::IS_DIACRITIC;
 
             aHbPositions[i].x_offset /= 64;

-- 
To view, visit https://gerrit.libreoffice.org/3519
To unsubscribe, visit https://gerrit.libreoffice.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib935dd571e2191eb5f8ae72650394293dd248140
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: master
Gerrit-Owner: Khaled Hosny <khaledhosny at eglug.org>



More information about the LibreOffice mailing list