EMI

EMI

1M Downloads

[Bug] [1.20.1] Incompatible with ModernUI (Fabric)

BloCamLimb opened this issue ยท 5 comments

commented

EMI calls fonts too early causing crashes during loading.

Solution

Delay font related operations until after client is loaded.

Crash-report

error (1).txt

Mod list:

c2me-fabric-mc1.20.1-0.2.0+alpha.10.98.jar
cloth-config-11.1.106-fabric.jar
dynamic-fps-2.4.0.jar
emi-1.0.19+1.20.1+fabric.jar
entityculling-fabric-1.6.2-mc1.20.jar
ForgeConfigAPIPort-v8.0.0-1.20.1-Fabric.jar
ImmediatelyFast-1.1.27+1.20.1.jar
lazydfu-0.1.3.jar
lithium-fabric-mc1.20.1-0.11.2.jar
ModernUI-Fabric-1.20.1-3.8.1.5-universal.jar
modmenu-7.2.1.jar
player-animation-lib-fabric-1.0.2-rc1+1.20.jar
sodium-fabric-mc1.20.1-0.5.2.jar
starlight-1.1.2+fabric.dbc156f.jar

commented

EMI has a completely custom usage of this class that does not necessitate fonts being loaded and is used early for writing config, so it is necessary. It works reasonably under vanilla assumptions about these classes and would require significant rewriting to support another mod when it can be doing the checking itself.

commented

Since you don't need to access font resources, why don't you use BreakIterator to wrap lines?

commented

Because the function of the vanilla TextHandler exists to do that simply and natively handles wrapping lines to a value particular size? In vanilla, TextHandler is well encapsulated and just wraps lines based on a WidthRetriever, with reasonable OOP principles.

commented

StringSplitter does not really take into account the Unicode text processing, line wrapping must base on text shaping and context analysis. You can't say that a code point has the same width in any context, that's why we ignore WidthProvider at all.

For this issue, I'll allow the raw use of StringSplitter without Font access.

commented

ModernUI could fallback to vanilla logic if fonts have not been loaded yet. That would be the easiest solution.