From 92d90a9dda6a4cc9ecdb969ab25706fe18bfcf3a Mon Sep 17 00:00:00 2001 From: Kamil Jarosz Date: Sun, 19 Jan 2025 12:26:41 +0100 Subject: [PATCH] avm2: Add ElementFormat.getFontMetrics stub --- .../avm2/globals/flash/text/engine/ElementFormat.as | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/core/src/avm2/globals/flash/text/engine/ElementFormat.as b/core/src/avm2/globals/flash/text/engine/ElementFormat.as index eaf530779bdd..2d67fe18dd62 100644 --- a/core/src/avm2/globals/flash/text/engine/ElementFormat.as +++ b/core/src/avm2/globals/flash/text/engine/ElementFormat.as @@ -1,4 +1,8 @@ package flash.text.engine { + import __ruffle__.stub_method; + + import flash.geom.Rectangle; + [API("662")] public final class ElementFormat { private var _alignmentBaseline:String; @@ -200,5 +204,13 @@ package flash.text.engine { public function set typographicCase(value:String):void { this._typographicCase = value; } + + public function getFontMetrics():FontMetrics { + stub_method("flash.text.engine.ElementFormat", "getFontMetrics"); + var emBox:Rectangle = new Rectangle(0, _fontSize * -0.8, _fontSize, _fontSize); + return new FontMetrics( + emBox, -5, 1.2, 1.8, 1.2, 0.075, 0.6, -0.35, 0.6, 0.0 + ); + } } }