Aric Stewart : usp10: Use font chartype only as a fallback if we do not know the characters script already .

Alexandre Julliard julliard at winehq.org
Mon May 24 11:30:48 CDT 2010


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

Author: Aric Stewart <aric at codeweavers.com>
Date:   Fri May 21 15:10:56 2010 -0500

usp10: Use font chartype only as a fallback if we do not know the characters script already.

---

 dlls/usp10/shape.c |   30 +++++++++++++++++++++++-------
 1 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/dlls/usp10/shape.c b/dlls/usp10/shape.c
index 71022ef..55c8a80 100644
--- a/dlls/usp10/shape.c
+++ b/dlls/usp10/shape.c
@@ -347,13 +347,29 @@ static UINT GSUB_apply_feature(const GSUB_Header * header, const GSUB_Feature* f
     return glyph;
 }
 
-static const char* get_opentype_script(HDC hdc)
+static const char* get_opentype_script(HDC hdc, SCRIPT_ANALYSIS *psa)
 {
+    UINT charset;
+
+    switch (psa->eScript)
+    {
+        case Script_Arabic:
+            return "arab";
+        case Script_Syriac:
+            return "syrc";
+        case Script_Hebrew:
+            return "hebr";
+        case Script_Latin:
+        case Script_Numeric:
+        case Script_CR:
+        case Script_LF:
+            return "latn";
+    }
+
     /*
-     * I am not sure if this is the correct way to generate our script tag
+     * fall back to the font charset
      */
-    UINT charset = GetTextCharsetInfo(hdc, NULL, 0x0);
-
+    charset = GetTextCharsetInfo(hdc, NULL, 0x0);
     switch (charset)
     {
         case ANSI_CHARSET: return "latn";
@@ -375,7 +391,7 @@ static const char* get_opentype_script(HDC hdc)
     }
 }
 
-static WORD get_GSUB_feature_glyph(HDC hdc, void* GSUB_Table, UINT glyph, const char* feat)
+static WORD get_GSUB_feature_glyph(HDC hdc, SCRIPT_ANALYSIS *psa, void* GSUB_Table, UINT glyph, const char* feat)
 {
     const GSUB_Header *header;
     const GSUB_Script *script;
@@ -387,7 +403,7 @@ static WORD get_GSUB_feature_glyph(HDC hdc, void* GSUB_Table, UINT glyph, const
 
     header = GSUB_Table;
 
-    script = GSUB_get_script_table(header, get_opentype_script(hdc));
+    script = GSUB_get_script_table(header, get_opentype_script(hdc,psa));
     if (!script)
     {
         TRACE("Script not found\n");
@@ -509,7 +525,7 @@ void SHAPE_ShapeArabicGlyphs(HDC hdc, ScriptCache *psc, SCRIPT_ANALYSIS *psa, WC
         WORD newGlyph = pwOutGlyphs[i];
 
         if (psc->GSUB_Table)
-            newGlyph = get_GSUB_feature_glyph(hdc, psc->GSUB_Table, pwOutGlyphs[i], contextual_features[context_shape[i]]);
+            newGlyph = get_GSUB_feature_glyph(hdc, psa, psc->GSUB_Table, pwOutGlyphs[i], contextual_features[context_shape[i]]);
         if (newGlyph == pwOutGlyphs[i] && pwcChars[i] >= FIRST_ARABIC_CHAR && pwcChars[i] <= LAST_ARABIC_CHAR)
         {
             /* fall back to presentation form B */




More information about the wine-cvs mailing list