diff options
author | Harley Acheson <harley.acheson@gmail.com> | 2022-09-24 03:36:49 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2022-09-24 03:36:49 +0300 |
commit | cd1631b17dd0e25a8a398fb00a982ca5f0633558 (patch) | |
tree | ee8d9cdb560c815ea86d952ef2f053c6435865c1 /source/blender/editors/interface | |
parent | 88a602bc64fc2a86411d67881439a04486f95030 (diff) |
BLF: Refactor of DPI
Correction of U.dpi to hold actual monitor DPI. Simplify font sizing by
omitting DPI as API argument, always using 72 internally.
See D15961 for more details.
Differential Revision: https://developer.blender.org/D15961
Reviewed by Campbell Barton
Diffstat (limited to 'source/blender/editors/interface')
4 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/editors/interface/interface_icons_event.c b/source/blender/editors/interface/interface_icons_event.c index e892a989191..b5cbc92741e 100644 --- a/source/blender/editors/interface/interface_icons_event.c +++ b/source/blender/editors/interface/interface_icons_event.c @@ -66,7 +66,7 @@ static void icon_draw_rect_input_text( BLF_batch_draw_flush(); const int font_id = BLF_default(); BLF_color4fv(font_id, color); - BLF_size(font_id, font_size * U.pixelsize, U.dpi); + BLF_size(font_id, font_size * U.dpi_fac); float width, height; BLF_width_and_height(font_id, str, BLF_DRAW_STR_DUMMY_MAX, &width, &height); const float x = trunc(rect->xmin + (((rect->xmax - rect->xmin) - width) / 2.0f)); diff --git a/source/blender/editors/interface/interface_panel.cc b/source/blender/editors/interface/interface_panel.cc index 745a2201dc1..90572c45e8b 100644 --- a/source/blender/editors/interface/interface_panel.cc +++ b/source/blender/editors/interface/interface_panel.cc @@ -1343,7 +1343,7 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) BLF_enable(fontid, BLF_ROTATION); BLF_rotation(fontid, M_PI_2); ui_fontscale(&fstyle_points, aspect); - BLF_size(fontid, fstyle_points * U.pixelsize, U.dpi); + BLF_size(fontid, fstyle_points * U.dpi_fac); /* Check the region type supports categories to avoid an assert * for showing 3D view panels in the properties space. */ diff --git a/source/blender/editors/interface/interface_region_tooltip.cc b/source/blender/editors/interface/interface_region_tooltip.cc index a6e37d3f36f..2c4d13e0717 100644 --- a/source/blender/editors/interface/interface_region_tooltip.cc +++ b/source/blender/editors/interface/interface_region_tooltip.cc @@ -254,7 +254,7 @@ static void ui_tooltip_region_draw_cb(const bContext *UNUSED(C), ARegion *region UI_fontstyle_set(&fstyle_mono); /* XXX: needed because we don't have mono in 'U.uifonts'. */ - BLF_size(fstyle_mono.uifont_id, fstyle_mono.points * U.pixelsize, U.dpi); + BLF_size(fstyle_mono.uifont_id, fstyle_mono.points * U.dpi_fac); rgb_float_to_uchar(drawcol, tip_colors[static_cast<int>(field->format.color_id)]); UI_fontstyle_draw(&fstyle_mono, &bbox, field->text, UI_TIP_STR_MAX, drawcol, &fs_params); } @@ -1133,7 +1133,7 @@ static ARegion *ui_tooltip_create_with_data(bContext *C, int font_id; if (field->format.style == uiTooltipFormat::Style::Mono) { - BLF_size(blf_mono_font, data->fstyle.points * U.pixelsize, U.dpi); + BLF_size(blf_mono_font, data->fstyle.points * U.dpi_fac); font_id = blf_mono_font; } else { diff --git a/source/blender/editors/interface/interface_style.cc b/source/blender/editors/interface/interface_style.cc index 904765f6dc4..3895a687033 100644 --- a/source/blender/editors/interface/interface_style.cc +++ b/source/blender/editors/interface/interface_style.cc @@ -496,5 +496,5 @@ void UI_fontstyle_set(const uiFontStyle *fs) { uiFont *font = uifont_to_blfont(fs->uifont_id); - BLF_size(font->blf_id, fs->points * U.pixelsize, U.dpi); + BLF_size(font->blf_id, fs->points * U.dpi_fac); } |