Akihiro Sagawa : gdi32: Return an boolean value whether synthesizing bold glyph is success.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jan 15 10:48:55 CST 2016


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

Author: Akihiro Sagawa <sagawa.aki at gmail.com>
Date:   Wed Jan 13 23:09:09 2016 +0900

gdi32: Return an boolean value whether synthesizing bold glyph is success.

Signed-off-by: Akihiro Sagawa <sagawa.aki at gmail.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdi32/freetype.c | 52 ++++++++++++++++++++++-----------------------------
 1 file changed, 22 insertions(+), 30 deletions(-)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index a5b320b..569dc02 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -6400,40 +6400,32 @@ static inline FT_Vector normalize_vector(FT_Vector *vec)
     return out;
 }
 
-static void synthesize_bold_glyph(FT_GlyphSlot glyph, LONG ppem, FT_Glyph_Metrics *metrics)
+static BOOL get_bold_glyph_outline(FT_GlyphSlot glyph, LONG ppem, FT_Glyph_Metrics *metrics)
 {
     FT_Error err;
-    static UINT once;
+    FT_Pos strength;
+    FT_BBox bbox;
 
-    switch(glyph->format) {
-    case FT_GLYPH_FORMAT_OUTLINE:
-    {
-        FT_Pos strength;
-        FT_BBox bbox;
-        if(!pFT_Outline_Embolden)
-            break;
-
-        strength = MulDiv(ppem, 1 << 6, 24);
-        err = pFT_Outline_Embolden(&glyph->outline, strength);
-        if(err) {
-            TRACE("FT_Ouline_Embolden returns %d, ignored\n", err);
-            break;
-        }
+    if(glyph->format != FT_GLYPH_FORMAT_OUTLINE)
+        return FALSE;
+    if(!pFT_Outline_Embolden)
+        return FALSE;
 
-        pFT_Outline_Get_CBox(&glyph->outline, &bbox);
-        metrics->width = bbox.xMax - bbox.xMin;
-        metrics->height = bbox.yMax - bbox.yMin;
-        metrics->horiBearingX = bbox.xMin;
-        metrics->horiBearingY = bbox.yMax;
-        metrics->vertBearingX = metrics->horiBearingX - metrics->horiAdvance / 2;
-        metrics->vertBearingY = (metrics->vertAdvance - metrics->height) / 2;
-        break;
-    }
-    default:
-        if (!once++)
-            WARN("Emboldening format 0x%x is not supported\n", glyph->format);
-        return;
+    strength = MulDiv(ppem, 1 << 6, 24);
+    err = pFT_Outline_Embolden(&glyph->outline, strength);
+    if(err) {
+        TRACE("FT_Ouline_Embolden returns %d\n", err);
+        return FALSE;
     }
+
+    pFT_Outline_Get_CBox(&glyph->outline, &bbox);
+    metrics->width = bbox.xMax - bbox.xMin;
+    metrics->height = bbox.yMax - bbox.yMin;
+    metrics->horiBearingX = bbox.xMin;
+    metrics->horiBearingY = bbox.yMax;
+    metrics->vertBearingX = metrics->horiBearingX - metrics->horiAdvance / 2;
+    metrics->vertBearingY = (metrics->vertAdvance - metrics->height) / 2;
+    return TRUE;
 }
 
 static inline BYTE get_max_level( UINT format )
@@ -6926,7 +6918,7 @@ static DWORD get_glyph_outline(GdiFont *incoming_font, UINT glyph, UINT format,
 
     metrics = ft_face->glyph->metrics;
     if(font->fake_bold)
-        synthesize_bold_glyph(ft_face->glyph, font->ppem, &metrics);
+        get_bold_glyph_outline(ft_face->glyph, font->ppem, &metrics);
 
     /* Some poorly-created fonts contain glyphs that exceed the boundaries set
      * by the text metrics. The proper behavior is to clip the glyph metrics to




More information about the wine-cvs mailing list