diff options
author | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-07-22 19:52:11 +0000 |
---|---|---|
committer | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-07-22 19:52:11 +0000 |
commit | 36a4c2aa2dc2363dc093089b732346459ddc3b65 (patch) | |
tree | c1b1a899f1e696fdcfad31f00521a4eee5a91961 /src/ports | |
parent | f549369fcd9f203dc8020b5b15ee49330058782a (diff) |
Add SkFontHost::FilterRect() which allows the font host to filter our request
before we turn it into a font-cache entry, for the cases where the scaler will
ignore and/or collapse certain feature requests (e.g. doesn't support all levels
of hinting)
git-svn-id: http://skia.googlecode.com/svn/trunk@283 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/ports')
-rw-r--r-- | src/ports/SkFontHost_FreeType.cpp | 8 | ||||
-rwxr-xr-x | src/ports/SkFontHost_mac.cpp | 16 |
2 files changed, 24 insertions, 0 deletions
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp index fa10362d4e..b350202d6b 100644 --- a/src/ports/SkFontHost_FreeType.cpp +++ b/src/ports/SkFontHost_FreeType.cpp @@ -262,6 +262,14 @@ static void unref_ft_face(FT_Face face) { /////////////////////////////////////////////////////////////////////////// +void SkFontHost::FilterRec(SkScalerContext::Rec* rec) { + // collapse full->normaling hinting if we're not doing LCD + SkPaint::Hinting h = rec->getHinting(); + if (SkPaint::kFull_Hinting == h && !rec->isLCD()) { + rec->setHinting(SkPaint::kNormal_Hinting); + } +} + SkScalerContext_FreeType::SkScalerContext_FreeType(const SkDescriptor* desc) : SkScalerContext(desc) { SkAutoMutexAcquire ac(gFTMutex); diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp index c807be74b9..aac0034083 100755 --- a/src/ports/SkFontHost_mac.cpp +++ b/src/ports/SkFontHost_mac.cpp @@ -106,6 +106,22 @@ private: static OSStatus Close(void *cb); }; +void SkFontHost::FilterRec(SkScalerContext::Rec* rec) { + // we only support 2 levels of hinting + SkPaint::Hinting h = rec->getHinting(); + if (SkPaint::kSlight_Hinting == h) { + h = SkPaint::kNo_Hinting; + } else if (SkPaint::kFull_Hinting == h) { + h = SkPaint::kNormal_Hinting; + } + rec->setHinting(h); + + // we don't support LCD text + if (SkMask::FormatIsLCD((SkMask::Format)rec->fMaskFormat)) { + rec->fMaskFormat = SkMask::kA8_Format; + } +} + SkScalerContext_Mac::SkScalerContext_Mac(const SkDescriptor* desc) : SkScalerContext(desc), fLayout(0), fStyle(0) { |