On Sat Dec 21 22:36:08 2024 +0000, Nikolay Sivov wrote:
Handling this as a special case is most likely wrong, but if it works for now so be it. Regarding approach in general, yes, it seems preferable to use same font when it works, so sequences like "<latin1><japanese><latin2>" wouldn't use Japanese font for <latin2> range. I can only say that in directwrite it's handled differently - fallback is not going to be applied for all three ranges at once from this example, it will be applied per-range. Chromium layout does this differently, by nesting fallbacks to get more consistent output. I don't know what gdi+ is doing, but if you've tested this, it's good enough I think.
The special case makes sense to me only because those characters are also handled in the actual drawing routine as a special case.
I have no idea how native does it (I can't think of any good way to test what fonts it's actually using), and no particular reason to believe it resembles this (other than knowing that the times it broke, it's been using fallbacks when it doesn't need to). I don't think native GDI+ does anything nearly as complex as dwrite, but that doesn't mean this way makes sense.
Can you explain what you mean by per-range?