+2009-06-25 Adam Langley <agl@google.com>
+
+ Reviewed by Darin Fisher.
+
+ https://bugs.webkit.org/show_bug.cgi?id=26529
+
+ This is hopefully the last step before our renderers can run
+ cleanly in a chroot.
+
+ WebKit needs to be able to ask for the correct font to use in
+ the case that the current font doesn't include glyphs for
+ certain code points. Currently we make a fontconfig call in our
+ WebKit port to handle this.
+
+ This patch changes this so that the call is sent our via
+ ChromiumBridge.
+
+ http://codereview.chromium.org/132007
+
+ This should not affect any layout tests.
+
+ * platform/chromium/ChromiumBridge.h:
+ * platform/graphics/chromium/FontCacheLinux.cpp:
+ (WebCore::FontCache::getFontDataForCharacters):
+
2009-06-25 Albert J. Wong <ajwong@chromium.org>
Reviewed by David Levin.
#include "config.h"
#include "FontCache.h"
-#include <fontconfig/fontconfig.h>
-
#include "AtomicString.h"
+#include "ChromiumBridge.h"
#include "CString.h"
#include "Font.h"
#include "FontDescription.h"
const UChar* characters,
int length)
{
- FcCharSet* cset = FcCharSetCreate();
- for (int i = 0; i < length; ) {
- UChar32 ucs4 = 0;
- U16_NEXT(characters, i, length, ucs4);
- FcCharSetAddChar(cset, ucs4);
- }
-
- FcPattern* pattern = FcPatternCreate();
-
- FcValue fcvalue;
- fcvalue.type = FcTypeCharSet;
- fcvalue.u.c = cset;
- FcPatternAdd(pattern, FC_CHARSET, fcvalue, 0);
-
- FcConfigSubstitute(0, pattern, FcMatchPattern);
- FcDefaultSubstitute(pattern);
-
- FcResult result;
- FcPattern* match = FcFontMatch(0, pattern, &result);
- FcPatternDestroy(pattern);
-
- SimpleFontData* ret = 0;
-
- if (match) {
- FcChar8* family;
- if (FcPatternGetString(match, FC_FAMILY, 0, &family) == FcResultMatch) {
- AtomicString fontFamily(reinterpret_cast<char*>(family));
- ret = getCachedFontData(getCachedFontPlatformData(font.fontDescription(), fontFamily, false));
- }
- FcPatternDestroy(match);
- }
-
- FcCharSetDestroy(cset);
+ String family = ChromiumBridge::getFontFamilyForCharacters(characters, length);
+ if (family.isEmpty())
+ return 0;
- return ret;
+ AtomicString atomicFamily(family);
+ return getCachedFontData(getCachedFontPlatformData(font.fontDescription(), atomicFamily, false));
}
FontPlatformData* FontCache::getSimilarFontPlatformData(const Font& font)