Skip to content

Commit a9a35bb

Browse files
committed
tests: Add fonts/device_font_kerning test
1 parent 5342270 commit a9a35bb

File tree

7 files changed

+180
-0
lines changed

7 files changed

+180
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package {
2+
import flash.display.*;
3+
import flash.text.*;
4+
5+
[SWF(width="100", height="50")]
6+
public class Test extends Sprite {
7+
[Embed(source="TestFont.ttf", fontName="TestFont", embedAsCFF="false", unicodeRange="U+0061-U+0064")]
8+
private var TestFont:Class;
9+
10+
public function Test() {
11+
stage.scaleMode = "noScale";
12+
13+
addTextField(0, 0, false);
14+
addTextField(0, 25, true);
15+
}
16+
17+
private function addTextField(x:Number, y:Number, kerning:Boolean):void {
18+
var field:TextField = new TextField();
19+
field.type = "input";
20+
field.width = 100;
21+
field.x = x;
22+
field.height = 25;
23+
field.y = y;
24+
field.border = true;
25+
26+
var tf:TextFormat = new TextFormat("TestFont", 10);
27+
tf.kerning = kerning;
28+
field.defaultTextFormat = tf;
29+
30+
field.text = "abcd";
31+
32+
var lm = field.getLineMetrics(0);
33+
trace("LM width: " + lm.width);
34+
trace("width: " + field.textWidth);
35+
36+
addChild(field);
37+
}
38+
}
39+
}
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
SplineFontDB: 3.2
2+
FontName: TestFont
3+
FullName: TestFont
4+
FamilyName: TestFont
5+
Weight: Regular
6+
Copyright: Copyright (c) 2025, Kamil Jarosz
7+
UComments: "2024-7-24: Created with FontForge (http://fontforge.org)"
8+
Version: 001.000
9+
ItalicAngle: 0
10+
UnderlinePosition: -76
11+
UnderlineWidth: 38
12+
Ascent: 800
13+
Descent: 200
14+
InvalidEm: 0
15+
LayerCount: 2
16+
Layer: 0 0 "Back" 1
17+
Layer: 1 0 "Fore" 0
18+
XUID: [1021 253 198287149 6396829]
19+
StyleMap: 0x0000
20+
FSType: 0
21+
OS2Version: 0
22+
OS2_WeightWidthSlopeOnly: 0
23+
OS2_UseTypoMetrics: 1
24+
CreationTime: 1721856925
25+
ModificationTime: 1763285453
26+
PfmFamily: 17
27+
TTFWeight: 400
28+
TTFWidth: 5
29+
LineGap: 100
30+
VLineGap: 0
31+
OS2TypoAscent: 0
32+
OS2TypoAOffset: 1
33+
OS2TypoDescent: 0
34+
OS2TypoDOffset: 1
35+
OS2TypoLinegap: 100
36+
OS2WinAscent: 0
37+
OS2WinAOffset: 1
38+
OS2WinDescent: 0
39+
OS2WinDOffset: 1
40+
HheadAscent: 0
41+
HheadAOffset: 1
42+
HheadDescent: 0
43+
HheadDOffset: 1
44+
OS2Vendor: 'PfEd'
45+
Lookup: 258 0 0 "'kern' Horizontal Kerning in Latin lookup 0" { "'kern' Horizontal Kerning in Latin lookup 0-1" [150,15,0] } ['kern' ('latn' <'dflt' > ) ]
46+
MarkAttachClasses: 1
47+
DEI: 91125
48+
Encoding: ISO8859-1
49+
UnicodeInterp: none
50+
NameList: AGL For New Fonts
51+
DisplaySize: -48
52+
AntiAlias: 1
53+
FitToEm: 0
54+
WinInfo: 0 30 10
55+
BeginPrivate: 0
56+
EndPrivate
57+
BeginChars: 256 4
58+
59+
StartChar: a
60+
Encoding: 97 97 0
61+
Width: 1000
62+
Flags: W
63+
HStem: 0 800<0 1000>
64+
LayerCount: 2
65+
Fore
66+
SplineSet
67+
0 800 m 1
68+
1000 800 l 5
69+
1000 0 l 5
70+
0 0 l 1
71+
0 800 l 1
72+
EndSplineSet
73+
Kerns2: 2 1000 "'kern' Horizontal Kerning in Latin lookup 0-1"
74+
EndChar
75+
76+
StartChar: c
77+
Encoding: 99 99 1
78+
Width: 1000
79+
Flags: W
80+
HStem: 0 800<0 1000>
81+
LayerCount: 2
82+
Fore
83+
SplineSet
84+
0 800 m 1
85+
1000 800 l 5
86+
1000 0 l 5
87+
0 0 l 1
88+
0 800 l 1
89+
EndSplineSet
90+
Kerns2: 3 500 "'kern' Horizontal Kerning in Latin lookup 0-1"
91+
EndChar
92+
93+
StartChar: b
94+
Encoding: 98 98 2
95+
Width: 1000
96+
Flags: W
97+
HStem: 0 800<0 1000>
98+
LayerCount: 2
99+
Fore
100+
SplineSet
101+
0 800 m 1
102+
1000 800 l 5
103+
1000 0 l 5
104+
0 0 l 1
105+
0 800 l 1
106+
EndSplineSet
107+
Kerns2: 1 -500 "'kern' Horizontal Kerning in Latin lookup 0-1"
108+
EndChar
109+
110+
StartChar: d
111+
Encoding: 100 100 3
112+
Width: 1000
113+
Flags: W
114+
HStem: 0 800<0 1000>
115+
LayerCount: 2
116+
Fore
117+
SplineSet
118+
0 800 m 1
119+
1000 800 l 5
120+
1000 0 l 5
121+
0 0 l 1
122+
0 800 l 1
123+
EndSplineSet
124+
EndChar
125+
EndChars
126+
EndSplineFont
1.84 KB
Binary file not shown.
271 Bytes
Loading
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
LM width: 50
2+
width: 50
3+
LM width: 50
4+
width: 50
1.91 KB
Binary file not shown.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
num_ticks = 1
2+
3+
[image_comparisons.output]
4+
tolerance = 0
5+
6+
[player_options]
7+
with_renderer = { optional = false, sample_count = 4 }
8+
9+
[fonts.a]
10+
family = "TestFont"
11+
path = "TestFont.ttf"

0 commit comments

Comments
 (0)