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
parent
5078907957
commit
280d5b902f
|
@ -189,7 +189,8 @@ bool TtfFont::LoadFromFile(FT_Library fontLibrary, bool nameOnly) {
|
||||||
if (gid == 0) {
|
if (gid == 0) {
|
||||||
dbp("freetype: CID-to-GID mapping for CID 0x%04x failed: %s; using CID as GID",
|
dbp("freetype: CID-to-GID mapping for CID 0x%04x failed: %s; using CID as GID",
|
||||||
chr, ft_error_string(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) {
|
if(gid) {
|
||||||
|
|
Loading…
Reference in New Issue