MCPcopy Create free account
hub / github.com/CoderLine/alphaTab / _fontStyleVariantWeight

Method _fontStyleVariantWeight

packages/alphatab/src/model/Font.ts:202–277  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

200 }
201
202 private _fontStyleVariantWeight() {
203 let hasStyle = false;
204 let hasVariant = false;
205 let hasWeight = false;
206 let valuesNeeded = 3;
207 const ambiguous: string[] = [];
208
209 while (true) {
210 if (!this._currentToken) {
211 return;
212 }
213 const text: string = this._currentToken.text;
214 switch (text) {
215 // ambiguous
216 case 'normal':
217 case 'inherit':
218 ambiguous.push(text);
219 valuesNeeded--;
220 this._nextToken();
221 break;
222
223 // style
224 case 'italic':
225 case 'oblique':
226 this.style = text;
227 hasStyle = true;
228 valuesNeeded--;
229 this._nextToken();
230 break;
231 // variant
232 case 'small-caps':
233 this.variant = text;
234 hasVariant = true;
235 valuesNeeded--;
236 this._nextToken();
237 break;
238
239 // weight
240 case 'bold':
241 case 'bolder':
242 case 'lighter':
243 case '100':
244 case '200':
245 case '300':
246 case '400':
247 case '500':
248 case '600':
249 case '700':
250 case '800':
251 case '900':
252 this.weight = text;
253 hasWeight = true;
254 valuesNeeded--;
255 this._nextToken();
256 break;
257 default:
258 // unknown token -> done with this part
259 return;

Callers 1

parseMethod · 0.95

Calls 3

_nextTokenMethod · 0.95
popMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected