mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 13:43:43 +00:00
lottie/text: Support text tracking
Text Tracking value("tr") is parsed and never used. Calculate text spacing size via the tracking offset. Issue: #2254
This commit is contained in:
parent
6bf069fa7a
commit
1e7cf2f5f9
3 changed files with 3 additions and 3 deletions
|
@ -606,7 +606,7 @@ static void _updateText(LottieGroup* parent, LottieObject** child, float frameNo
|
||||||
p += glyph->len;
|
p += glyph->len;
|
||||||
|
|
||||||
//advance the cursor position horizontally
|
//advance the cursor position horizontally
|
||||||
cursor.x += glyph->width + spacing;
|
cursor.x += glyph->width + spacing + doc.tracking;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,7 +183,7 @@ void LottieParser::getValue(TextDocument& doc)
|
||||||
else if (KEY_AS("f")) doc.name = getStringCopy();
|
else if (KEY_AS("f")) doc.name = getStringCopy();
|
||||||
else if (KEY_AS("t")) doc.text = getStringCopy();
|
else if (KEY_AS("t")) doc.text = getStringCopy();
|
||||||
else if (KEY_AS("j")) doc.justify = getInt();
|
else if (KEY_AS("j")) doc.justify = getInt();
|
||||||
else if (KEY_AS("tr")) doc.tracking = getInt();
|
else if (KEY_AS("tr")) doc.tracking = getFloat() * 0.1f;
|
||||||
else if (KEY_AS("lh")) doc.height = getFloat();
|
else if (KEY_AS("lh")) doc.height = getFloat();
|
||||||
else if (KEY_AS("ls")) doc.shift = getFloat();
|
else if (KEY_AS("ls")) doc.shift = getFloat();
|
||||||
else if (KEY_AS("fc")) getValue(doc.color);
|
else if (KEY_AS("fc")) getValue(doc.color);
|
||||||
|
|
|
@ -75,8 +75,8 @@ struct TextDocument
|
||||||
} stroke;
|
} stroke;
|
||||||
char* name = nullptr;
|
char* name = nullptr;
|
||||||
float size;
|
float size;
|
||||||
|
float tracking;
|
||||||
uint8_t justify;
|
uint8_t justify;
|
||||||
uint8_t tracking;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue