summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2014-06-12 09:19:03 -0700
committerRaph Levien <raph@google.com>2014-06-12 16:29:24 +0000
commite68467e971390f0c79992cd938a870093a3d6412 (patch)
tree677223adb1ba514a75e0490c1fc3cbcf8a29ec8a
parent1565169734dbed6d59cc10f2a7de01f8601533e0 (diff)
downloadandroid_frameworks_minikin-e68467e971390f0c79992cd938a870093a3d6412.tar.gz
android_frameworks_minikin-e68467e971390f0c79992cd938a870093a3d6412.tar.bz2
android_frameworks_minikin-e68467e971390f0c79992cd938a870093a3d6412.zip
Tighten requirements for fake bold
The simple predicate for fake bold (2 or more grades darker than requested) was applying it to thin (100 weight) when normal was requested. This patch tightens the predicate to also require that the requested weight be in the bold range. Fix for bug 15588352 "sans-serif-thin doesn't work on lockscreen" Change-Id: Id9988bd149a9c8a7c943e3b221f7fb4b37fb6ddb (cherry picked from commit 9f9f3b1ef40f7358dca6acd9dfef686cedefb6aa)
-rw-r--r--libs/minikin/FontFamily.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/libs/minikin/FontFamily.cpp b/libs/minikin/FontFamily.cpp
index 9106f63..ad8120f 100644
--- a/libs/minikin/FontFamily.cpp
+++ b/libs/minikin/FontFamily.cpp
@@ -119,9 +119,11 @@ static int computeMatch(FontStyle style1, FontStyle style2) {
}
static FontFakery computeFakery(FontStyle wanted, FontStyle actual) {
- // If desired weight is 2 or more grades higher than actual
- // (for example, medium 500 -> bold 700), then select fake bold.
- bool isFakeBold = (wanted.getWeight() - actual.getWeight()) >= 2;
+ // If desired weight is bold or darker, and 2 or more grades higher
+ // than actual (for example, medium 500 -> bold 700), then select
+ // fake bold.
+ int wantedWeight = wanted.getWeight();
+ bool isFakeBold = wantedWeight >= 7 && (wantedWeight - actual.getWeight()) >= 2;
bool isFakeItalic = wanted.getItalic() && !actual.getItalic();
return FontFakery(isFakeBold, isFakeItalic);
}