Huw Davies : usp10: Glyph class tables are just generic class tables.

Alexandre Julliard julliard at winehq.org
Thu Dec 20 12:39:56 CST 2012


Module: wine
Branch: master
Commit: 79cbcf96123991496d064391c346223971d08e46
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=79cbcf96123991496d064391c346223971d08e46

Author: Huw Davies <huw at codeweavers.com>
Date:   Thu Dec 20 12:55:32 2012 +0000

usp10: Glyph class tables are just generic class tables.

---

 dlls/usp10/opentype.c |   34 ++++++++++++++++++----------------
 1 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/dlls/usp10/opentype.c b/dlls/usp10/opentype.c
index 81135b8..edaf917 100644
--- a/dlls/usp10/opentype.c
+++ b/dlls/usp10/opentype.c
@@ -93,19 +93,19 @@ typedef struct {
     WORD StartGlyph;
     WORD GlyphCount;
     WORD ClassValueArray[1];
-} GDEF_ClassDefFormat1;
+} OT_ClassDefFormat1;
 
 typedef struct {
     WORD Start;
     WORD End;
     WORD Class;
-} GDEF_ClassRangeRecord;
+} OT_ClassRangeRecord;
 
 typedef struct {
     WORD ClassFormat;
     WORD ClassRangeCount;
-    GDEF_ClassRangeRecord ClassRangeRecord[1];
-} GDEF_ClassDefFormat2;
+    OT_ClassRangeRecord ClassRangeRecord[1];
+} OT_ClassDefFormat2;
 
 /* These are all structures needed for the GSUB table */
 
@@ -525,20 +525,13 @@ DWORD OpenType_CMAP_GetGlyphIndex(HDC hdc, ScriptCache *psc, DWORD utf32c, LPWOR
  * GDEF
  **********/
 
-static WORD GDEF_get_glyph_class(const GDEF_Header *header, WORD glyph)
+static WORD OT_get_glyph_class(const void *table, WORD glyph)
 {
-    int offset;
     WORD class = 0;
-    const GDEF_ClassDefFormat1 *cf1;
-
-    if (!header)
-        return 0;
+    const OT_ClassDefFormat1 *cf1 = table;
 
-    offset = GET_BE_WORD(header->GlyphClassDef);
-    if (!offset)
-        return 0;
+    if (!table) return 0;
 
-    cf1 = (GDEF_ClassDefFormat1*)(((BYTE*)header)+offset);
     if (GET_BE_WORD(cf1->ClassFormat) == 1)
     {
         if (glyph >= GET_BE_WORD(cf1->StartGlyph))
@@ -550,7 +543,7 @@ static WORD GDEF_get_glyph_class(const GDEF_Header *header, WORD glyph)
     }
     else if (GET_BE_WORD(cf1->ClassFormat) == 2)
     {
-        const GDEF_ClassDefFormat2 *cf2 = (GDEF_ClassDefFormat2*)cf1;
+        const OT_ClassDefFormat2 *cf2 = table;
         int i, top;
         top = GET_BE_WORD(cf2->ClassRangeCount);
         for (i = 0; i < top; i++)
@@ -585,10 +578,19 @@ static VOID *load_gdef_table(HDC hdc)
 void OpenType_GDEF_UpdateGlyphProps(HDC hdc, ScriptCache *psc, const WORD *pwGlyphs, const WORD cGlyphs, WORD* pwLogClust, const WORD cChars, SCRIPT_GLYPHPROP *pGlyphProp)
 {
     int i;
+    void *glyph_class_table = NULL;
 
     if (!psc->GDEF_Table)
         psc->GDEF_Table = load_gdef_table(hdc);
 
+    if (psc->GDEF_Table)
+    {
+        const GDEF_Header *header = psc->GDEF_Table;
+        WORD offset = GET_BE_WORD( header->GlyphClassDef );
+        if (offset)
+            glyph_class_table = (BYTE *)psc->GDEF_Table + offset;
+    }
+
     for (i = 0; i < cGlyphs; i++)
     {
         WORD class;
@@ -602,7 +604,7 @@ void OpenType_GDEF_UpdateGlyphProps(HDC hdc, ScriptCache *psc, const WORD *pwGly
                 char_count++;
         }
 
-        class = GDEF_get_glyph_class(psc->GDEF_Table, pwGlyphs[i]);
+        class = OT_get_glyph_class( glyph_class_table, pwGlyphs[i] );
 
         switch (class)
         {




More information about the wine-cvs mailing list