Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenfont/intern/blf_thumbs.c
| Show First 20 Lines • Show All 92 Lines • ▼ Show 20 Lines | |||||
| return U"\xE000\xFFFF"; | return U"\xE000\xFFFF"; | ||||
| } | } | ||||
| int language_count = count_bits_i((uint)os2_table->ulUnicodeRange1) + | int language_count = count_bits_i((uint)os2_table->ulUnicodeRange1) + | ||||
| count_bits_i((uint)os2_table->ulUnicodeRange2) + | count_bits_i((uint)os2_table->ulUnicodeRange2) + | ||||
| count_bits_i((uint)os2_table->ulUnicodeRange3) + | count_bits_i((uint)os2_table->ulUnicodeRange3) + | ||||
| count_bits_i((uint)os2_table->ulUnicodeRange4); | count_bits_i((uint)os2_table->ulUnicodeRange4); | ||||
| /* Use OS/2 Table code page range bits to differentiate between (combined) CJK fonts. | |||||
| * See https://learn.microsoft.com/en-us/typography/opentype/spec/os2#cpr */ | |||||
| FT_ULong codepages = os2_table->ulCodePageRange1; | |||||
| if (codepages & (1 << 19) || codepages & (1 << 21)) { | |||||
| return U"\ud55c\uad6d\uc5b4"; /* 한국어 Korean. */ | |||||
| } | |||||
| if (codepages & (1 << 20)) { | |||||
| return U"\u7E41\u9AD4\u5B57"; /* 繁體字 Traditional Chinese. */ | |||||
| } | |||||
| if (codepages & (1 << 17) && !(codepages & (1 << 18))) { | |||||
| return U"\u65E5\u672C\u8A9E"; /* 日本語 Japanese. */ | |||||
| } | |||||
| if (codepages & (1 << 18) && !(codepages & (1 << 17))) { | |||||
| return U"\u7B80\u4F53\u5B57"; /* 简体字 Simplified Chinese. */ | |||||
| } | |||||
| for (uint i = 0; i < ARRAY_SIZE(unicode_samples); ++i) { | for (uint i = 0; i < ARRAY_SIZE(unicode_samples); ++i) { | ||||
| const UnicodeSample *s = &unicode_samples[i]; | const UnicodeSample *s = &unicode_samples[i]; | ||||
| if (os2_table && s->field && s->mask) { | if (os2_table && s->field && s->mask) { | ||||
| /* OS/2 Table contains 4 contiguous integers of script coverage bit flags. */ | /* OS/2 Table contains 4 contiguous integers of script coverage bit flags. */ | ||||
| const FT_ULong *unicode_range = &os2_table->ulUnicodeRange1; | const FT_ULong *unicode_range = &os2_table->ulUnicodeRange1; | ||||
| const int index = (s->field - 1); | const int index = (s->field - 1); | ||||
| BLI_assert(index < 4); | BLI_assert(index < 4); | ||||
| if (!(unicode_range[index] & s->mask)) { | if (!(unicode_range[index] & s->mask)) { | ||||
| ▲ Show 20 Lines • Show All 92 Lines • Show Last 20 Lines | |||||