Skip to content

GSHorizontalTypesetter improvements: Fix the CJK Character Range Check #406

@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

Fix the CJK Character Range Check

The current CJK range check uses 0x2ff0 to 0x9fff, but this is incorrect. The proper unified CJK range is 0x4E00 to 0x9FFF (CJK Unified Ideographs). The current range includes Kangxi Radicals (0x2F00-0x2FDF) and Ideographic Description Characters (0x2FF0-0x2FFF), but misses many CJK blocks and includes non-CJK areas.

// CURRENT (incorrect):
else if ((character > 0x2ff0) && (character < 0x9fff))

// PROPOSED (comprehensive CJK support):
else if ((character >= 0x4E00 && character <= 0x9FFF) ||      // CJK Unified Ideographs
         (character >= 0x3400 && character <= 0x4DBF) ||      // CJK Extension A
         (character >= 0xAC00 && character <= 0xD7AF) ||      // Hangul Syllables
         (character >= 0x3040 && character <= 0x309F) ||      // Hiragana
         (character >= 0x30A0 && character <= 0x30FF) ||      // Katakana
         (character >= 0xFF65 && character <= 0xFF9F))       // Halfwidth Katakana

I cross checked the ranges proposed by Kimi with https://jrgraphix.net/research/unicode_blocks.php and all the ranges seem to be correct. However, I don't know if Kimi missed some ranges.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions