Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix single-line fields not scaling fonts #75

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/render/text/viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,8 @@ void TextViewer::prepareLinesTryScales(RotatedDC& dc, const String& text, const

// Try the layout at the previous scale, this could give a quick upper bound
elements.getCharInfo(dc, scale, chars);
bool fits = prepareLinesAtScale(dc, chars, style, false, lines);
bool single_line = !style.field().multi_line && !style.always_symbol;
bool fits = prepareLinesAtScale(dc, chars, style, single_line, lines);
if (fits) {
min_scale = scale;
max_scale = min(max_scale, bound_on_max_scale(dc,style,lines,scale));
Expand All @@ -483,7 +484,7 @@ void TextViewer::prepareLinesTryScales(RotatedDC& dc, const String& text, const
vector<Line> lines_before;
vector<CharInfo> chars_before;
elements.getCharInfo(dc, scale, chars_before);
fits = prepareLinesAtScale(dc, chars_before, style, false, lines_before);
fits = prepareLinesAtScale(dc, chars_before, style, single_line, lines_before);
if (fits) {
// too bad
swap(lines, lines_before);
Expand All @@ -502,7 +503,7 @@ void TextViewer::prepareLinesTryScales(RotatedDC& dc, const String& text, const
best_scale = scale = min_scale;
chars.clear();
elements.getCharInfo(dc, scale, chars);
prepareLinesAtScale(dc, chars, style, false, lines);
prepareLinesAtScale(dc, chars, style, single_line, lines);
max_scale = min(max_scale, bound_on_max_scale(dc,style,lines,scale));
}

Expand All @@ -520,7 +521,7 @@ void TextViewer::prepareLinesTryScales(RotatedDC& dc, const String& text, const
vector<Line> lines_try;
vector<CharInfo> chars_try;
elements.getCharInfo(dc, scale, chars_try);
fits = prepareLinesAtScale(dc, chars_try, style, false, lines_try);
fits = prepareLinesAtScale(dc, chars_try, style, single_line, lines_try);
if (fits) {
min_scale = scale;
max_scale = min(max_scale, bound_on_max_scale(dc,style,lines_try,scale));
Expand All @@ -538,7 +539,7 @@ void TextViewer::prepareLinesTryScales(RotatedDC& dc, const String& text, const
scale = min_scale;
chars.clear();
elements.getCharInfo(dc, scale, chars);
fits = prepareLinesAtScale(dc, chars, style, false, lines);
fits = prepareLinesAtScale(dc, chars, style, single_line, lines);
}
scale = min_scale;
}
Expand Down