diff options
Diffstat (limited to 'Source')
3 files changed, 16 insertions, 2 deletions
diff --git a/Source/WebCore/platform/graphics/android/fonts/FontAndroid.cpp b/Source/WebCore/platform/graphics/android/fonts/FontAndroid.cpp index e26fa9e..7bed5bb 100644 --- a/Source/WebCore/platform/graphics/android/fonts/FontAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/fonts/FontAndroid.cpp @@ -63,6 +63,7 @@ using namespace android; namespace WebCore { typedef std::pair<int, float> FallbackFontKey; + typedef HashMap<FallbackFontKey, FontPlatformData*> FallbackHash; static void updateForFont(SkPaint* paint, const SimpleFontData* font) { @@ -696,7 +697,17 @@ const FontPlatformData* TextRunWalker::setupComplexFont( { static FallbackHash fallbackPlatformData; - FallbackFontKey key(script, platformData.size()); + // generate scriptStyleIndex - we need unique hash IDs for each style + // of each script - normal, bold, italic, bolditalic. the first set of + // NUM_SCRIPTS are the normal style version, followed by bold, then + // italic, then bold italic. additional fake style bits can be added. + int scriptStyleIndex = script; + if (platformData.isFakeBold()) + scriptStyleIndex += NUM_SCRIPTS; + if (platformData.isFakeItalic()) + scriptStyleIndex += NUM_SCRIPTS << 1; + + FallbackFontKey key(scriptStyleIndex, platformData.size()); FontPlatformData* newPlatformData = 0; if (!fallbackPlatformData.contains(key)) { diff --git a/Source/WebCore/platform/graphics/android/fonts/FontCacheAndroid.cpp b/Source/WebCore/platform/graphics/android/fonts/FontCacheAndroid.cpp index 5696a46..4bb388c 100644 --- a/Source/WebCore/platform/graphics/android/fonts/FontCacheAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/fonts/FontCacheAndroid.cpp @@ -175,7 +175,7 @@ FontPlatformData* FontCache::createFontPlatformData(const FontDescription& fontD } result = new FontPlatformData(tf, fontDescription.computedSize(), - (style & SkTypeface::kBold) && !tf->isBold(), + (style & SkTypeface::kBold), (style & SkTypeface::kItalic) && !tf->isItalic(), fontDescription.orientation(), fontDescription.textOrientation()); diff --git a/Source/WebCore/platform/graphics/android/fonts/FontPlatformData.h b/Source/WebCore/platform/graphics/android/fonts/FontPlatformData.h index 1e46971..02a0cea 100644 --- a/Source/WebCore/platform/graphics/android/fonts/FontPlatformData.h +++ b/Source/WebCore/platform/graphics/android/fonts/FontPlatformData.h @@ -92,6 +92,9 @@ public: HB_FaceRec_* harfbuzzFace() const; SkTypeface* typeface() const { return mTypeface; } + bool isFakeBold() const { return mFakeBold; } + bool isFakeItalic() const { return mFakeItalic; } + private: class RefCountedHarfbuzzFace : public RefCounted<RefCountedHarfbuzzFace> { public: |