[PATCH 3/3] dwrite: Use right charmap for symbol encoding

Nikolay Sivov nsivov at codeweavers.com
Wed Aug 5 17:02:52 CDT 2015


---

-------------- next part --------------
>From 3992bffdedb6ccc70b9ee3cd1527262ed0f10589 Mon Sep 17 00:00:00 2001
From: Nikolay Sivov <nsivov at codeweavers.com>
Date: Wed, 5 Aug 2015 20:57:20 +0300
Subject: [PATCH 4/4] dwrite: Use right charmap for symbol encoding

---
 dlls/dwrite/dwrite_private.h |  2 +-
 dlls/dwrite/font.c           |  2 +-
 dlls/dwrite/freetype.c       | 14 +++++++++++---
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/dlls/dwrite/dwrite_private.h b/dlls/dwrite/dwrite_private.h
index cee49df..4418c92 100644
--- a/dlls/dwrite/dwrite_private.h
+++ b/dlls/dwrite/dwrite_private.h
@@ -190,7 +190,7 @@ extern void freetype_notify_cacheremove(IDWriteFontFace2*) DECLSPEC_HIDDEN;
 extern BOOL freetype_is_monospaced(IDWriteFontFace2*) DECLSPEC_HIDDEN;
 extern HRESULT freetype_get_glyph_outline(IDWriteFontFace2*,FLOAT,UINT16,USHORT,struct glyph_outline**) DECLSPEC_HIDDEN;
 extern UINT16 freetype_get_glyphcount(IDWriteFontFace2*) DECLSPEC_HIDDEN;
-extern UINT16 freetype_get_glyphindex(IDWriteFontFace2*,UINT32) DECLSPEC_HIDDEN;
+extern UINT16 freetype_get_glyphindex(IDWriteFontFace2*,UINT32,INT) DECLSPEC_HIDDEN;
 extern BOOL freetype_has_kerning_pairs(IDWriteFontFace2*) DECLSPEC_HIDDEN;
 extern INT32 freetype_get_kerning_pair_adjustment(IDWriteFontFace2*,UINT16,UINT16) DECLSPEC_HIDDEN;
 extern void freetype_get_glyph_bbox(IDWriteFontFace2*,FLOAT,UINT16,BOOL,RECT*) DECLSPEC_HIDDEN;
diff --git a/dlls/dwrite/font.c b/dlls/dwrite/font.c
index a4ed575..56a3655 100644
--- a/dlls/dwrite/font.c
+++ b/dlls/dwrite/font.c
@@ -469,7 +469,7 @@ static HRESULT WINAPI dwritefontface_GetGlyphIndices(IDWriteFontFace2 *iface, UI
     }
 
     for (i = 0; i < count; i++)
-        glyph_indices[i] = freetype_get_glyphindex(iface, codepoints[i]);
+        glyph_indices[i] = freetype_get_glyphindex(iface, codepoints[i], This->charmap);
 
     return S_OK;
 }
diff --git a/dlls/dwrite/freetype.c b/dlls/dwrite/freetype.c
index e693f9a..3290243 100644
--- a/dlls/dwrite/freetype.c
+++ b/dlls/dwrite/freetype.c
@@ -437,12 +437,20 @@ UINT16 freetype_get_glyphcount(IDWriteFontFace2 *fontface)
     return count;
 }
 
-UINT16 freetype_get_glyphindex(IDWriteFontFace2 *fontface, UINT32 codepoint)
+UINT16 freetype_get_glyphindex(IDWriteFontFace2 *fontface, UINT32 codepoint, INT charmap)
 {
     UINT16 glyph;
 
     EnterCriticalSection(&freetype_cs);
-    glyph = pFTC_CMapCache_Lookup(cmap_cache, fontface, -1, codepoint);
+    if (charmap == -1)
+        glyph = pFTC_CMapCache_Lookup(cmap_cache, fontface, charmap, codepoint);
+    else {
+        /* special handling for symbol fonts */
+        if (codepoint < 0x100) codepoint += 0xf000;
+        glyph = pFTC_CMapCache_Lookup(cmap_cache, fontface, charmap, codepoint);
+        if (!glyph)
+            glyph = pFTC_CMapCache_Lookup(cmap_cache, fontface, charmap, codepoint - 0xf000);
+    }
     LeaveCriticalSection(&freetype_cs);
 
     return glyph;
@@ -627,7 +635,7 @@ UINT16 freetype_get_glyphcount(IDWriteFontFace2 *fontface)
     return 0;
 }
 
-UINT16 freetype_get_glyphindex(IDWriteFontFace2 *fontface, UINT32 codepoint)
+UINT16 freetype_get_glyphindex(IDWriteFontFace2 *fontface, UINT32 codepoint, INT charmap)
 {
     return 0;
 }
-- 
2.1.4



More information about the wine-patches mailing list