summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/chromium/FontCacheAndroid.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/platform/graphics/chromium/FontCacheAndroid.cpp')
-rw-r--r--Source/WebCore/platform/graphics/chromium/FontCacheAndroid.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/Source/WebCore/platform/graphics/chromium/FontCacheAndroid.cpp b/Source/WebCore/platform/graphics/chromium/FontCacheAndroid.cpp
index 01d08645a..eba224a83 100644
--- a/Source/WebCore/platform/graphics/chromium/FontCacheAndroid.cpp
+++ b/Source/WebCore/platform/graphics/chromium/FontCacheAndroid.cpp
@@ -97,20 +97,30 @@ void FontCache::platformInit()
{
}
-const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length)
+PassRefPtr<SimpleFontData> FontCache::getFontDataForCharacters(const Font& font, const UChar* characters, int length)
{
- // FIXME: We do not use fontconfig on Android, so use simple logic for now.
- // https://bugs.webkit.org/show_bug.cgi?id=67587
- AtomicString atomicFamily("Arial");
- return getCachedFontData(getCachedFontPlatformData(font.fontDescription(), atomicFamily, DoNotRetain), DoNotRetain);
+ if (!length)
+ return 0;
+
+ SkUnichar skiaChar;
+ if (U16_IS_LEAD(characters[0])) {
+ ASSERT(length >= 2);
+ skiaChar = U16_GET_SUPPLEMENTARY(characters[0], characters[1]);
+ } else
+ skiaChar = characters[0];
+
+ SkString skiaFamilyName;
+ if (!SkGetFallbackFamilyNameForChar(skiaChar, &skiaFamilyName) || skiaFamilyName.isEmpty())
+ return 0;
+ return getCachedFontData(getCachedFontPlatformData(font.fontDescription(), AtomicString(skiaFamilyName.c_str()), DoNotRetain), DoNotRetain);
}
-SimpleFontData* FontCache::getSimilarFontPlatformData(const Font& font)
+PassRefPtr<SimpleFontData> FontCache::getSimilarFontPlatformData(const Font& font)
{
return 0;
}
-SimpleFontData* FontCache::getLastResortFallbackFont(const FontDescription& description, ShouldRetain shouldRetain)
+PassRefPtr<SimpleFontData> FontCache::getLastResortFallbackFont(const FontDescription& description, ShouldRetain shouldRetain)
{
DEFINE_STATIC_LOCAL(const AtomicString, serif, ("Serif"));
DEFINE_STATIC_LOCAL(const AtomicString, monospace, ("Monospace"));