summaryrefslogtreecommitdiffstats
path: root/webkit/port
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-31 17:09:58 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-31 17:09:58 +0000
commitfbb01dacbe3890f43760a2ef9f94217f3df886d8 (patch)
tree7fad784a5e9a54dca4c3e9ef47707cf31795025c /webkit/port
parentd31ba262f94f866dff2c40191a0fb62c89be3fe6 (diff)
downloadchromium_src-fbb01dacbe3890f43760a2ef9f94217f3df886d8.zip
chromium_src-fbb01dacbe3890f43760a2ef9f94217f3df886d8.tar.gz
chromium_src-fbb01dacbe3890f43760a2ef9f94217f3df886d8.tar.bz2
This fixes the problem of little boxes appearing in Gmail when you don't have Arial Unicode MS installed.
The problem is that we don't find a font that defines the LTR character. We map this to the 0 glyph, which then renders as a box. We want normal characters that aren't found to render as a box so the user will know that there are characters there that they aren't seeing. We just don't want a few particular ones to ever appear. The same thing happens when we encounter a real zero width space character, which is even more bizarre. This change maps all characters that should be treated as spaces to spaces, and all widths for zero widths characters to be zero width. WebKit bug https://bugs.webkit.org/show_bug.cgi?id=20237 BUG=1166024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@183 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/port')
-rw-r--r--webkit/port/platform/graphics/GlyphPageTreeNodeWin.cpp23
1 files changed, 22 insertions, 1 deletions
diff --git a/webkit/port/platform/graphics/GlyphPageTreeNodeWin.cpp b/webkit/port/platform/graphics/GlyphPageTreeNodeWin.cpp
index 65d1350..315bef7c 100644
--- a/webkit/port/platform/graphics/GlyphPageTreeNodeWin.cpp
+++ b/webkit/port/platform/graphics/GlyphPageTreeNodeWin.cpp
@@ -32,6 +32,7 @@
#include <windows.h>
#include <vector>
+#include "Font.h"
#include "GlyphPageTreeNode.h"
#include "SimpleFontData.h"
#include "UniscribeStateTextRun.h"
@@ -145,8 +146,28 @@ static bool FillBMPGlyphs(UChar* buffer,
!(tm.tmPitchAndFamily & TMPF_TRUETYPE))
invalid_glyph = 0x1F;
+ WORD space_glyph = 0; // Glyph for a space. Lazily filled, see below.
+
for (unsigned i = 0; i < GlyphPage::size; i++) {
- if (localGlyphBuffer[i] == invalid_glyph) {
+ // When this character should be a space, we ignore whatever the font
+ // says and use a space. Otherwise, if fonts don't map one of these
+ // space or zero width glyphs, we will get a box.
+ //
+ // TODO(brettw): we should have Font::treatAsZeroWidthSpace return true
+ // for zero width spaces (U+200B) just like Font::treatAsSpace will
+ // return true for spaces. Then the additional OR is not necessary.
+ if (Font::treatAsSpace(buffer[i]) ||
+ Font::treatAsZeroWidthSpace(buffer[i]) ||
+ buffer[i] == 0x200B) {
+ // Hard code the glyph indices for characters that should be treated
+ // like spaces.
+ if (!space_glyph) {
+ // Get the glyph index for space.
+ wchar_t space = ' ';
+ GetGlyphIndices(dc, &space, 1, &space_glyph, 0);
+ }
+ page->setGlyphDataForIndex(i, space_glyph, fontData);
+ } else if (localGlyphBuffer[i] == invalid_glyph) {
// WebKit expects both the glyph index and FontData
// pointer to be NULL if the glyph is not present
page->setGlyphDataForIndex(i, 0, 0);