Fix #124899: Font bounding box calculation is incorrect for some fonts #125363

Merged
Aras Pranckevicius merged 1 commits from aras_p/blender:blf_fix_bounds into main 2024-07-25 08:45:35 +02:00

1 Commits

Author SHA1 Message Date
11cc528002 Fix #124899: Font bounding box calculation is incorrect for some fonts
All checks were successful
buildbot/vexp-code-patch-lint Build done.
buildbot/vexp-code-patch-linux-x86_64 Build done.
buildbot/vexp-code-patch-darwin-x86_64 Build done.
buildbot/vexp-code-patch-darwin-arm64 Build done.
buildbot/vexp-code-patch-windows-amd64 Build done.
buildbot/vexp-code-patch-coordinator Build done.
This is visible in VSE text strip "box" and "outline" options at least.
For some fonts (mostly script/cursive type) BLF_boundbox function
was calculating horizontal bounds purely from pen position and
advance to the next character position. But the actual glyph can extend
beyond the advance distance.

Curiously, blf_font_boundbox_foreach_glyph (used by
blf_str_offset_from_cursor_position and blf_str_offset_to_glyph_bounds)
was already doing the correct thing and taking glyph horizontal bounds
into account.
2024-07-24 11:50:01 +03:00