summaryrefslogtreecommitdiffstats
path: root/include/minikin/FontFamily.h
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2014-06-06 17:56:41 -0700
committerRaph Levien <raph@google.com>2014-06-10 11:59:29 -0700
commit9a5f713add8cfb91ac2c9ed5c917309053201ab6 (patch)
tree7d6be261f3a7d30b0d7f14a66b2ff5e290e1bc4f /include/minikin/FontFamily.h
parent89566f0ada1cafe673efa064cde38467990235d4 (diff)
downloadandroid_frameworks_minikin-9a5f713add8cfb91ac2c9ed5c917309053201ab6.tar.gz
android_frameworks_minikin-9a5f713add8cfb91ac2c9ed5c917309053201ab6.tar.bz2
android_frameworks_minikin-9a5f713add8cfb91ac2c9ed5c917309053201ab6.zip
Support for fake bold and italics
This patch adds support for computing when fake bold and fake italics are needed (because the styles are requested but not provided by the matching FontFamily), and providing them as part of the layout result. Part of the fix for bug 15436379 Fake bold doesn't fully work (Minikin) Change-Id: I180c034b559837943673b5c272c8e890178dff0d
Diffstat (limited to 'include/minikin/FontFamily.h')
-rw-r--r--include/minikin/FontFamily.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/include/minikin/FontFamily.h b/include/minikin/FontFamily.h
index 6bdf5d6..060d167 100644
--- a/include/minikin/FontFamily.h
+++ b/include/minikin/FontFamily.h
@@ -94,6 +94,25 @@ inline hash_t hash_type(const FontStyle &style) {
return style.hash();
}
+// attributes representing transforms (fake bold, fake italic) to match styles
+class FontFakery {
+public:
+ FontFakery() : mFakeBold(false), mFakeItalic(false) { }
+ FontFakery(bool fakeBold, bool fakeItalic) : mFakeBold(fakeBold), mFakeItalic(fakeItalic) { }
+ // TODO: want to support graded fake bolding
+ bool isFakeBold() { return mFakeBold; }
+ bool isFakeItalic() { return mFakeItalic; }
+private:
+ bool mFakeBold;
+ bool mFakeItalic;
+};
+
+struct FakedFont {
+ // ownership is the enclosing FontCollection
+ MinikinFont* font;
+ FontFakery fakery;
+};
+
class FontFamily : public MinikinRefCounted {
public:
FontFamily() { }
@@ -107,7 +126,7 @@ public:
bool addFont(MinikinFont* typeface);
void addFont(MinikinFont* typeface, FontStyle style);
- MinikinFont* getClosestMatch(FontStyle style) const;
+ FakedFont getClosestMatch(FontStyle style) const;
FontLanguage lang() const { return mLang; }
int variant() const { return mVariant; }