[Title] Average Char width fix for Search box of google.com when the region is Arabic.
authorRachit Puri <rachit.puri@samsung.com>
Mon, 7 Oct 2013 05:52:44 +0000 (11:37 +0545)
committerGerrit Code Review <gerrit@gerrit.vlan144.tizendev.org>
Tue, 8 Oct 2013 13:14:07 +0000 (13:14 +0000)
[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 [changed mode: 0644->0755]
Source/WebCore/platform/graphics/SimpleFontData.cpp [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index e29f937..c09936e
 #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*/
old mode 100644 (file)
new mode 100755 (executable)
index 222e433..cdbaa15
@@ -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());
 }