-
Notifications
You must be signed in to change notification settings - Fork 87
Description
Is there any example on how to best split a string into different WritingSystems aka ScriptRuns ?
E.g. I have this string Hello World Привет мир مرحبا بالعالم 你好世界
and I want to have it separated by font support.
So if font file 1 supports Latin, font file 2 supports Cyrillic, font file 3 supports Arabic, font file 4 supports Chinese,
e.g. more or less exactly as with the Google Noto fonts, the ScriptRuns would be:
Hello World
Привет мир
مرحبا بالعالم
你好世界
I want to split the string into its font-file parts, so I can draw a multi-language string with SkiaSharp:
For that, I'd like to create a list of Tuples, with the string-part, and the typeface-instance.
So far, I can take each word and figure out the font file by checking if each glyph is in the font file.
Is there no better way, such as reading the codepoint-range/ranges from the font file, and checking if character x is in said range ?
I've seen code in Typography.TextBreak -> ScriptTagsAndLanguageSystemTags ->UnicodeRangeFinder -> GetUniCodeRangeFor that goes into that direction. but it doesn't read any font file, it just checks the range of the codepoint.