2010-04-27 Evan Martin <evan@chromium.org>
authorevan@chromium.org <evan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Apr 2010 21:53:54 +0000 (21:53 +0000)
committerevan@chromium.org <evan@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 27 Apr 2010 21:53:54 +0000 (21:53 +0000)
        Reviewed by David Levin.

        [chromium] bold bengali text not rendered properly on Linux
        https://bugs.webkit.org/show_bug.cgi?id=37904

        Add a layout test containing some bold Bengali text.

        * fast/text/international/bold-bengali.html: Added.
        * platform/chromium-linux/fast/text/international/bold-bengali-expected.checksum: Added.
        * platform/chromium-linux/fast/text/international/bold-bengali-expected.png: Added.
        * platform/chromium-linux/fast/text/international/bold-bengali-expected.txt: Added.
2010-04-27  Evan Martin  <evan@chromium.org>

        Reviewed by David Levin.

        [chromium] bold bengali text not rendered properly on Linux
        https://bugs.webkit.org/show_bug.cgi?id=37904

        We must let Skia do font fallback, rather than picking a font name
        then handing that to Skia.  For example, if we have Bengali text and
        choose FreeSans + fake bold, and then later reuse the name, Skia will
        helpfully use FreeSansBold (which doesn't cover Bengali).

        Test: fast/text/international/bold-bengali.html

        * platform/graphics/chromium/FontCacheLinux.cpp:
        (WebCore::FontCache::getFontDataForCharacters):
2010-04-27  Evan Martin  <evan@chromium.org>

        Reviewed by David Levin.

        [chromium] bold bengali text not rendered properly on Linux
        Roll forward Chrome DEPS so we get new Skia API.

        * DEPS: update Chrome to r45696.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@58341 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/text/international/bold-bengali.html [new file with mode: 0644]
LayoutTests/platform/chromium-linux/fast/text/international/bold-bengali-expected.checksum [new file with mode: 0644]
LayoutTests/platform/chromium-linux/fast/text/international/bold-bengali-expected.png [new file with mode: 0644]
LayoutTests/platform/chromium-linux/fast/text/international/bold-bengali-expected.txt [new file with mode: 0644]
WebCore/ChangeLog
WebCore/platform/chromium/ChromiumBridge.h
WebCore/platform/graphics/chromium/FontCacheLinux.cpp
WebKit/chromium/ChangeLog
WebKit/chromium/DEPS

index a4c7be7..2600b50 100644 (file)
@@ -1,3 +1,17 @@
+2010-04-27  Evan Martin  <evan@chromium.org>
+
+        Reviewed by David Levin.
+
+        [chromium] bold bengali text not rendered properly on Linux
+        https://bugs.webkit.org/show_bug.cgi?id=37904
+
+        Add a layout test containing some bold Bengali text.
+
+        * fast/text/international/bold-bengali.html: Added.
+        * platform/chromium-linux/fast/text/international/bold-bengali-expected.checksum: Added.
+        * platform/chromium-linux/fast/text/international/bold-bengali-expected.png: Added.
+        * platform/chromium-linux/fast/text/international/bold-bengali-expected.txt: Added.
+
 2010-04-27  Adam Barth  <abarth@webkit.org>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/fast/text/international/bold-bengali.html b/LayoutTests/fast/text/international/bold-bengali.html
new file mode 100644 (file)
index 0000000..d86144f
--- /dev/null
@@ -0,0 +1,10 @@
+<meta charset=utf-8>
+
+<p>This test verifies we can render bold Bengali properly.  (This is complicated on Linux because it's typically covered
+by fake-bolded FreeSans even though there's also a FreeSansBold available.)</p>
+
+<p>The test passes if the two words below look similar, but the top one is bold.  There should be no missing-glyph
+boxes.</p>
+
+<p><b>বাংলা</b><p>
+<p>বাংলা</p>
diff --git a/LayoutTests/platform/chromium-linux/fast/text/international/bold-bengali-expected.checksum b/LayoutTests/platform/chromium-linux/fast/text/international/bold-bengali-expected.checksum
new file mode 100644 (file)
index 0000000..2cedccd
--- /dev/null
@@ -0,0 +1 @@
+1a72c5a7bd5118099cd4399d1d03187e
\ No newline at end of file
diff --git a/LayoutTests/platform/chromium-linux/fast/text/international/bold-bengali-expected.png b/LayoutTests/platform/chromium-linux/fast/text/international/bold-bengali-expected.png
new file mode 100644 (file)
index 0000000..25fc22b
Binary files /dev/null and b/LayoutTests/platform/chromium-linux/fast/text/international/bold-bengali-expected.png differ
diff --git a/LayoutTests/platform/chromium-linux/fast/text/international/bold-bengali-expected.txt b/LayoutTests/platform/chromium-linux/fast/text/international/bold-bengali-expected.txt
new file mode 100644 (file)
index 0000000..1fa4337
--- /dev/null
@@ -0,0 +1,22 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+  RenderBlock {HTML} at (0,0) size 800x600
+    RenderBody {BODY} at (8,8) size 784x576
+      RenderBlock {P} at (0,0) size 784x40
+        RenderText {#text} at (0,0) size 780x39
+          text run at (0,0) width 328: "This test verifies we can render bold Bengali properly. "
+          text run at (328,0) width 452: "(This is complicated on Linux because it's typically covered by fake-bolded"
+          text run at (0,20) width 370: "FreeSans even though there's also a FreeSansBold available.)"
+      RenderBlock {P} at (0,56) size 784x20
+        RenderText {#text} at (0,0) size 704x19
+          text run at (0,0) width 459: "The test passes if the two words below look similar, but the top one is bold. "
+          text run at (459,0) width 245: "There should be no missing-glyph boxes."
+      RenderBlock {P} at (0,92) size 784x20
+        RenderInline {B} at (0,0) size 35x19
+          RenderText {#text} at (0,0) size 35x19
+            text run at (0,0) width 35: "\x{9AC}\x{9BE}\x{982}\x{9B2}\x{9BE}"
+      RenderBlock {P} at (0,128) size 784x0
+      RenderBlock {P} at (0,128) size 784x20
+        RenderText {#text} at (0,0) size 35x19
+          text run at (0,0) width 35: "\x{9AC}\x{9BE}\x{982}\x{9B2}\x{9BE}"
index bdca545..b37a69d 100644 (file)
@@ -1,3 +1,20 @@
+2010-04-27  Evan Martin  <evan@chromium.org>
+
+        Reviewed by David Levin.
+
+        [chromium] bold bengali text not rendered properly on Linux
+        https://bugs.webkit.org/show_bug.cgi?id=37904
+
+        We must let Skia do font fallback, rather than picking a font name
+        then handing that to Skia.  For example, if we have Bengali text and
+        choose FreeSans + fake bold, and then later reuse the name, Skia will
+        helpfully use FreeSansBold (which doesn't cover Bengali).
+
+        Test: fast/text/international/bold-bengali.html
+
+        * platform/graphics/chromium/FontCacheLinux.cpp:
+        (WebCore::FontCache::getFontDataForCharacters):
+
 2010-04-27  James Robinson  <jamesr@chromium.org>
 
         Reviewed by Darin Adler.
index e582241..1f0040d 100644 (file)
@@ -116,6 +116,8 @@ namespace WebCore {
 #endif
 #if OS(LINUX)
         static void getRenderStyleForStrike(const char* family, int sizeAndStyle, FontRenderStyle* result);
+        // This code is currently in the process of getting rejiggered, and though
+        // it is not currently used, it will hopefully be used again soon.
         static String getFontFamilyForCharacters(const UChar*, size_t numCharacters);
 #endif
 
index ececd13..b37e1c7 100644 (file)
@@ -58,12 +58,27 @@ const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font,
                                                           const UChar* characters,
                                                           int length)
 {
-    String family = ChromiumBridge::getFontFamilyForCharacters(characters, length);
-    if (family.isEmpty())
+    int style = SkTypeface::kNormal;
+    if (font.fontDescription().weight() >= FontWeightBold)
+        style |= SkTypeface::kBold;
+    if (font.fontDescription().italic())
+        style |= SkTypeface::kItalic;
+
+    SkTypeface* tf = SkTypeface::CreateForChars(characters, length * 2,
+                                                static_cast<SkTypeface::Style>(style));
+    if (!tf)
         return 0;
 
-    AtomicString atomicFamily(family);
-    return getCachedFontData(getCachedFontPlatformData(font.fontDescription(), atomicFamily, false));
+    // FIXME: we don't have a family name for this font.
+    // However, the family name within FontPlatformData is only used when picking
+    // a render style for the font, so it's not too great of a loss.
+    FontPlatformData result(tf,
+                            "",
+                            font.fontDescription().computedSize(),
+                            (style & SkTypeface::kBold) && !tf->isBold(),
+                            (style & SkTypeface::kItalic) && !tf->isItalic());
+    tf->unref();
+    return getCachedFontData(&result);
 }
 
 SimpleFontData* FontCache::getSimilarFontPlatformData(const Font& font)
index 21b7864..72233fd 100644 (file)
@@ -1,3 +1,12 @@
+2010-04-27  Evan Martin  <evan@chromium.org>
+
+        Reviewed by David Levin.
+
+        [chromium] bold bengali text not rendered properly on Linux
+        Roll forward Chrome DEPS so we get new Skia API.
+
+        * DEPS: update Chrome to r45696.
+
 2010-04-27  Andrey Kosyakov  <caseq@chromium.org>
 
         Reviewed by Pavel Feldman.
index 15f2917..ae34c42 100644 (file)
@@ -32,7 +32,7 @@
 
 vars = {
   'chromium_svn': 'http://src.chromium.org/svn/trunk/src',
-  'chromium_rev': '45294',
+  'chromium_rev': '45696',
 
   'pthreads-win32_rev': '26716',
 }