X Tutup
Skip to content

Implement TextBlock::recreateTextLine and basic multi line support#23215

Draft
evilpie wants to merge 2 commits intoruffle-rs:masterfrom
evilpie:tlf-text-line
Draft

Implement TextBlock::recreateTextLine and basic multi line support#23215
evilpie wants to merge 2 commits intoruffle-rs:masterfrom
evilpie:tlf-text-line

Conversation

@evilpie
Copy link
Collaborator

@evilpie evilpie commented Mar 9, 2026

Improves #10173

This implements pretty basic multi-line support for FTE's TextBlock. Most of the code was written by Claude using the Weed to Wonder as a test case.

It works by first applying the current format and then measuring the number of characters that fit into the first line. The created TextLine is then limited to the number of chracters that fit. Based on the textLineCreationResult being "success" (line created) or "completed" (all remaining text fit into the current line, no more lines needed) the caller (flashx) decides whether to create new lines or not.

recreateTextLine allows re-layouting a specific line after changing its width. Which means it might fit more or less text than before.

image

@evilpie evilpie added A-avm2 Area: AVM2 (ActionScript 3) fte/tlf Issues relating to the FTE (Flash Text Engine) AVM2 API or TLF (Text Layout Framework) in general llm The PR contains mostly LLM-generated code labels Mar 9, 2026
None => 0,
};

if start >= full_text.len() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can start > full_text.len() ever be true?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So you mean we would usually assume that we either previously consumed less than or at most equal to the length of the full_text? That makes sense. But currently you can still pass random TextLines into that function, which means that property doesn't hold. I imagine when we add more checks we could maybe soften this to ==.

@Lord-McSweeney
Copy link
Collaborator

#15159 seems to hang with this PR

@evilpie evilpie marked this pull request as draft March 9, 2026 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-avm2 Area: AVM2 (ActionScript 3) fte/tlf Issues relating to the FTE (Flash Text Engine) AVM2 API or TLF (Text Layout Framework) in general llm The PR contains mostly LLM-generated code newsworthy

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

X Tutup