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

Method toCssString

packages/alphatab/src/model/Font.ts:482–498  ·  view source on GitHub ↗
(scale: number = 1)

Source from the content-addressed store, hash-verified

480 }
481
482 public toCssString(scale: number = 1): string {
483 if (!this._css || !(Math.abs(scale - this._cssScale) < 0.01)) {
484 let buf: string = '';
485 if (this.isBold) {
486 buf += 'bold ';
487 }
488 if (this.isItalic) {
489 buf += 'italic ';
490 }
491 buf += this.size * scale;
492 buf += 'px ';
493 buf += this.families.map(f => FontParser.quoteFont(f)).join(', ');
494 this._css = buf;
495 this._cssScale = scale;
496 }
497 return this._css;
498 }
499
500 public static fromJson(v: unknown): Font | undefined {
501 if (v instanceof Font) {

Callers 7

_resetMethod · 0.95
constructorMethod · 0.95
AndroidCanvasClass · 0.80
toCssStringTestFunction · 0.80
fontMethod · 0.80
fillTextFunction · 0.80

Calls 4

absMethod · 0.80
quoteFontMethod · 0.80
joinMethod · 0.45
mapMethod · 0.45

Tested by 1

toCssStringTestFunction · 0.64