-
-
Notifications
You must be signed in to change notification settings - Fork 8
Description
For Tiny Life, I based this on https://github.com/roddyrap/NetBidi which seems to be the best bidi-specific library that doesn't require any native bindings.
A non-dependency-specific way to make GenericFont (and, by extension, TextFormatter) bidi-compliant would be to add a virtual ReorderText (name not final) method to GenericFont that is both called in its own DrawString methods, as well as in relevant places in TextFormatter (since caching the reorders as part of TokenizedString would be worthwhile for sure). People who want bidi support could then override this method to add a call to something like NetBidi to it.
Maybe we don't need GenericFont support for bidi though, since some other "more advanced" types of formatting (like text alignment) are also limited to just the TextFormatter. Bidi would be easier to implement caching-forward anyway.
For making text inputs & fields bidi-compliant, we'd have to also invert the way that the controls work and, importantly, not store text as reordered, but just display it as reordered (due to selection, navigation & copy-pasting considerations, see official unicode reasoning for the store/display order difference).