Werner Lemberg pushed to branch master at FreeType / FreeType Demo Programs
Commits:
-
9f3ae579
by Werner Lemberg at 2023-01-03T09:30:25+01:00
1 changed file:
Changes:
... | ... | @@ -1186,9 +1186,14 @@ |
1186 | 1186 | strbuf_value( buf ), display->fore_color );
|
1187 | 1187 | |
1188 | 1188 | /* ppem, pt and dpi, instance */
|
1189 | - ppem = FT_IS_SCALABLE( face ) ? FT_MulFix( face->units_per_EM,
|
|
1190 | - face->size->metrics.y_scale )
|
|
1191 | - : face->size->metrics.y_ppem * 64;
|
|
1189 | + if ( face->size )
|
|
1190 | + {
|
|
1191 | + ppem = FT_IS_SCALABLE( face )
|
|
1192 | + ? FT_MulFix( face->units_per_EM, face->size->metrics.y_scale )
|
|
1193 | + : face->size->metrics.y_ppem * 64;
|
|
1194 | + }
|
|
1195 | + else
|
|
1196 | + ppem = 0;
|
|
1192 | 1197 | |
1193 | 1198 | strbuf_reset( buf );
|
1194 | 1199 | if ( res == 72 )
|
... | ... | @@ -1205,8 +1210,13 @@ |
1205 | 1210 | grWriteCellString( display->bitmap, 0, line * HEADER_HEIGHT,
|
1206 | 1211 | strbuf_value( buf ), display->fore_color );
|
1207 | 1212 | |
1208 | - if ( abs( ptsize * res / 64 - face->size->metrics.y_ppem * 72 ) > 36 ||
|
|
1209 | - error_code )
|
|
1213 | + /* The demo programs are mainly investigation tools. Normal */
|
|
1214 | + /* applications don't need all the extra validity checks to display */
|
|
1215 | + /* something for invalid fonts; instead, they can simply reject them. */
|
|
1216 | + if ( ( face->size &&
|
|
1217 | + abs( ptsize * res / 64
|
|
1218 | + - face->size->metrics.y_ppem * 72 ) > 36 ) ||
|
|
1219 | + error_code )
|
|
1210 | 1220 | {
|
1211 | 1221 | strbuf_reset( buf );
|
1212 | 1222 |