I asked the Kimi AI how to further improve GSHorizontalTypesetter. Here is what it came up with:
https://www.kimi.com/share/19d34cdb-8242-8fc9-8000-00001fd46e3b
Handle Missing Fonts Gracefully
// CURRENT: No check if currentFont is nil
lineHeight = [glyphCache->font defaultLineHeightForFont];
// PROPOSED:
if (!glyphCache->font) {
// Use system default font as fallback
currentFont = [NSFont systemFontOfSize: 12.0];
// Log warning in debug builds
NSDebugLLog(@"GSHorizontalTypesetter", @"Missing font at glyph %u, using system default", cacheBase);
}
I asked the Kimi AI how to further improve GSHorizontalTypesetter. Here is what it came up with:
https://www.kimi.com/share/19d34cdb-8242-8fc9-8000-00001fd46e3b
Handle Missing Fonts Gracefully