Fix #130385: Use Only Advance When Measuring Mono Text
When measuring text strings we consider both the advance and the glyph bounding box. But monospaced text should only use the advance because many fonts allow some mono characters to slightly overflow. This just removes bounding box from the calculation of width for mono text. Pull Request: https://projects.blender.org/blender/blender/pulls/131114
This commit is contained in:
committed by
Harley Acheson
parent
d0d936b760
commit
47492c7aa6
@@ -916,7 +916,10 @@ static void blf_font_boundbox_ex(FontBLF *font,
|
||||
const ft_pix pen_x_next = pen_x + g->advance_x;
|
||||
|
||||
const ft_pix gbox_xmin = std::min(pen_x, pen_x + g->box_xmin);
|
||||
const ft_pix gbox_xmax = std::max(pen_x_next, pen_x + g->box_xmax);
|
||||
/* Monspaced characters should only use advance. #130385. */
|
||||
const ft_pix gbox_xmax = (font->flags & BLF_MONOSPACED) ?
|
||||
pen_x_next :
|
||||
std::max(pen_x_next, pen_x + g->box_xmax);
|
||||
const ft_pix gbox_ymin = g->box_ymin + pen_y;
|
||||
const ft_pix gbox_ymax = g->box_ymax + pen_y;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user