Fix native crash in Latin-1 typefaces

This is a fix for bug 15171911 Timely crashes (native crash in
libminikin) when I go to add a new alarm

This patch fixes an off-by-one error that caused typefaces with only one
page of Unicode coverage (ASCII or Latin-1) to have nPages = 0 instead
of the correct value of 1 in the corresponding FontCollection.

Change-Id: Id8be0c9e5713b8af22d863992921ee6382416a34
This commit is contained in:
Raph Levien 2014-05-23 22:44:35 -07:00
parent 4cfcd71064
commit b1f16e880b

View File

@ -66,7 +66,7 @@ FontCollection::FontCollection(const vector<FontFamily*>& typefaces) :
mMaxChar = max(mMaxChar, instance->mCoverage->length());
lastChar.push_back(instance->mCoverage->nextSetBit(0));
}
size_t nPages = mMaxChar >> kLogCharsPerPage;
size_t nPages = (mMaxChar + kPageMask) >> kLogCharsPerPage;
size_t offset = 0;
for (size_t i = 0; i < nPages; i++) {
Range dummy;