From b857100202714bf77aac03cb41b60614dd8dc299 Mon Sep 17 00:00:00 2001 From: Rachit Puri Date: Mon, 7 Oct 2013 11:37:44 +0545 Subject: [PATCH] [Title] Average Char width fix for Search box of google.com when the region is Arabic. [Issue#] N_SE-51504 [Problem] Search box of google.com not displayed properly when the display language is Arabic and the region is Arabic. [Cause] Average Char width was not picked. [Solution] Added code to calculate Average Width from Space. [Developer] h.joshi@samsung.com Change-Id: Ia27ea4e70bffac311223a5e94c6f52a169811a52 --- Source/WTF/wtf/Platform.h | 1 + Source/WebCore/platform/graphics/SimpleFontData.cpp | 7 +++++++ 2 files changed, 8 insertions(+) mode change 100644 => 100755 Source/WTF/wtf/Platform.h mode change 100644 => 100755 Source/WebCore/platform/graphics/SimpleFontData.cpp diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h old mode 100644 new mode 100755 index e29f937..c09936e --- a/Source/WTF/wtf/Platform.h +++ b/Source/WTF/wtf/Platform.h @@ -423,6 +423,7 @@ #if USE(FREETYPE) #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_CHECK_SPACE_FOR_AVG_CHAR_WIDTH 1 /* Himanshu Joshi (h.joshi@samsung.com : Added check to consider Space as possible way to calculate Average Char Width if '0' and 'x' are not present*/ #define ENABLE_TIZEN_ADD_AA_CONDITIONS_FOR_NINE_PATCH 1 /*Younghwan Cho(yhwan.cho@samsung.com) : Add conditions of antialias for fixing 9patch-problem */ #define ENABLE_TIZEN_WEBKIT_OWN_FONT_FILES 0 /*Younghwan Cho(yhwan.cho@samsung.com) : webkit's font-config is seperated from the system font's*/ diff --git a/Source/WebCore/platform/graphics/SimpleFontData.cpp b/Source/WebCore/platform/graphics/SimpleFontData.cpp old mode 100644 new mode 100755 index 222e433..cdbaa15 --- a/Source/WebCore/platform/graphics/SimpleFontData.cpp +++ b/Source/WebCore/platform/graphics/SimpleFontData.cpp @@ -87,6 +87,13 @@ void SimpleFontData::initCharWidths() if (m_avgCharWidth <= 0.f) m_avgCharWidth = m_fontMetrics.xHeight(); +#if ENABLE(TIZEN_CHECK_SPACE_FOR_AVG_CHAR_WIDTH) + if (m_avgCharWidth <= 0.f) { + Glyph spaceGlyph = glyphPageZero->glyphDataForCharacter(' ').glyph; + m_avgCharWidth = widthForGlyph(spaceGlyph); + } +#endif + if (m_maxCharWidth <= 0.f) m_maxCharWidth = max(m_avgCharWidth, m_fontMetrics.floatAscent()); } -- 2.7.4