-
-
Notifications
You must be signed in to change notification settings - Fork 836
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: Add avm2/font_enumeratefonts_order test
This test verifies the order which fonts are enumerated in.
- Loading branch information
Showing
8 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
tests/tests/swfs/avm2/font_enumeratefonts_order/FontSwf.as
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package { | ||
import flash.display.*; | ||
import flash.text.*; | ||
|
||
public class FontSwf extends Sprite { | ||
[Embed(source="TestFont.ttf", fontName="TestFont4", embedAsCFF="false", unicodeRange="U+0061-U+0061")] | ||
private var TestFont4:Class; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package { | ||
import flash.display.*; | ||
import flash.text.*; | ||
import flash.net.*; | ||
import flash.system.*; | ||
import flash.events.*; | ||
|
||
public class Test extends Sprite { | ||
[Embed(source="TestFont.ttf", fontName="TestFont1", embedAsCFF="false", unicodeRange="U+0061-U+0061")] | ||
private var TestFont1:Class; | ||
|
||
[Embed(source="TestFont.ttf", fontName="Test Font3", embedAsCFF="false", unicodeRange="U+0061-U+0061")] | ||
private var TestFont2:Class; | ||
|
||
[Embed(source="TestFont.ttf", fontName="TestFont2", embedAsCFF="false", unicodeRange="U+0061-U+0061")] | ||
private var TestFont3:Class; | ||
|
||
[Embed(source="TestFont.ttf", fontName="TestFont7", embedAsCFF="false", unicodeRange="U+0061-U+0061")] | ||
private var TestFont4:Class; | ||
|
||
[Embed(source="TestFont.ttf", fontName="TeStfONt6", embedAsCFF="false", unicodeRange="U+0061-U+0061")] | ||
private var TestFont5:Class; | ||
|
||
[Embed(source="TestFont.ttf", fontName="testfont5", embedAsCFF="false", unicodeRange="U+0061-U+0061")] | ||
private var TestFont6:Class; | ||
|
||
public function Test() { | ||
Font.registerFont(TestFont2); | ||
Font.registerFont(TestFont1); | ||
|
||
var fontLoader:Loader = new Loader(); | ||
var context:LoaderContext = new LoaderContext(); | ||
context.allowCodeImport = true; | ||
fontLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onFontLoaded); | ||
fontLoader.load(new URLRequest("font.swf"), context); | ||
} | ||
|
||
private function onFontLoaded(event:Event):void { | ||
var fontClass:Class = event.target.applicationDomain.getDefinition("FontSwf_TestFont4") as Class; | ||
Font.registerFont(fontClass); | ||
|
||
for each (var font: Font in Font.enumerateFonts()) { | ||
trace(font.fontName + ", " + font.fontStyle + ", " + font.fontType); | ||
} | ||
} | ||
} | ||
|
||
} |
73 changes: 73 additions & 0 deletions
73
tests/tests/swfs/avm2/font_enumeratefonts_order/TestFont.sfd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
SplineFontDB: 3.2 | ||
FontName: TestFont | ||
FullName: TestFont | ||
FamilyName: TestFont | ||
Weight: Regular | ||
Copyright: Copyright (c) 2024, Kamil Jarosz | ||
UComments: "2024-7-24: Created with FontForge (http://fontforge.org)" | ||
Version: 001.000 | ||
ItalicAngle: 0 | ||
UnderlinePosition: -76 | ||
UnderlineWidth: 38 | ||
Ascent: 800 | ||
Descent: 200 | ||
InvalidEm: 0 | ||
LayerCount: 2 | ||
Layer: 0 0 "Back" 1 | ||
Layer: 1 0 "Fore" 0 | ||
XUID: [1021 253 198287149 6396829] | ||
StyleMap: 0x0000 | ||
FSType: 0 | ||
OS2Version: 0 | ||
OS2_WeightWidthSlopeOnly: 0 | ||
OS2_UseTypoMetrics: 1 | ||
CreationTime: 1721856925 | ||
ModificationTime: 1736720091 | ||
PfmFamily: 17 | ||
TTFWeight: 400 | ||
TTFWidth: 5 | ||
LineGap: 100 | ||
VLineGap: 0 | ||
OS2TypoAscent: 0 | ||
OS2TypoAOffset: 1 | ||
OS2TypoDescent: 0 | ||
OS2TypoDOffset: 1 | ||
OS2TypoLinegap: 100 | ||
OS2WinAscent: 0 | ||
OS2WinAOffset: 1 | ||
OS2WinDescent: 0 | ||
OS2WinDOffset: 1 | ||
HheadAscent: 0 | ||
HheadAOffset: 1 | ||
HheadDescent: 0 | ||
HheadDOffset: 1 | ||
OS2Vendor: 'PfEd' | ||
MarkAttachClasses: 1 | ||
DEI: 91125 | ||
Encoding: ISO8859-1 | ||
UnicodeInterp: none | ||
NameList: AGL For New Fonts | ||
DisplaySize: -48 | ||
AntiAlias: 1 | ||
FitToEm: 0 | ||
WinInfo: 0 30 10 | ||
BeginPrivate: 0 | ||
EndPrivate | ||
BeginChars: 256 1 | ||
|
||
StartChar: a | ||
Encoding: 97 97 0 | ||
Width: 800 | ||
Flags: HW | ||
LayerCount: 2 | ||
Fore | ||
SplineSet | ||
0 800 m 5 | ||
800 800 l 5 | ||
800 0 l 1 | ||
0 0 l 1 | ||
0 800 l 5 | ||
EndSplineSet | ||
EndChar | ||
EndChars | ||
EndSplineFont |
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Test Font3, regular, embedded | ||
Test Font3, regular, embedded | ||
TestFont1, regular, embedded | ||
TestFont1, regular, embedded | ||
TestFont2, regular, embedded | ||
TestFont4, regular, embedded | ||
testfont5, regular, embedded | ||
TeStfONt6, regular, embedded | ||
TestFont7, regular, embedded |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
num_ticks = 3 |