Skip to content

GSHorizontalTypesetter improvements: Handle Missing Fonts Gracefully #412

@IOOI-SqAR

Description

@IOOI-SqAR

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);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions