Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

text: Refer to TextLine as FTE, not TLF #19070

Merged
merged 1 commit into from
Dec 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion core/src/avm2/globals/flash/text/engine/text_block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ pub fn create_text_line<'gc>(

// FIXME: TextLine should be its own DisplayObject
let display_object: EditText =
EditText::new_tlf(activation.context, movie, 0.0, 0.0, width, 15.0);
EditText::new_fte(activation.context, movie, 0.0, 0.0, width, 15.0);

display_object.set_text(text.as_wstr(), activation.context);

Expand Down
24 changes: 15 additions & 9 deletions core/src/display_object/edit_text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,13 @@ pub struct EditTextData<'gc> {
layout_debug_boxes_flags: LayoutDebugBoxesFlag,

/// Whether this EditText represents an AVM2 TextLine.
is_tlf: bool,
///
/// FTE (Flash Text Engine) is a low-level API for sophisticated text control.
///
/// See <https://docs.ruffle.rs/en_US/FlashPlatform/reference/actionscript/3/flash/text/engine/TextLine.html>
/// See <https://docs.ruffle.rs/en_US/FlashPlatform/reference/actionscript/3/flash/text/engine/package-detail.html>
/// See <https://docs.ruffle.rs/en_US/as3/dev/WS9dd7ed846a005b294b857bfa122bd808ea6-8000.html>
is_fte: bool,

/// Restrict what characters the user may input.
#[collect(require_static)]
Expand Down Expand Up @@ -198,7 +204,7 @@ impl EditTextData<'_> {
fn font_type(&self) -> FontType {
if !self.flags.contains(EditTextFlag::USE_OUTLINES) {
FontType::Device
} else if self.is_tlf {
} else if self.is_fte {
FontType::EmbeddedCFF
} else {
FontType::Embedded
Expand Down Expand Up @@ -327,7 +333,7 @@ impl<'gc> EditText<'gc> {
scroll: 1,
max_chars: swf_tag.max_length().unwrap_or_default() as i32,
mouse_wheel_enabled: true,
is_tlf: false,
is_fte: false,
restrict: EditTextRestrict::allow_all(),
last_click: None,
layout_debug_boxes_flags: LayoutDebugBoxesFlag::empty(),
Expand Down Expand Up @@ -376,7 +382,7 @@ impl<'gc> EditText<'gc> {
}

/// Create a new, dynamic `EditText` representing an AVM2 TextLine.
pub fn new_tlf(
pub fn new_fte(
context: &mut UpdateContext<'gc>,
swf_movie: Arc<SwfMovie>,
x: f64,
Expand All @@ -385,7 +391,7 @@ impl<'gc> EditText<'gc> {
height: f64,
) -> Self {
let text = Self::new(context, swf_movie, x, y, width, height);
text.set_is_tlf(context.gc(), true);
text.set_is_fte(context.gc(), true);
text.set_selectable(false, context);

text
Expand Down Expand Up @@ -645,12 +651,12 @@ impl<'gc> EditText<'gc> {
.set(EditTextFlag::HTML, is_html);
}

pub fn is_tlf(self) -> bool {
self.0.read().is_tlf
pub fn is_fte(self) -> bool {
self.0.read().is_fte
}

pub fn set_is_tlf(self, gc_context: &Mutation<'gc>, is_tlf: bool) {
self.0.write(gc_context).is_tlf = is_tlf;
pub fn set_is_fte(self, gc_context: &Mutation<'gc>, is_fte: bool) {
self.0.write(gc_context).is_fte = is_fte;
}

pub fn layout_debug_boxes_flag(self, flag: LayoutDebugBoxesFlag) -> bool {
Expand Down