MaxVisibleGraphemes: Certain font/character combinations do not count graphemes correctly

Issue Type: Display
Impact: High
Frequency: Often
Date First Experienced: 2021-03-23 00:03:00 (+00:00)
Date Last Experienced: 2021-03-28 21:03:00 (+01:00)

Reproduction Steps:
Run this script in the command bar, or load the attached place; observe the created text label:

local gui = Instance.new("ScreenGui")
local text_label = Instance.new("TextLabel")
text_label.Font = Enum.Font.GrenzeGotisch
text_label.TextScaled = true --[[not necessary to trigger bug]]
text_label.Text = "affliction"
text_label.MaxVisibleGraphemes = 2
text_label.Parent = gui
text_label.Size = UDim2.new(0, 400, 0, 200)
gui.Parent = game.StarterGui

MaxVisibleGraphemesFontBug.rbxl (23.9 KB)

Expected Behavior:
Text label should display “af” (the first 2 graphemes from “affliction”), regardless of font.

Actual Behavior:
Text label displays “af”, “aff”, or “affl” (between 2 and 4 graphemes), depending on selected text font. SourceSans displays “aff”, SciFi displays “af”, GrenzeGotisch displays “affl”, results with other fonts vary.

Other observations:
Issue also occurs with “ll” (double lower case L) in some fonts (2 graphemes of “allusion” in PatrickHand font produces “all”). (I suspect it has something to do with kerning, as these letters are thin and protude to the right?). May occur with other font/character combinations too; I have not tested extensively.

Increasing MaxVisibleGraphemes past this number continues to add displayed characters (usually as expected, though this bug can happen more than once in the same string), leaving the displayed number of characters offset from the expected result for the remainder of the text.

(This is causing problems for me because I’m trying to trigger a pause in my type writer effect after typing out punctuation; it’s pausing at what would be the correct MaxVisibleGraphemes count if the graphemes were being counted correctly, but the displayed number of characters is offset because of this bug, so extra characters are displayed before pausing. It’s not affecting gameplay, and I would guess most developers would not notice the difference, but it makes the type writer effect look significantly worse than it did before switching to MaxVisibleGraphemes)

Workaround:
I can’t think of a sane workaround other than switching font. Working fully around the issue would involve figuring out exactly what characters cause the problem and editing my script to manually compensate, which would then cause the type writer pause to be offset in the opposite direction if this bug was fixed.

3 Likes

Thanks for your report, we have internally track the issue and will look into this. Btw your bug reports are really well-written.

9 Likes

This issue should now be resolved! If this issue is still occurring, please create a new topic for us to look into.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.