You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When calling stbtt_GetCodepointHMetrics() on every character of a string, after a certain point the advanceWidth ends up being set to weird values. When using Arial, the advance width gets set to 13235 at a certain character and then 0 for the remaining characters. The point at which the values get weird varies for every string, The values are sometimes negative as well, for example -32548. however it mostly occurs in strings that are 30+ characters long. As a side note, no kerning is present.
To Reproduce
Init "Arial" font
Loop through every character in the string abcdefghijklmnopqrstuvwxyz1234567890 and call stbtt_GetCodepointHMetrics() on every character (the advanceWidth should become 13235 for the character 8)
Expected behavior
The advanceWidth should be the correct advance width for the character.
Screenshots
The text was updated successfully, but these errors were encountered:
You should share your code.
Sounds like you maybe freed/released the ttf data itself and only kept the font_info struct? The ttf font data should also be kept in memory for as long as you use the font.
It's hard to detect that problem because right after doing it, the memory may no longer be 'allocated' according to the system but the data is still in there and is in a page you have been granted access to. When you start allocating new things, that space gets overwritten and starts invalidating the font data that is still being used.
Describe the bug
When calling stbtt_GetCodepointHMetrics() on every character of a string, after a certain point the advanceWidth ends up being set to weird values. When using Arial, the advance width gets set to 13235 at a certain character and then 0 for the remaining characters. The point at which the values get weird varies for every string, The values are sometimes negative as well, for example -32548. however it mostly occurs in strings that are 30+ characters long. As a side note, no kerning is present.
To Reproduce
abcdefghijklmnopqrstuvwxyz1234567890
and call stbtt_GetCodepointHMetrics() on every character (the advanceWidth should become 13235 for the character8
)Expected behavior
The advanceWidth should be the correct advance width for the character.
Screenshots
The text was updated successfully, but these errors were encountered: