Added more default fonts, and fixed issue with font selector at different GUI scales

This commit is contained in:
Yousef Khadadeh 2025-11-15 14:05:05 +03:00
parent e451e8b181
commit 5e8016b504
19 changed files with 438 additions and 21 deletions

View file

@ -771,6 +771,11 @@ void TextBox::set_width(float newWidth) {
}
}
float TextBox::get_height() {
rebuild();
return paragraphs.back().heightOffset + paragraphs.back().p->getHeight();
}
void TextBox::set_allow_newlines(bool allow) {
newlinesAllowed = allow;
}
@ -795,6 +800,16 @@ void TextBox::rebuild() {
ParagraphData& pData = paragraphs[pIndex];
skia::textlayout::ParagraphStyle pStyle = pData.pStyleData.get_paragraph_style();
pStyle.setTextStyle(tStyle);
if(!newlinesAllowed) {
pStyle.setTextHeightBehavior(skia::textlayout::kDisableAll);
skia::textlayout::StrutStyle strutStyle;
strutStyle.setStrutEnabled(true);
strutStyle.setForceStrutHeight(true);
pStyle.setStrutStyle(strutStyle);
}
size_t tIndex = 0;
skia::textlayout::ParagraphBuilderImpl a(pStyle, fontCollection, SkUnicodes::ICU::Make());