Fix line-height.

This commit is contained in:
Martín Lucas Golini
2026-05-13 12:53:40 -03:00
parent 7be0f28c31
commit 4b58b2f61b
4 changed files with 12 additions and 6 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 6.3 KiB

View File

@@ -551,9 +551,8 @@ void RichText::updateLayout() {
Float ascent = fontStyle.Font->getAscent( fontStyle.CharacterSize );
Float height =
pText->lineHeight > 0 ? pText->lineHeight
: mLineHeight > 0
? mLineHeight
pText->lineHeight > 0
? pText->lineHeight
: fontStyle.Font->getLineSpacing( fontStyle.CharacterSize );
Float spanWidth = renderSpanText->getTextWidth();
@@ -844,9 +843,8 @@ void RichText::updateLayout() {
renderSpanText->setStyleConfig( fontStyle );
Float ascent = fontStyle.Font->getAscent( fontStyle.CharacterSize );
Float height = pText->lineHeight > 0 ? pText->lineHeight
: mLineHeight > 0
? mLineHeight
Float height = pText->lineHeight > 0
? pText->lineHeight
: fontStyle.Font->getLineSpacing( fontStyle.CharacterSize );
Float spanWidth = renderSpanText->getTextWidth();

View File

@@ -170,6 +170,14 @@ UTEST( UIRichText, anchorMargins ) {
SceneManager::instance()->draw();
win->display();
auto anchors = sceneNode->getRoot()->findAllByTag( "a" );
for ( auto anchor : anchors ) {
auto a = anchor->asType<UIAnchorSpan>();
EXPECT_EQ( anchor->getPixelsSize().getHeight(),
a->getFont()->getLineSpacing( a->getFontSize() ) );
}
compareImages( utest_state, utest_result, win, "eepp-ui-anchor-margins", "html" );
Engine::destroySingleton();