TTF: avoid crashes on fonts without U+0041 LATIN CAPITAL LETTER A.

Since font sizes in SolveSpace are specified in terms of cap height,
we need U+0041 to determine cap height. Some fonts lack it; in
that case, we assume that cap height is the same as the size we've
requested. This avoids a crash, at the cost of completely wrong
(although consistent) metrics; I do not really know of a better way.
pull/252/head
whitequark 2017-04-26 23:06:50 +00:00
parent 5078907957
commit 280d5b902f
1 changed files with 2 additions and 1 deletions

View File

@ -189,7 +189,8 @@ bool TtfFont::LoadFromFile(FT_Library fontLibrary, bool nameOnly) {
if (gid == 0) {
dbp("freetype: CID-to-GID mapping for CID 0x%04x failed: %s; using CID as GID",
chr, ft_error_string(gid));
gid = chr;
dbp("Assuming cap height is the same as requested height (this is likely wrong).");
capHeight = (double)sizeRequest.height;
}
if(gid) {