diff options
author | Billy Hewlett <billyh@google.com> | 2012-06-21 09:58:17 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-06-21 09:58:17 -0700 |
commit | 212ef7a5d592a11522f73d858bf98f5201631b70 (patch) | |
tree | 5b6eb6755286f93262832dfa701b53594c89ef84 /src/core | |
parent | 81957ccb58db76c172e195dc3e31eba85d3e4ac9 (diff) | |
download | external_skia-212ef7a5d592a11522f73d858bf98f5201631b70.zip external_skia-212ef7a5d592a11522f73d858bf98f5201631b70.tar.gz external_skia-212ef7a5d592a11522f73d858bf98f5201631b70.tar.bz2 |
Revert "Revert "Use Elegant fonts for Webkit, Compact fonts for Textview""
This reverts commit 81957ccb58db76c172e195dc3e31eba85d3e4ac9
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkPaint.cpp | 16 | ||||
-rw-r--r-- | src/core/SkScalerContext.cpp | 8 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index e1932a7..412ab2b 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -72,6 +72,7 @@ SkPaint::SkPaint() { fHinting = SkPaintDefaults_Hinting; #ifdef SK_BUILD_FOR_ANDROID new(&fTextLocale) SkString(); + fFontVariant = kDefault_Variant; fGenerationID = 0; #endif } @@ -372,6 +373,18 @@ void SkPaint::setTextLocale(const SkString& locale) { GEN_ID_INC; } } + +void SkPaint::setFontVariant(FontVariant fontVariant) { + if ((unsigned)fontVariant <= kLast_Variant) { + GEN_ID_INC_EVAL((unsigned)fontVariant != fFontVariant); + fFontVariant = fontVariant; + } else { +#ifdef SK_REPORT_API_RANGE_CHECK + SkDebugf("SkPaint::setFontVariant(%d) out of range\n", fontVariant); +#endif + } +} + #endif /////////////////////////////////////////////////////////////////////////////// @@ -1561,6 +1574,9 @@ void SkScalerContext::MakeRec(const SkPaint& paint, #else rec->setLuminanceBits(computeLuminance(paint)); #endif +#ifdef SK_BUILD_FOR_ANDROID + rec->fFontVariant = paint.getFontVariant(); +#endif //SK_BUILD_FOR_ANDROID /* Allow the fonthost to modify our rec before we use it as a key into the cache. This way if we're asking for something that they will ignore, diff --git a/src/core/SkScalerContext.cpp b/src/core/SkScalerContext.cpp index 2921b1e..e33ad7a 100644 --- a/src/core/SkScalerContext.cpp +++ b/src/core/SkScalerContext.cpp @@ -118,7 +118,13 @@ static SkScalerContext* allocNextContext(const SkScalerContext::Rec& rec) { // fonthost will determine the next possible font to search, based // on the current font in fRec. It will return NULL if ctx is our // last font that can be searched (i.e. ultimate fallback font) - uint32_t newFontID = SkFontHost::NextLogicalFont(rec.fFontID, rec.fOrigFontID); +#ifdef SK_BUILD_FOR_ANDROID + // On Android, pass entire rec structure so that clients can change fallback behavior + uint32_t newFontID = SkFontHost::NextLogicalFont(rec); +#else + uint32_t newFontID = SkFontHost::NextLogicalFont(rec.fFontID, rec.fOrigFontID); +#endif + if (0 == newFontID) { return NULL; } |