Fix Gmail spurious glyphs issue.
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 24 Mar 2007 06:24:59 +0000 (06:24 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 24 Mar 2007 06:24:59 +0000 (06:24 +0000)
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@20460 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/Font.cpp
WebCore/platform/Font.h
WebCore/platform/GlyphPageTreeNode.cpp

index 8528745152d3e1f70231b7a981c1e33aecf4c39a..0ea66011b777eef697afec5a7cc9d6b91c25273a 100644 (file)
@@ -1,3 +1,17 @@
+2007-03-23  Dave Hyatt  <hyatt@apple.com>
+
+        Fix for <rdar:://problem/5048219>, spurious glyphs in gmail.   This is bugzilla bug 13136, which
+        will remain open to cover patching the complex text path.
+        
+        Reviewed by aroben
+
+        * platform/Font.cpp:
+        (WebCore::Font::glyphDataForCharacter):
+        * platform/Font.h:
+        (WebCore::Font::treatAsZeroWidthSpace):
+        * platform/GlyphPageTreeNode.cpp:
+        (WebCore::GlyphPageTreeNode::initializePage):
+
 2007-03-23  Mitz Pettel  <mitz@webkit.org>
 
         Reviewed by Adele.
index 1251d209722567c1910edd4f5bd7c6e152026c52..8875a6179ef79cd0e866fef4324ce5baed693ce6 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "Font.h"
 
+#include "CharacterNames.h"
 #include "FloatRect.h"
 #include "FontCache.h"
 #include "FontFallbackList.h"
@@ -409,7 +410,13 @@ const GlyphData& Font::glyphDataForCharacter(UChar32 c, const UChar* cluster, un
 
         if (node->isSystemFallback()) {
             // System fallback is character-dependent.
-            const FontData* characterFontData = FontCache::getFontDataForCharacters(*this, cluster, clusterLength);
+            // Convert characters that shouldn't render to zero width spaces when asking what font is
+            // appropriate.
+            const FontData* characterFontData;
+            if (clusterLength == 1 && Font::treatAsZeroWidthSpace(cluster[0]))
+                characterFontData = FontCache::getFontDataForCharacters(*this, &zeroWidthSpace, 1);
+            else
+                characterFontData = FontCache::getFontDataForCharacters(*this, cluster, clusterLength);
             if (smallCaps)
                 characterFontData = characterFontData->smallCapsFontData(m_fontDescription);
             if (characterFontData) {
index 6e3dee6041ff72d65d117e59235409e6e4762d66..56cdef8c95edb4e215100f4f1227ad98d01c4377 100644 (file)
@@ -178,6 +178,7 @@ public:
     
     static const uint8_t gRoundingHackCharacterTable[256];
     static bool treatAsSpace(UChar c) { return c == ' ' || c == '\t' || c == '\n' || c == 0x00A0; }
+    static bool treatAsZeroWidthSpace(UChar c) { return c < 0x20 || (c >= 0x7F && c < 0xA0) || c == 0x200e || c == 0x200f; }
     static bool isRoundingHackCharacter(UChar32 c)
     {
         return (((c & ~0xFF) == 0 && gRoundingHackCharacterTable[c])); 
index ebbd9816bfd310ad562f7522b3eb2b11f3f38235..a24da34b2479f487b61aaceb008e852e6e556777 100644 (file)
@@ -84,6 +84,10 @@ void GlyphPageTreeNode::initializePage(const FontData* fontData, unsigned pageNu
                     buffer[(int)'\n'] = ' ';
                     buffer[(int)'\t'] = ' ';
                     buffer[noBreakSpace] = ' ';
+                } else if (start == 8192) {
+                    // LRM/RLM must not render at all
+                    buffer[0x200e - start] = zeroWidthSpace;
+                    buffer[0x200f - start] = zeroWidthSpace;
                 }
             } else {
                 bufferLength = GlyphPage::size * 2;