MOZ_text
MOZ_text copied to clipboard
Letter spacing conversion
Investigating a better approach to match letter spacing than the current SDF_TEXT_MAGIC_LETTERSPACING_FACTOR
.
Unfortunately right away I noticed that Blender does not even use the font's kerning information at all, and it's a known issue: https://developer.blender.org/T69805 -- the quality will therefore be better when rendered in the browser for kerned fonts, but it's going to make an exact match pretty much impossible. I could add an option to Troika to ignore kerning as well, though that feels like an odd thing to do.
Beyond that, there is definitely another conversion required; Troika's letterSpacing is a simple multiple of the fontSize added to the character advance+kerning, but Blender's does not appear to be that simple. For example, 1.000
corresponds to "normal" (no additional) spacing, but 0.000
seems to correspond to some nonzero constant that I haven't yet been able to determine. I'll keep digging on that.
In the long run, you'll need to decide and define how the letterSpacing parameter in the MOZ_text
glTF extension data should behave (assuming the intent is for this to be usable by more than just the Blender export). I'd recommend either using fontSize-relative units (like Troika) or absolute local coordinate system units. Most or all of the value conversion would then be done in the Blender export extension rather than the GLTFLoader.