Use FontData everywhere

This commit is contained in:
Yousef Khadadeh 2025-11-16 10:42:01 +03:00
parent 4fe52ef7f6
commit a99b0e920d
14 changed files with 51 additions and 46 deletions

View file

@ -794,9 +794,9 @@ void TextBox::set_allow_newlines(bool allow) {
newlinesAllowed = allow;
}
void TextBox::set_font_collection(const sk_sp<skia::textlayout::FontCollection>& fC) {
if(fontCollection != fC) {
fontCollection = fC;
void TextBox::set_font_data(const std::shared_ptr<FontData>& fD) {
if(fontData != fD) {
fontData = fD;
inputChangedTextBox = true;
needsRebuild = true;
}
@ -810,6 +810,8 @@ void TextBox::rebuild() {
skia::textlayout::TextStyle tStyle = initialTStyle;
FontFamiliesTextStyleModifier::globalFontData = fontData;
for(size_t pIndex = 0; pIndex < paragraphs.size(); pIndex++) {
ParagraphData& pData = paragraphs[pIndex];
skia::textlayout::ParagraphStyle pStyle = pData.pStyleData.get_paragraph_style();
@ -825,7 +827,7 @@ void TextBox::rebuild() {
}
size_t tIndex = 0;
skia::textlayout::ParagraphBuilderImpl a(pStyle, fontCollection, SkUnicodes::ICU::Make());
skia::textlayout::ParagraphBuilderImpl a(pStyle, fontData->collection, SkUnicodes::ICU::Make());
for(;;) {
if(nextTStyleModIt == tStyleMods.end() || nextTStyleModIt->pos.fParagraphIndex != pIndex) {