]> de.git.xonotic.org Git - xonotic/mediasource.git/blob - fonts/xolonium/src/hti/Xolonium-Common-fpgm.hti
Update Xolonium sources to version 4.2
[xonotic/mediasource.git] / fonts / xolonium / src / hti / Xolonium-Common-fpgm.hti
1 fpgm
2 {
3         # Move point rounding up
4         void 2 moveRoundUp pt
5                 push 0b01001010 # RTG 6/8
6                 SROUND
7                 MDRP[pmrg]
8                 RTG
9         ENDF
10
11         # Move point rounding down
12         void 3 moveRoundDown pt
13                 push 0b01000110 # RTG 2/8
14                 SROUND
15                 MDRP[pmrg]
16                 RTG
17         ENDF
18
19         # Based on FontForge FDEF 8
20         void 4 ipRound pt ptRP1 ptRP2
21                 SRP2
22                 SRP1
23                 DUP
24                 IP
25                 MDAP[r]
26         ENDF
27
28         # Same as ipRound, but round up at low PPEM
29         void 5 ipMiddleBar pt ptRP1 ptRP2
30                 MPPEM
31                 push 10
32                 LTEQ
33                 IF
34                         push 0b01001001 # RTG 5/8
35                         SROUND
36                 EIF
37                 SRP2
38                 SRP1
39                 DUP
40                 IP
41                 MDAP[r]
42                 RTG
43         ENDF
44
45         # Based on FontForge FDEF 6
46         FDEF 6 isGrayscale
47                 push 34 1
48                 GETINFO
49                 LT
50                 IF
51                         push 0b00100000
52                         GETINFO
53                         NOT
54                         NOT
55                 ELSE
56                         push 0
57                 EIF
58         ENDF
59
60         # Based on FontForge FDEF 7
61         FDEF 7 isClearType
62                 push 36 1
63                 GETINFO
64                 LT
65                 IF
66                         push 0b01000000
67                         GETINFO
68                         NOT
69                         NOT
70                 ELSE
71                         push 0
72                 EIF
73         ENDF
74
75         # Position point of diacritic relative to CVT
76         void 8 posDiac pt cvtGap cvtRef
77                 push 0 # Twilight point
78                 push 0 # Zone
79                 SZP0
80
81                 # Position twilight point
82                 SWAP
83                 MIAP[r]
84
85                 # Move pt
86                 RCVT
87                 ROUND[w]
88                 push 1.0 # Min
89                 MAX
90                 MSIRP[rp0]
91
92                 push 1
93                 SZP0
94         ENDF
95
96         # Shift diacritic on y axis, with minimum distance
97         void 9 yShiftDiac pt cvtGap ptRef
98                 SVTCA[y]
99                 SRP0
100
101                 # Get distance
102                 RCVT
103                 ROUND[w]
104                 push 1.0 # Min
105                 MAX
106
107                 # Move
108                 MSIRP
109         ENDF
110
111         # Shift diacritic on y axis, without minimum distance, rounding down
112         void 10 yShiftStackedDiac pt cvtGap ptRef
113                 SVTCA[y]
114                 SRP0
115
116                 # Get distance
117                 RCVT
118                 push 0b01000101 # RTG 1/8
119                 SROUND
120                 ROUND[w]
121                 RTG
122
123                 # Move
124                 MSIRP
125         ENDF
126
127         # Horizontally center diacritic
128         void 11 xCenterDiac ptBaseLeft ptDiacLeft ptDiacRight ptBaseRight
129                 push 0
130                 push 12
131                 CALL
132         ENDF
133
134         # Horizontally center diacritic, with EM offset
135         void 12 xCenterDiacOffset ptBaseLeft ptDiacLeft ptDiacRight ptBaseRight valOffset
136                 SVTCA[x]
137
138                 # Prepare offset
139                 push 0 0 # TEMP cvt index
140                 ROLL
141                 WCVTF
142                 RCVT
143
144                 # Calculate shift to center
145                 SWAP
146                 GC[cur] # ptBaseRight
147                 ROLL
148                 GC[cur] # ptDiacRight
149                 SUB
150                 push 4
151                 MINDEX
152                 GC[cur] # ptBaseLeft
153                 ADD
154                 ROLL
155                         # Set ref point
156                         DUP
157                         SRP0
158                 DUP
159                 GC[cur] # ptDiacLeft
160                 ROLL
161                 SWAP
162                 SUB
163                 push 2.0
164                 DIV
165
166                 # Add offset
167                 ROLL
168                 ADD
169                 push 0b01000111 # RTG 3/8
170                 SROUND
171                 ROUND[g]
172                 RTG
173
174                 # Move
175                 MSIRP
176         ENDF
177
178         # Move point by rounded cvt value,
179         # intended for composites
180         void 13 moveCvtRight ptRef cvtRight pt
181                 ROLL
182                 SRP0
183                 SWAP
184                 RCVT
185                 ROUND[g]
186                 MSIRP[rp0]
187         ENDF
188
189         # Move point by two rounded cvt values,
190         # intended for composites
191         void 14 moveCvtRightLeft ptRef cvtRight cvtLeft pt
192                 ROLL
193                 RCVT
194                 ROUND[g]
195                 ROLL
196                 RCVT
197                 ROUND[g]
198                 push 1.0 # Min
199                 MAX
200                 ADD
201                 ROLL
202                 SRP0
203                 MSIRP[rp0]
204         ENDF
205 }