diff options
author | Victoria Lease <violets@google.com> | 2012-06-05 16:54:30 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2012-06-05 16:54:30 -0700 |
commit | 4b5d0dacf1013fafb9ac82ff5f76f2faa93d3461 (patch) | |
tree | 5b05c8b52bfc212e95a7c0dadafbe6b3400eb350 /Source | |
parent | 185bce43e5c10ce535c5397a0282770f6ad694cf (diff) | |
parent | 3b9c97dddec1d7be0c22d97cf2bcd224e2c4f23e (diff) | |
download | external_webkit-4b5d0dacf1013fafb9ac82ff5f76f2faa93d3461.zip external_webkit-4b5d0dacf1013fafb9ac82ff5f76f2faa93d3461.tar.gz external_webkit-4b5d0dacf1013fafb9ac82ff5f76f2faa93d3461.tar.bz2 |
am 3b9c97dd: am 7da43ef8: Merge "Fix fake bold for fallback fonts." into jb-dev
* commit '3b9c97dddec1d7be0c22d97cf2bcd224e2c4f23e':
Fix fake bold for fallback fonts.
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: |