Page MenuHome

BLF: Fix FT_Get_Advance Wrong Value Without Size
ClosedPublic

Authored by Harley Acheson (harley) on Aug 20 2022, 2:13 AM.

Details

Summary

Fix possibility of getting invalid fixed-pitch advance size.


FT_Get_Advance() returns zero if caching and the ft_size has been culled. The only way I've seen to trigger this bug:

  • Have a layout that includes both Properties and a Text Editor with text inside.
  • 2D Zoom the Properties editor (Ctrl-Middle Mouse drag).
  • Click inside the Text Editor and all the text will bunch up along the right side
  • Ctrl-Middle Mouse scroll to change Text Editor font size will fix it.

This just moves a blf_ensure_size() up a few lines to ensure the size is there when this function is called. In a nutshell the zooming caused the sizes to be culled. Then while setting up the glyph cache again to draw the Text Editor the call to FT_Get_Advance() returned zero which is used for the fixed-pitch advance size.

A very simple fix and own code, so will likely commit without review.

Diff Detail

Repository
rB Blender

Event Timeline

Harley Acheson (harley) requested review of this revision.Aug 20 2022, 2:13 AM
Harley Acheson (harley) created this revision.
This revision was not accepted when it landed; it landed in state Needs Review.Aug 20 2022, 2:18 AM
This revision was automatically updated to reflect the committed changes.