summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2014-07-07 14:59:04 -0700
committerRaph Levien <raph@google.com>2014-07-09 09:18:15 -0700
commit156acb18f53b32655abb34166ea737e4320ca366 (patch)
tree06010bd2aa363e02890064405c4a8a070a387fe3
parentf8134eff0007533f213925d3e8e37d213b3afdee (diff)
downloadandroid_frameworks_minikin-156acb18f53b32655abb34166ea737e4320ca366.tar.gz
android_frameworks_minikin-156acb18f53b32655abb34166ea737e4320ca366.tar.bz2
android_frameworks_minikin-156acb18f53b32655abb34166ea737e4320ca366.zip
Assign non-coverage font runs to base font
When a run has no cmap coverage in any font, use the base font. Most of the time, this will cause rendering of the .notdef glyph, which is preferable to displaying nothing. In some cases, Harfbuzz may be able to decompose the characters (not in the cmap) to ones that are, in which case we'll render those, as long as they're in the base font. Bug: 6629748 Bug: 15816880 Change-Id: Ibb1b9242c83626e0c7db363ad65ce44a967a005e
-rw-r--r--libs/minikin/FontCollection.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/libs/minikin/FontCollection.cpp b/libs/minikin/FontCollection.cpp
index 348c5dc..a6977fd 100644
--- a/libs/minikin/FontCollection.cpp
+++ b/libs/minikin/FontCollection.cpp
@@ -48,9 +48,6 @@ FontCollection::FontCollection(const vector<FontFamily*>& typefaces) :
FontFamily* family = typefaces[i];
MinikinFont* typeface = family->getClosestMatch(defaultStyle).font;
if (typeface == NULL) {
- ALOGE("FontCollection: closest match was null");
- // TODO: we shouldn't hit this, as there should be more robust
- // checks upstream to prevent empty/invalid FontFamily objects
continue;
}
family->RefLocked();
@@ -76,6 +73,8 @@ FontCollection::FontCollection(const vector<FontFamily*>& typefaces) :
lastChar.push_back(instance->mCoverage->nextSetBit(0));
}
nTypefaces = mInstances.size();
+ LOG_ALWAYS_FATAL_IF(nTypefaces == 0,
+ "Font collection must have at least one valid typeface");
size_t nPages = (mMaxChar + kPageMask) >> kLogCharsPerPage;
size_t offset = 0;
for (size_t i = 0; i < nPages; i++) {
@@ -144,6 +143,9 @@ const FontCollection::FontInstance* FontCollection::getInstanceForChar(uint32_t
}
}
}
+ if (bestInstance == NULL) {
+ bestInstance = &mInstances[0];
+ }
return bestInstance;
}