From 26230dd77b7bc5cbd49cd448e150c746cba2e031 Mon Sep 17 00:00:00 2001 From: Hyeonji Kim Date: Tue, 1 Oct 2013 10:21:31 +0900 Subject: [PATCH] Modify TIZEN_FT_EMBOLDEN_FOR_SYNTHETIC_BOLD option [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 | 2 +- Source/WebCore/platform/graphics/cairo/FontCairo.cpp | 4 ---- .../platform/graphics/freetype/FontPlatformDataFreeType.cpp | 8 +++----- 3 files changed, 4 insertions(+), 10 deletions(-) mode change 100755 => 100644 Source/WebCore/platform/graphics/cairo/FontCairo.cpp mode change 100755 => 100644 Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h index 1175d7b..59fcd28 100644 --- a/Source/WTF/wtf/Platform.h +++ b/Source/WTF/wtf/Platform.h @@ -420,7 +420,7 @@ #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 */ diff --git a/Source/WebCore/platform/graphics/cairo/FontCairo.cpp b/Source/WebCore/platform/graphics/cairo/FontCairo.cpp old mode 100755 new mode 100644 index b189841..d6e43eb --- a/Source/WebCore/platform/graphics/cairo/FontCairo.cpp +++ b/Source/WebCore/platform/graphics/cairo/FontCairo.cpp @@ -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) diff --git a/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp b/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp old mode 100755 new mode 100644 index 140095a..a1b4dbb --- a/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp +++ b/Source/WebCore/platform/graphics/freetype/FontPlatformDataFreeType.cpp @@ -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); } -- 2.7.4