Title: [149282] trunk/Source/WebCore
Revision
149282
Author
commit-qu...@webkit.org
Date
2013-04-29 07:46:05 -0700 (Mon, 29 Apr 2013)

Log Message

[BlackBerry] Fake-bold monospace fonts need to use non-fake-bold advances
https://bugs.webkit.org/show_bug.cgi?id=115280

Patch by Eli Fidler <efid...@blackberry.com> on 2013-04-29
Reviewed by George Staikos.

BlackBerry PR 330864

Tested by fast/css/css3-ch-unit.html

* platform/graphics/blackberry/FontPlatformDataBlackBerry.cpp:
(WebCore::FontPlatformData::applyState):
(WebCore::FontPlatformData::isFixedPitch):
* platform/graphics/blackberry/ITypeUtils.h:
* platform/graphics/blackberry/SimpleFontDataBlackBerry.cpp:
(WebCore::SimpleFontData::platformWidthForGlyph):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (149281 => 149282)


--- trunk/Source/WebCore/ChangeLog	2013-04-29 14:36:31 UTC (rev 149281)
+++ trunk/Source/WebCore/ChangeLog	2013-04-29 14:46:05 UTC (rev 149282)
@@ -1,3 +1,21 @@
+2013-04-29  Eli Fidler  <efid...@blackberry.com>
+
+        [BlackBerry] Fake-bold monospace fonts need to use non-fake-bold advances
+        https://bugs.webkit.org/show_bug.cgi?id=115280
+
+        Reviewed by George Staikos.
+
+        BlackBerry PR 330864
+
+        Tested by fast/css/css3-ch-unit.html
+
+        * platform/graphics/blackberry/FontPlatformDataBlackBerry.cpp:
+        (WebCore::FontPlatformData::applyState):
+        (WebCore::FontPlatformData::isFixedPitch):
+        * platform/graphics/blackberry/ITypeUtils.h:
+        * platform/graphics/blackberry/SimpleFontDataBlackBerry.cpp:
+        (WebCore::SimpleFontData::platformWidthForGlyph):
+
 2013-04-29  ChangSeok Oh  <changseok...@collabora.com>
 
         [GTK][AC] Clean up code related with the children management stuff for clutter based AC

Modified: trunk/Source/WebCore/platform/graphics/blackberry/FontPlatformDataBlackBerry.cpp (149281 => 149282)


--- trunk/Source/WebCore/platform/graphics/blackberry/FontPlatformDataBlackBerry.cpp	2013-04-29 14:36:31 UTC (rev 149281)
+++ trunk/Source/WebCore/platform/graphics/blackberry/FontPlatformDataBlackBerry.cpp	2013-04-29 14:46:05 UTC (rev 149282)
@@ -75,7 +75,7 @@
                 return false;
 
     if (m_syntheticBold) {
-        if (FS_set_bold_pct(font, floatToITypeFixed(0.06)) != SUCCESS) // 6% pseudo bold
+        if (FS_set_bold_pct(font, ITYPEFAKEBOLDAMOUNT) != SUCCESS)
             return false;
         FS_set_flags(font, FLAGS_CHECK_CONTOUR_WINDING_ON); // we need correctly-wound contours to fake bold
     } else {
@@ -216,9 +216,13 @@
 
 bool FontPlatformData::isFixedPitch() const
 {
-    TTF_POST post;
-    if (m_font && FS_get_table_structure(m_font, TAG_post, &post) == SUCCESS)
-        return post.isFixedPitch;
+    FS_BYTE* postTable;
+    FS_ULONG length;
+    if (m_font && (postTable = FS_get_table(m_font, TAG_post, TBL_EXTRACT, &length))) {
+        bool fixed = reinterpret_cast<TTF_POST*>(postTable)->isFixedPitch;
+        FS_free_table(m_font, postTable);
+        return fixed;
+    }
     return false;
 }
 

Modified: trunk/Source/WebCore/platform/graphics/blackberry/ITypeUtils.h (149281 => 149282)


--- trunk/Source/WebCore/platform/graphics/blackberry/ITypeUtils.h	2013-04-29 14:36:31 UTC (rev 149281)
+++ trunk/Source/WebCore/platform/graphics/blackberry/ITypeUtils.h	2013-04-29 14:46:05 UTC (rev 149282)
@@ -40,4 +40,6 @@
 
 static const FS_FIXED MAXITYPEFONTSCALE = intToITypeFixed(10000) - 1;
 
+static const FS_FIXED ITYPEFAKEBOLDAMOUNT = floatToITypeFixed(0.06); // 6% pseudo bold
+
 #endif // ITypeUtils_h

Modified: trunk/Source/WebCore/platform/graphics/blackberry/SimpleFontDataBlackBerry.cpp (149281 => 149282)


--- trunk/Source/WebCore/platform/graphics/blackberry/SimpleFontDataBlackBerry.cpp	2013-04-29 14:36:31 UTC (rev 149281)
+++ trunk/Source/WebCore/platform/graphics/blackberry/SimpleFontDataBlackBerry.cpp	2013-04-29 14:46:05 UTC (rev 149282)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012 Research In Motion Limited. All rights reserved.
+ * Copyright (C) 2012, 2013 Research In Motion Limited. All rights reserved.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -157,9 +157,23 @@
 {
     FS_SHORT idx, idy;
     FS_FIXED dx, dy;
+    FS_FIXED s00, s01, s10, s11;
+    bool needsFakeBoldReset = m_platformData.syntheticBold() && m_treatAsFixedPitch;
+
+    if (needsFakeBoldReset) {
+        FS_get_scale(m_platformData.font(), &s00, &s01, &s10, &s11);
+        FS_set_bold_pct(m_platformData.font(), 0);
+        FS_set_scale(m_platformData.font(), s00, s01, s10, s11);
+    }
+
     if (FS_get_advance(m_platformData.font(), glyph, FS_MAP_DISTANCEFIELD | FS_MAP_GRAYMAP8, &idx, &idy, &dx, &dy) != SUCCESS)
-        return 0;
+        dx = 0;
 
+    if (needsFakeBoldReset) {
+        FS_set_bold_pct(m_platformData.font(), ITYPEFAKEBOLDAMOUNT);
+        FS_set_scale(m_platformData.font(), s00, s01, s10, s11);
+    }
+
     return iTypeFixedToFloat(dx);
 }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to