Implement containsCharacters method on Win32 for determining if a fallback font has...
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 May 2006 23:18:06 +0000 (23:18 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 25 May 2006 23:18:06 +0000 (23:18 +0000)
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@14600 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/win/FontDataWin.cpp

index ed42f2ddc3d9615b3df5cfde8e43a72fed5ee15e..d40e05a12661877e2e20053a22398d2343f7ae8a 100644 (file)
@@ -1,3 +1,12 @@
+2006-05-25  Dave Hyatt <hyatt@apple.com>
+
+        Implement the fallback method containsCharacters for
+        checking if a font has the necessary glyphs to be
+        selected as a fallback choide.
+
+        * platform/win/FontDataWin.cpp:
+        (WebCore::FontData::containsCharacters):
+
 2006-05-25  Dave Hyatt <hyatt@apple.com>
 
         For now eliminate the logical scale factor from Cairo.
index cdbc6bce08debd80e6a142fd908ac422631eb2a4..f0bb7ec0085e71adbd43f1a0da25c821ca538d92 100755 (executable)
@@ -109,9 +109,25 @@ FontData* FontData::smallCapsFontData(const FontDescription& fontDescription) co
 
 bool FontData::containsCharacters(const UChar* characters, int length) const
 {
-    // FIXME: Need to check character ranges.
-    // IMLangFontLink2::GetFontUnicodeRanges does what we want. 
-    return false;
+    HDC dc = GetDC(0);
+    SaveDC(dc);
+    SelectObject(dc, m_font.hfont());
+
+    WORD* glyphBuffer = new WORD[length];
+    GetGlyphIndices(dc, characters, length, glyphBuffer, GGI_MARK_NONEXISTING_GLYPHS);
+    
+    RestoreDC(dc, -1);
+    ReleaseDC(0, dc);
+
+    for (unsigned i = 0; i < length; i++) {
+        if (glyphBuffer[i] == 0xFFFFFFFF) {
+            delete []glyphBuffer;
+            return false;
+        }
+    }
+
+    delete []glyphBuffer;
+    return true;
 }
 
 void FontData::determinePitch()