Modify TIZEN_FT_EMBOLDEN_FOR_SYNTHETIC_BOLD option
authorHyeonji Kim <hyeonji.kim@samsung.com>
Tue, 1 Oct 2013 01:21:31 +0000 (10:21 +0900)
committerHyeonji Kim <hyeonji.kim@samsung.com>
Wed, 2 Oct 2013 07:21:19 +0000 (16:21 +0900)
[Title] Modify TIZEN_FT_EMBOLDEN_FOR_SYNTHETIC_BOLD option
[Issue#] N/A
[Problem] the synthetic bold font is too thick
[Cause] webkit draws twice for synthetic bold
[Solution] use freetype's 'embolden' instead of drawing twice for system font's visibility

Change-Id: Ia996c7a88235fc8fdb8218a134c1fe780eb5576e

Source/WTF/wtf/Platform.h
Source/WebCore/platform/graphics/cairo/FontCairo.cpp [changed mode: 0755->0644]
Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp [changed mode: 0755->0644]

index 1175d7b..59fcd28 100644 (file)
 #define ENABLE_TIZEN_SET_CARET_HEIGHT_TO_OBJECT_HEIGHT 1 /*KyungTae Kim(ktf.kim@samsung.com) : Set caret height from selection height to object height for fix the case that image and text are in the same line (Bug 116424)*/
 #define ENABLE_TIZEN_POSITIONED_CHILD_RELAYOUT 0 /*KyungTae Kim(ktf.kim@samsung.com) : If posChildNeedsLayout() but !m_positionedObjects, normal layout is needed for updating m_positionedObjects*/
 #if USE(FREETYPE)
-#define ENABLE_TIZEN_FT_EMBOLDEN_FOR_SYNTHETIC_BOLD 0 /*Younghwan Cho(yhwan.cho@samsung.com) : Use freetype's 'embolden' instead of drawing twice for synthetic bold*/
+#define ENABLE_TIZEN_FT_EMBOLDEN_FOR_SYNTHETIC_BOLD 1 /*Younghwan Cho(yhwan.cho@samsung.com) : Use freetype's 'embolden' instead of drawing twice for synthetic bold*/
 #endif
 
 #define ENABLE_TIZEN_ADD_AA_CONDITIONS_FOR_NINE_PATCH 1 /*Younghwan Cho(yhwan.cho@samsung.com) : Add conditions of antialias for fixing 9patch-problem */
old mode 100755 (executable)
new mode 100644 (file)
index b189841..d6e43eb
@@ -45,17 +45,14 @@ namespace WebCore {
 
 static void drawGlyphsToContext(cairo_t* context, const SimpleFontData* font, GlyphBufferGlyph* glyphs, int numGlyphs)
 {
-#if !ENABLE(TIZEN_FT_EMBOLDEN_FOR_SYNTHETIC_BOLD)
     cairo_matrix_t originalTransform;
     float syntheticBoldOffset = font->syntheticBoldOffset();
     if (syntheticBoldOffset)
         cairo_get_matrix(context, &originalTransform);
-#endif
 
     cairo_set_scaled_font(context, font->platformData().scaledFont());
     cairo_show_glyphs(context, glyphs, numGlyphs);
 
-#if !ENABLE(TIZEN_FT_EMBOLDEN_FOR_SYNTHETIC_BOLD)
     if (syntheticBoldOffset) {
         cairo_translate(context, syntheticBoldOffset, 0);
         cairo_show_glyphs(context, glyphs, numGlyphs);
@@ -63,7 +60,6 @@ static void drawGlyphsToContext(cairo_t* context, const SimpleFontData* font, Gl
 
     if (syntheticBoldOffset)
         cairo_set_matrix(context, &originalTransform);
-#endif
 }
 
 static void drawGlyphsShadow(GraphicsContext* graphicsContext, const FloatPoint& point, const SimpleFontData* font, GlyphBufferGlyph* glyphs, int numGlyphs)
old mode 100755 (executable)
new mode 100644 (file)
index 140095a..a1b4dbb
@@ -132,12 +132,15 @@ FontPlatformData::FontPlatformData(FcPattern* pattern, const FontDescription& fo
     if (FcPatternGetInteger(pattern, FC_SPACING, 0, &spacing) == FcResultMatch && spacing == FC_MONO)
         m_fixedWidth = true;
 
+#if !ENABLE(TIZEN_FT_EMBOLDEN_FOR_SYNTHETIC_BOLD)
+    // Use freetype's 'embolden' instead of drawing twice for system font's visibility
     if (fontDescription.weight() >= FontWeightBold) {
         // The FC_EMBOLDEN property instructs us to fake the boldness of the font.
         FcBool fontConfigEmbolden;
         if (FcPatternGetBool(pattern, FC_EMBOLDEN, 0, &fontConfigEmbolden) == FcResultMatch)
             m_syntheticBold = fontConfigEmbolden;
     }
+#endif
 }
 
 FontPlatformData::FontPlatformData(float size, bool bold, bool italic)
@@ -318,11 +321,6 @@ void FontPlatformData::initializeWithFontFace(cairo_font_face_t* fontFace, const
         cairo_matrix_multiply(&fontMatrix, &skew, &fontMatrix);
     }
 
-#if ENABLE(TIZEN_FT_EMBOLDEN_FOR_SYNTHETIC_BOLD)
-    if(m_syntheticBold)
-        cairo_ft_font_face_set_synthesize(fontFace, CAIRO_FT_SYNTHESIZE_BOLD);
-#endif
-
     m_scaledFont = cairo_scaled_font_create(fontFace, &fontMatrix, &ctm, options);
     cairo_font_options_destroy(options);
 }