mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +00:00
parent
30a5f2891b
commit
716311f44f
1 changed files with 12 additions and 1 deletions
|
@ -923,9 +923,20 @@ static void _fontText(LottieText* text, Scene* scene, float frameNo, LottieExpre
|
||||||
//fallback to any available font
|
//fallback to any available font
|
||||||
txt->font(nullptr, size);
|
txt->font(nullptr, size);
|
||||||
}
|
}
|
||||||
txt->translate(0.0f, -doc.size * 100.0f);
|
|
||||||
txt->text(doc.text);
|
txt->text(doc.text);
|
||||||
txt->fill(doc.color.rgb[0], doc.color.rgb[1], doc.color.rgb[2]);
|
txt->fill(doc.color.rgb[0], doc.color.rgb[1], doc.color.rgb[2]);
|
||||||
|
|
||||||
|
float width;
|
||||||
|
txt->bounds(nullptr, nullptr, &width, nullptr, false);
|
||||||
|
|
||||||
|
float cursorX = 0.0f;
|
||||||
|
if (doc.justify == 1) {
|
||||||
|
cursorX = width * -1;
|
||||||
|
} else if (doc.justify == 2) {
|
||||||
|
cursorX = width * -0.5f;
|
||||||
|
}
|
||||||
|
|
||||||
|
txt->translate(cursorX, -doc.size * 100.0f);
|
||||||
scene->push(txt);
|
scene->push(txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue