@coderline/alphatab 1.6.0-alpha.1416 → 1.6.0-alpha.1418
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/alphaTab.core.min.mjs +2 -2
- package/dist/alphaTab.core.mjs +228 -85
- package/dist/alphaTab.d.ts +72 -19
- package/dist/alphaTab.js +227 -84
- package/dist/alphaTab.min.js +2 -2
- package/dist/alphaTab.min.mjs +1 -1
- package/dist/alphaTab.mjs +1 -1
- package/dist/alphaTab.vite.js +1 -1
- package/dist/alphaTab.vite.mjs +1 -1
- package/dist/alphaTab.webpack.js +1 -1
- package/dist/alphaTab.webpack.mjs +1 -1
- package/dist/alphaTab.worker.min.mjs +1 -1
- package/dist/alphaTab.worker.mjs +1 -1
- package/dist/alphaTab.worklet.min.mjs +1 -1
- package/dist/alphaTab.worklet.mjs +1 -1
- package/package.json +1 -1
package/dist/alphaTab.core.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* alphaTab v1.6.0-alpha.
|
|
2
|
+
* alphaTab v1.6.0-alpha.1418 (develop, build 1418)
|
|
3
3
|
*
|
|
4
4
|
* Copyright © 2025, Daniel Kuschny and Contributors, All rights reserved.
|
|
5
5
|
*
|
|
@@ -29070,7 +29070,7 @@ class Font {
|
|
|
29070
29070
|
}
|
|
29071
29071
|
switch (typeof v) {
|
|
29072
29072
|
case 'undefined':
|
|
29073
|
-
return
|
|
29073
|
+
return undefined;
|
|
29074
29074
|
case 'object': {
|
|
29075
29075
|
const m = v;
|
|
29076
29076
|
const families = m.get('families');
|
|
@@ -29150,10 +29150,13 @@ class Font {
|
|
|
29150
29150
|
return Font.withFamilyList(families, fontSize, fontStyle, fontWeight);
|
|
29151
29151
|
}
|
|
29152
29152
|
default:
|
|
29153
|
-
return
|
|
29153
|
+
return undefined;
|
|
29154
29154
|
}
|
|
29155
29155
|
}
|
|
29156
29156
|
static toJson(font) {
|
|
29157
|
+
if (!font) {
|
|
29158
|
+
return undefined;
|
|
29159
|
+
}
|
|
29157
29160
|
const o = new Map();
|
|
29158
29161
|
o.set('families', font.families);
|
|
29159
29162
|
o.set('size', font.size);
|
|
@@ -30160,6 +30163,14 @@ class CoreSettingsSerializer {
|
|
|
30160
30163
|
/*@target web*/
|
|
30161
30164
|
o.set("fontdirectory", obj.fontDirectory);
|
|
30162
30165
|
/*@target web*/
|
|
30166
|
+
if (obj.smuflFontSources !== null) {
|
|
30167
|
+
const m = new Map();
|
|
30168
|
+
o.set("smuflfontsources", m);
|
|
30169
|
+
for (const [k, v] of obj.smuflFontSources) {
|
|
30170
|
+
m.set(k.toString(), v);
|
|
30171
|
+
}
|
|
30172
|
+
}
|
|
30173
|
+
/*@target web*/
|
|
30163
30174
|
o.set("file", obj.file);
|
|
30164
30175
|
/*@target web*/
|
|
30165
30176
|
o.set("tex", obj.tex);
|
|
@@ -30183,6 +30194,13 @@ class CoreSettingsSerializer {
|
|
|
30183
30194
|
obj.fontDirectory = v;
|
|
30184
30195
|
return true;
|
|
30185
30196
|
/*@target web*/
|
|
30197
|
+
case "smuflfontsources":
|
|
30198
|
+
obj.smuflFontSources = new Map();
|
|
30199
|
+
JsonHelper.forEach(v, (v, k) => {
|
|
30200
|
+
obj.smuflFontSources.set(JsonHelper.parseEnum(k, FontFileFormat), v);
|
|
30201
|
+
});
|
|
30202
|
+
return true;
|
|
30203
|
+
/*@target web*/
|
|
30186
30204
|
case "file":
|
|
30187
30205
|
obj.file = v;
|
|
30188
30206
|
return true;
|
|
@@ -30226,6 +30244,7 @@ class RenderingResourcesSerializer {
|
|
|
30226
30244
|
return null;
|
|
30227
30245
|
}
|
|
30228
30246
|
const o = new Map();
|
|
30247
|
+
o.set("smuflfont", Font.toJson(obj.smuflFont));
|
|
30229
30248
|
o.set("copyrightfont", Font.toJson(obj.copyrightFont));
|
|
30230
30249
|
o.set("titlefont", Font.toJson(obj.titleFont));
|
|
30231
30250
|
o.set("subtitlefont", Font.toJson(obj.subTitleFont));
|
|
@@ -30252,6 +30271,9 @@ class RenderingResourcesSerializer {
|
|
|
30252
30271
|
}
|
|
30253
30272
|
static setProperty(obj, property, v) {
|
|
30254
30273
|
switch (property) {
|
|
30274
|
+
case "smuflfont":
|
|
30275
|
+
obj.smuflFont = Font.fromJson(v);
|
|
30276
|
+
return true;
|
|
30255
30277
|
case "copyrightfont":
|
|
30256
30278
|
obj.copyrightFont = Font.fromJson(v);
|
|
30257
30279
|
return true;
|
|
@@ -34229,15 +34251,6 @@ class Html5Canvas {
|
|
|
34229
34251
|
this._color = new Color(0, 0, 0, 0xff);
|
|
34230
34252
|
this._font = new Font('Arial', 10, FontStyle.Plain);
|
|
34231
34253
|
this._lineWidth = 0;
|
|
34232
|
-
const fontElement = document.createElement('span');
|
|
34233
|
-
fontElement.classList.add('at');
|
|
34234
|
-
document.body.appendChild(fontElement);
|
|
34235
|
-
const style = window.getComputedStyle(fontElement);
|
|
34236
|
-
let family = style.fontFamily;
|
|
34237
|
-
if (family.startsWith('"') || family.startsWith("'")) {
|
|
34238
|
-
family = family.substr(1, family.length - 2);
|
|
34239
|
-
}
|
|
34240
|
-
this._musicFont = new Font(family, Number.parseFloat(style.fontSize), FontStyle.Plain);
|
|
34241
34254
|
this._measureCanvas = document.createElement('canvas');
|
|
34242
34255
|
this._measureCanvas.width = 10;
|
|
34243
34256
|
this._measureCanvas.height = 10;
|
|
@@ -34252,6 +34265,7 @@ class Html5Canvas {
|
|
|
34252
34265
|
return null;
|
|
34253
34266
|
}
|
|
34254
34267
|
beginRender(width, height) {
|
|
34268
|
+
this._musicFont = this.settings.display.resources.smuflFont;
|
|
34255
34269
|
const scale = this.settings.display.scale;
|
|
34256
34270
|
this._canvas = document.createElement('canvas');
|
|
34257
34271
|
this._canvas.width = (width * Environment.HighDpiFactor) | 0;
|
|
@@ -43843,10 +43857,6 @@ class BrowserUiFacade {
|
|
|
43843
43857
|
return this.areAllFontsLoaded();
|
|
43844
43858
|
}
|
|
43845
43859
|
areAllFontsLoaded() {
|
|
43846
|
-
Environment.bravuraFontChecker.checkForFontAvailability();
|
|
43847
|
-
if (!Environment.bravuraFontChecker.isFontLoaded) {
|
|
43848
|
-
return false;
|
|
43849
|
-
}
|
|
43850
43860
|
let isAnyNotLoaded = false;
|
|
43851
43861
|
for (const checker of this._fontCheckers.values()) {
|
|
43852
43862
|
if (!checker.isFontLoaded) {
|
|
@@ -43883,7 +43893,6 @@ class BrowserUiFacade {
|
|
|
43883
43893
|
rootElement.classList.add('alphaTab');
|
|
43884
43894
|
this.rootContainer = new HtmlElementContainer(rootElement);
|
|
43885
43895
|
this.areWorkersSupported = 'Worker' in window;
|
|
43886
|
-
Environment.bravuraFontChecker.fontLoaded.on(this.onFontLoaded.bind(this));
|
|
43887
43896
|
this._intersectionObserver = new IntersectionObserver(this.onElementVisibilityChanged.bind(this), {
|
|
43888
43897
|
threshold: [0, 0.01, 1]
|
|
43889
43898
|
});
|
|
@@ -43951,7 +43960,7 @@ class BrowserUiFacade {
|
|
|
43951
43960
|
this._contents = element.element.innerHTML;
|
|
43952
43961
|
element.element.innerHTML = '';
|
|
43953
43962
|
}
|
|
43954
|
-
this.
|
|
43963
|
+
this.createStyleElements(settings);
|
|
43955
43964
|
this._file = settings.core.file;
|
|
43956
43965
|
}
|
|
43957
43966
|
setupFontCheckers(settings) {
|
|
@@ -43977,10 +43986,15 @@ class BrowserUiFacade {
|
|
|
43977
43986
|
}
|
|
43978
43987
|
destroy() {
|
|
43979
43988
|
this.rootContainer.element.innerHTML = '';
|
|
43989
|
+
const webFont = this._webFont;
|
|
43990
|
+
webFont.usages--;
|
|
43991
|
+
if (webFont.usages <= 0) {
|
|
43992
|
+
webFont.element.remove();
|
|
43993
|
+
}
|
|
43980
43994
|
}
|
|
43981
43995
|
createCanvasElement() {
|
|
43982
43996
|
const canvasElement = document.createElement('div');
|
|
43983
|
-
canvasElement.
|
|
43997
|
+
canvasElement.classList.add('at-surface', `at${this._webFont.fontSuffix}`);
|
|
43984
43998
|
canvasElement.style.fontSize = '0';
|
|
43985
43999
|
canvasElement.style.overflow = 'hidden';
|
|
43986
44000
|
canvasElement.style.lineHeight = '0';
|
|
@@ -44078,9 +44092,132 @@ class BrowserUiFacade {
|
|
|
44078
44092
|
initialRender();
|
|
44079
44093
|
}
|
|
44080
44094
|
}
|
|
44081
|
-
|
|
44082
|
-
const
|
|
44083
|
-
|
|
44095
|
+
createStyleElements(settings) {
|
|
44096
|
+
const root = this._api.container.element.ownerDocument;
|
|
44097
|
+
BrowserUiFacade.createSharedStyleElement(root);
|
|
44098
|
+
// SmuFl Font Specific style
|
|
44099
|
+
const smuflFontSources = settings.core.smuflFontSources ?? CoreSettings.buildDefaultSmuflFontSources(settings.core.fontDirectory);
|
|
44100
|
+
// create a simple unique hash for the font source definition
|
|
44101
|
+
// as data urls might be used we don't want to just use the plain strings.
|
|
44102
|
+
const hash = BrowserUiFacade.cyrb53(smuflFontSources.values());
|
|
44103
|
+
// reuse existing style if available
|
|
44104
|
+
const registeredWebFonts = BrowserUiFacade._registeredWebFonts;
|
|
44105
|
+
if (registeredWebFonts.has(hash)) {
|
|
44106
|
+
const webFont = registeredWebFonts.get(hash);
|
|
44107
|
+
webFont.usages++;
|
|
44108
|
+
webFont.checker.fontLoaded.on(this.onFontLoaded.bind(this));
|
|
44109
|
+
this._webFont = webFont;
|
|
44110
|
+
return;
|
|
44111
|
+
}
|
|
44112
|
+
const fontSuffix = registeredWebFonts.size === 0 ? '' : String(registeredWebFonts.size);
|
|
44113
|
+
const familyName = `alphaTab${fontSuffix}`;
|
|
44114
|
+
const src = Array.from(smuflFontSources.entries())
|
|
44115
|
+
.map(e => `url(${JSON.stringify(e[1])}) format('${BrowserUiFacade.cssFormat(e[0])}')`)
|
|
44116
|
+
.join(',');
|
|
44117
|
+
const css = `
|
|
44118
|
+
@font-face {
|
|
44119
|
+
font-display: block;
|
|
44120
|
+
font-family: '${familyName}';
|
|
44121
|
+
src: ${src};
|
|
44122
|
+
font-weight: normal;
|
|
44123
|
+
font-style: normal;
|
|
44124
|
+
}
|
|
44125
|
+
.at-surface.at${fontSuffix} .at {
|
|
44126
|
+
font-family: '${familyName}';
|
|
44127
|
+
speak: none;
|
|
44128
|
+
font-style: normal;
|
|
44129
|
+
font-weight: normal;
|
|
44130
|
+
font-variant: normal;
|
|
44131
|
+
text-transform: none;
|
|
44132
|
+
line-height: 1;
|
|
44133
|
+
line-height: 1;
|
|
44134
|
+
-webkit-font-smoothing: antialiased;
|
|
44135
|
+
-moz-osx-font-smoothing: grayscale;
|
|
44136
|
+
font-size: ${Environment.MusicFontSize}px;
|
|
44137
|
+
overflow: visible !important;
|
|
44138
|
+
}`;
|
|
44139
|
+
const styleElement = root.createElement('style');
|
|
44140
|
+
styleElement.id = `alphaTabStyle${fontSuffix}`;
|
|
44141
|
+
styleElement.innerHTML = css;
|
|
44142
|
+
root.getElementsByTagName('head').item(0).appendChild(styleElement);
|
|
44143
|
+
const checker = new FontLoadingChecker([familyName]);
|
|
44144
|
+
checker.fontLoaded.on(this.onFontLoaded.bind(this));
|
|
44145
|
+
this._fontCheckers.set(familyName, checker);
|
|
44146
|
+
checker.checkForFontAvailability();
|
|
44147
|
+
settings.display.resources.smuflFont = new Font(familyName, Environment.MusicFontSize, FontStyle.Plain, FontWeight.Regular);
|
|
44148
|
+
const webFont = {
|
|
44149
|
+
element: styleElement,
|
|
44150
|
+
fontSuffix,
|
|
44151
|
+
usages: 1,
|
|
44152
|
+
checker
|
|
44153
|
+
};
|
|
44154
|
+
registeredWebFonts.set(hash, webFont);
|
|
44155
|
+
this._webFont = webFont;
|
|
44156
|
+
}
|
|
44157
|
+
static cssFormat(format) {
|
|
44158
|
+
switch (format) {
|
|
44159
|
+
case FontFileFormat.EmbeddedOpenType:
|
|
44160
|
+
return 'embedded-opentype';
|
|
44161
|
+
case FontFileFormat.Woff:
|
|
44162
|
+
return 'woff';
|
|
44163
|
+
case FontFileFormat.Woff2:
|
|
44164
|
+
return 'woff2';
|
|
44165
|
+
case FontFileFormat.OpenType:
|
|
44166
|
+
return 'opentype';
|
|
44167
|
+
case FontFileFormat.TrueType:
|
|
44168
|
+
return 'truetype';
|
|
44169
|
+
case FontFileFormat.Svg:
|
|
44170
|
+
return 'svg';
|
|
44171
|
+
}
|
|
44172
|
+
}
|
|
44173
|
+
/**
|
|
44174
|
+
* cyrb53 (c) 2018 bryc (github.com/bryc)
|
|
44175
|
+
* License: Public domain (or MIT if needed). Attribution appreciated.
|
|
44176
|
+
* A fast and simple 53-bit string hash function with decent collision resistance.
|
|
44177
|
+
* Largely inspired by MurmurHash2/3, but with a focus on speed/simplicity
|
|
44178
|
+
* @param str
|
|
44179
|
+
* @param seed
|
|
44180
|
+
* @returns
|
|
44181
|
+
*/
|
|
44182
|
+
static cyrb53(strings, seed = 0) {
|
|
44183
|
+
let h1 = 0xdeadbeef ^ seed;
|
|
44184
|
+
let h2 = 0x41c6ce57 ^ seed;
|
|
44185
|
+
for (const str of strings) {
|
|
44186
|
+
for (let i = 0; i < str.length; i++) {
|
|
44187
|
+
const ch = str.charCodeAt(i);
|
|
44188
|
+
h1 = Math.imul(h1 ^ ch, 2654435761);
|
|
44189
|
+
h2 = Math.imul(h2 ^ ch, 1597334677);
|
|
44190
|
+
}
|
|
44191
|
+
}
|
|
44192
|
+
h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507);
|
|
44193
|
+
h1 ^= Math.imul(h2 ^ (h2 >>> 13), 3266489909);
|
|
44194
|
+
h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507);
|
|
44195
|
+
h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909);
|
|
44196
|
+
return 4294967296 * (2097151 & h2) + (h1 >>> 0);
|
|
44197
|
+
}
|
|
44198
|
+
/**
|
|
44199
|
+
* Creates the default CSS styles used across all alphaTab instances.
|
|
44200
|
+
* @target web
|
|
44201
|
+
* @internal
|
|
44202
|
+
*/
|
|
44203
|
+
static createSharedStyleElement(root) {
|
|
44204
|
+
let styleElement = root.getElementById('alphaTabStyle');
|
|
44205
|
+
if (!styleElement) {
|
|
44206
|
+
styleElement = document.createElement('style');
|
|
44207
|
+
styleElement.id = 'alphaTabStyleShared';
|
|
44208
|
+
const css = `
|
|
44209
|
+
.at-surface * {
|
|
44210
|
+
cursor: default;
|
|
44211
|
+
vertical-align: top;
|
|
44212
|
+
overflow: visible;
|
|
44213
|
+
}
|
|
44214
|
+
.at-surface-svg text {
|
|
44215
|
+
dominant-baseline: central;
|
|
44216
|
+
white-space:pre;
|
|
44217
|
+
}`;
|
|
44218
|
+
styleElement.innerHTML = css;
|
|
44219
|
+
document.getElementsByTagName('head').item(0).appendChild(styleElement);
|
|
44220
|
+
}
|
|
44084
44221
|
}
|
|
44085
44222
|
parseTracks(tracksData) {
|
|
44086
44223
|
if (!tracksData) {
|
|
@@ -44462,6 +44599,7 @@ class BrowserUiFacade {
|
|
|
44462
44599
|
return new BackingTrackPlayer(new AudioElementBackingTrackSynthOutput(), this._api.settings.player.bufferTimeInMilliseconds);
|
|
44463
44600
|
}
|
|
44464
44601
|
}
|
|
44602
|
+
BrowserUiFacade._registeredWebFonts = new Map();
|
|
44465
44603
|
|
|
44466
44604
|
/**
|
|
44467
44605
|
* Represents the progress of any data being loaded.
|
|
@@ -60719,9 +60857,9 @@ class VersionInfo {
|
|
|
60719
60857
|
print(`build date: ${VersionInfo.date}`);
|
|
60720
60858
|
}
|
|
60721
60859
|
}
|
|
60722
|
-
VersionInfo.version = '1.6.0-alpha.
|
|
60723
|
-
VersionInfo.date = '2025-05-
|
|
60724
|
-
VersionInfo.commit = '
|
|
60860
|
+
VersionInfo.version = '1.6.0-alpha.1418';
|
|
60861
|
+
VersionInfo.date = '2025-05-21T02:08:19.492Z';
|
|
60862
|
+
VersionInfo.commit = '1f6342282295a9544ebc36ddd38d73d220d2caab';
|
|
60725
60863
|
|
|
60726
60864
|
/**
|
|
60727
60865
|
* A factory for custom layout engines.
|
|
@@ -60753,59 +60891,6 @@ class RenderEngineFactory {
|
|
|
60753
60891
|
* @partial
|
|
60754
60892
|
*/
|
|
60755
60893
|
class Environment {
|
|
60756
|
-
/**
|
|
60757
|
-
* @target web
|
|
60758
|
-
* @internal
|
|
60759
|
-
*/
|
|
60760
|
-
static createStyleElement(elementDocument, fontDirectory) {
|
|
60761
|
-
let styleElement = elementDocument.getElementById('alphaTabStyle');
|
|
60762
|
-
if (!styleElement) {
|
|
60763
|
-
if (!fontDirectory) {
|
|
60764
|
-
Logger.error('AlphaTab', 'Font directory could not be detected, cannot create style element');
|
|
60765
|
-
return;
|
|
60766
|
-
}
|
|
60767
|
-
styleElement = elementDocument.createElement('style');
|
|
60768
|
-
styleElement.id = 'alphaTabStyle';
|
|
60769
|
-
const css = `
|
|
60770
|
-
@font-face {
|
|
60771
|
-
font-display: block;
|
|
60772
|
-
font-family: 'alphaTab';
|
|
60773
|
-
src: url('${fontDirectory}Bravura.eot');
|
|
60774
|
-
src: url('${fontDirectory}Bravura.eot?#iefix') format('embedded-opentype')
|
|
60775
|
-
, url('${fontDirectory}Bravura.woff') format('woff')
|
|
60776
|
-
, url('${fontDirectory}Bravura.otf') format('opentype')
|
|
60777
|
-
, url('${fontDirectory}Bravura.svg#Bravura') format('svg');
|
|
60778
|
-
font-weight: normal;
|
|
60779
|
-
font-style: normal;
|
|
60780
|
-
}
|
|
60781
|
-
.at-surface * {
|
|
60782
|
-
cursor: default;
|
|
60783
|
-
vertical-align: top;
|
|
60784
|
-
overflow: visible;
|
|
60785
|
-
}
|
|
60786
|
-
.at-surface-svg text {
|
|
60787
|
-
dominant-baseline: central;
|
|
60788
|
-
white-space:pre;
|
|
60789
|
-
}
|
|
60790
|
-
.at {
|
|
60791
|
-
font-family: 'alphaTab';
|
|
60792
|
-
speak: none;
|
|
60793
|
-
font-style: normal;
|
|
60794
|
-
font-weight: normal;
|
|
60795
|
-
font-variant: normal;
|
|
60796
|
-
text-transform: none;
|
|
60797
|
-
line-height: 1;
|
|
60798
|
-
line-height: 1;
|
|
60799
|
-
-webkit-font-smoothing: antialiased;
|
|
60800
|
-
-moz-osx-font-smoothing: grayscale;
|
|
60801
|
-
font-size: ${Environment.MusicFontSize}px;
|
|
60802
|
-
overflow: visible !important;
|
|
60803
|
-
}`;
|
|
60804
|
-
styleElement.innerHTML = css;
|
|
60805
|
-
elementDocument.getElementsByTagName('head').item(0).appendChild(styleElement);
|
|
60806
|
-
Environment.bravuraFontChecker.checkForFontAvailability();
|
|
60807
|
-
}
|
|
60808
|
-
}
|
|
60809
60894
|
/**
|
|
60810
60895
|
* @target web
|
|
60811
60896
|
* @internal
|
|
@@ -60881,7 +60966,9 @@ class Environment {
|
|
|
60881
60966
|
catch (e) {
|
|
60882
60967
|
}
|
|
60883
60968
|
// normal browser include as <script>
|
|
60884
|
-
if ('document' in Environment.globalThis &&
|
|
60969
|
+
if ('document' in Environment.globalThis &&
|
|
60970
|
+
document.currentScript &&
|
|
60971
|
+
document.currentScript instanceof HTMLScriptElement) {
|
|
60885
60972
|
return document.currentScript.src;
|
|
60886
60973
|
}
|
|
60887
60974
|
return null;
|
|
@@ -61359,11 +61446,6 @@ Environment.scriptFile = Environment.detectScriptFile();
|
|
|
61359
61446
|
* @target web
|
|
61360
61447
|
*/
|
|
61361
61448
|
Environment.fontDirectory = Environment.detectFontDirectory();
|
|
61362
|
-
/**
|
|
61363
|
-
* @target web
|
|
61364
|
-
* @internal
|
|
61365
|
-
*/
|
|
61366
|
-
Environment.bravuraFontChecker = new FontLoadingChecker(['alphaTab']);
|
|
61367
61449
|
Environment.renderEngines = Environment.createDefaultRenderEngines();
|
|
61368
61450
|
/**
|
|
61369
61451
|
* @internal
|
|
@@ -61374,12 +61456,58 @@ Environment.layoutEngines = Environment.createDefaultLayoutEngines();
|
|
|
61374
61456
|
*/
|
|
61375
61457
|
Environment.staveProfiles = Environment.createDefaultStaveProfiles();
|
|
61376
61458
|
|
|
61459
|
+
/**
|
|
61460
|
+
* Lists the known file formats for font files.
|
|
61461
|
+
* @target web
|
|
61462
|
+
*/
|
|
61463
|
+
var FontFileFormat;
|
|
61464
|
+
(function (FontFileFormat) {
|
|
61465
|
+
/**
|
|
61466
|
+
* .eot
|
|
61467
|
+
*/
|
|
61468
|
+
FontFileFormat[FontFileFormat["EmbeddedOpenType"] = 0] = "EmbeddedOpenType";
|
|
61469
|
+
/**
|
|
61470
|
+
* .woff
|
|
61471
|
+
*/
|
|
61472
|
+
FontFileFormat[FontFileFormat["Woff"] = 1] = "Woff";
|
|
61473
|
+
/**
|
|
61474
|
+
* .woff2
|
|
61475
|
+
*/
|
|
61476
|
+
FontFileFormat[FontFileFormat["Woff2"] = 2] = "Woff2";
|
|
61477
|
+
/**
|
|
61478
|
+
* .otf
|
|
61479
|
+
*/
|
|
61480
|
+
FontFileFormat[FontFileFormat["OpenType"] = 3] = "OpenType";
|
|
61481
|
+
/**
|
|
61482
|
+
* .ttf
|
|
61483
|
+
*/
|
|
61484
|
+
FontFileFormat[FontFileFormat["TrueType"] = 4] = "TrueType";
|
|
61485
|
+
/**
|
|
61486
|
+
* .svg
|
|
61487
|
+
*/
|
|
61488
|
+
FontFileFormat[FontFileFormat["Svg"] = 5] = "Svg";
|
|
61489
|
+
})(FontFileFormat || (FontFileFormat = {}));
|
|
61377
61490
|
/**
|
|
61378
61491
|
* All main settings of alphaTab controlling rather general aspects of its behavior.
|
|
61379
61492
|
* @json
|
|
61380
61493
|
* @json_declaration
|
|
61381
61494
|
*/
|
|
61382
61495
|
class CoreSettings {
|
|
61496
|
+
/**
|
|
61497
|
+
* Builds the default SMuFL font sources for the usage with alphaTab in cases
|
|
61498
|
+
* where no custom {@link smuflFontSources} are provided.
|
|
61499
|
+
* @param fontDirectory The {@link fontDirectory} configured.
|
|
61500
|
+
* @target web
|
|
61501
|
+
*/
|
|
61502
|
+
static buildDefaultSmuflFontSources(fontDirectory) {
|
|
61503
|
+
const map = new Map();
|
|
61504
|
+
// WOFF, WOFF2 and OTF should cover all our platform needs
|
|
61505
|
+
const prefix = fontDirectory ?? '';
|
|
61506
|
+
map.set(FontFileFormat.Woff2, `${prefix}Bravura.woff2`);
|
|
61507
|
+
map.set(FontFileFormat.Woff, `${prefix}Bravura.woff`);
|
|
61508
|
+
map.set(FontFileFormat.OpenType, `${prefix}Bravura.otf`);
|
|
61509
|
+
return map;
|
|
61510
|
+
}
|
|
61383
61511
|
/**
|
|
61384
61512
|
* @target web
|
|
61385
61513
|
*/
|
|
@@ -61405,12 +61533,27 @@ class CoreSettings {
|
|
|
61405
61533
|
* where the Web Font files of [Bravura](https://github.com/steinbergmedia/bravura) are. Normally alphaTab expects
|
|
61406
61534
|
* them to be in a `font` subfolder beside the script file. If this is not the case, this setting must be used to configure the path.
|
|
61407
61535
|
* Alternatively also a global variable `ALPHATAB_FONT` can be set on the page before initializing alphaTab.
|
|
61536
|
+
*
|
|
61537
|
+
* Use {@link smuflFontSources} for more flexible font configuration.
|
|
61408
61538
|
* @defaultValue `"${AlphaTabScriptFolder}/font/"`
|
|
61409
61539
|
* @category Core - JavaScript Specific
|
|
61410
61540
|
* @target web
|
|
61411
61541
|
* @since 0.9.6
|
|
61412
61542
|
*/
|
|
61413
61543
|
this.fontDirectory = null;
|
|
61544
|
+
/**
|
|
61545
|
+
* Defines the URLs from which to load the SMuFL compliant font files.
|
|
61546
|
+
* @remarks
|
|
61547
|
+
* These sources will be used to load and register the webfonts on the page so
|
|
61548
|
+
* they are available for rendering the music sheet. The sources can be set to any
|
|
61549
|
+
* CSS compatible URL which can be passed into `url()`.
|
|
61550
|
+
* See https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src#url
|
|
61551
|
+
* @defaultValue Bravura files located at {@link fontDirectory} .
|
|
61552
|
+
* @category Core - JavaScript Specific
|
|
61553
|
+
* @target web
|
|
61554
|
+
* @since 1.6.0
|
|
61555
|
+
*/
|
|
61556
|
+
this.smuflFontSources = null;
|
|
61414
61557
|
/**
|
|
61415
61558
|
* The full URL to the input file to be loaded.
|
|
61416
61559
|
* @remarks
|
|
@@ -65053,4 +65196,4 @@ const _jsonbarrel = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.definePropert
|
|
|
65053
65196
|
__proto__: null
|
|
65054
65197
|
}, Symbol.toStringTag, { value: 'Module' }));
|
|
65055
65198
|
|
|
65056
|
-
export { AlphaTabApi, AlphaTabApiBase, AlphaTabError, AlphaTabErrorType, ConsoleLogger, CoreSettings, DisplaySettings, Environment, FileLoadError, FingeringMode, FormatError, ImporterSettings, LayoutMode, LogLevel, Logger, NotationElement, NotationMode, NotationSettings, PlayerMode, PlayerOutputMode, PlayerSettings, ProgressEventArgs, RenderEngineFactory, RenderingResources, ResizeEventArgs, ScrollMode, Settings, SlidePlaybackSettings, StaveProfile, SystemsLayoutMode, TabRhythmMode, VibratoPlaybackSettings, WebPlatform, _barrel$5 as exporter, _barrel$7 as importer, _barrel$6 as io, _jsonbarrel as json, VersionInfo as meta, _barrel$4 as midi, _barrel$3 as model, _barrel$1 as platform, _barrel$2 as rendering, _barrel as synth };
|
|
65199
|
+
export { AlphaTabApi, AlphaTabApiBase, AlphaTabError, AlphaTabErrorType, ConsoleLogger, CoreSettings, DisplaySettings, Environment, FileLoadError, FingeringMode, FontFileFormat, FormatError, ImporterSettings, LayoutMode, LogLevel, Logger, NotationElement, NotationMode, NotationSettings, PlayerMode, PlayerOutputMode, PlayerSettings, ProgressEventArgs, RenderEngineFactory, RenderingResources, ResizeEventArgs, ScrollMode, Settings, SlidePlaybackSettings, StaveProfile, SystemsLayoutMode, TabRhythmMode, VibratoPlaybackSettings, WebPlatform, _barrel$5 as exporter, _barrel$7 as importer, _barrel$6 as io, _jsonbarrel as json, VersionInfo as meta, _barrel$4 as midi, _barrel$3 as model, _barrel$1 as platform, _barrel$2 as rendering, _barrel as synth };
|
package/dist/alphaTab.d.ts
CHANGED
|
@@ -4975,12 +4975,34 @@ export declare class CoreSettings {
|
|
|
4975
4975
|
* where the Web Font files of [Bravura](https://github.com/steinbergmedia/bravura) are. Normally alphaTab expects
|
|
4976
4976
|
* them to be in a `font` subfolder beside the script file. If this is not the case, this setting must be used to configure the path.
|
|
4977
4977
|
* Alternatively also a global variable `ALPHATAB_FONT` can be set on the page before initializing alphaTab.
|
|
4978
|
+
*
|
|
4979
|
+
* Use {@link smuflFontSources} for more flexible font configuration.
|
|
4978
4980
|
* @defaultValue `"${AlphaTabScriptFolder}/font/"`
|
|
4979
4981
|
* @category Core - JavaScript Specific
|
|
4980
4982
|
* @target web
|
|
4981
4983
|
* @since 0.9.6
|
|
4982
4984
|
*/
|
|
4983
4985
|
fontDirectory: string | null;
|
|
4986
|
+
/**
|
|
4987
|
+
* Defines the URLs from which to load the SMuFL compliant font files.
|
|
4988
|
+
* @remarks
|
|
4989
|
+
* These sources will be used to load and register the webfonts on the page so
|
|
4990
|
+
* they are available for rendering the music sheet. The sources can be set to any
|
|
4991
|
+
* CSS compatible URL which can be passed into `url()`.
|
|
4992
|
+
* See https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src#url
|
|
4993
|
+
* @defaultValue Bravura files located at {@link fontDirectory} .
|
|
4994
|
+
* @category Core - JavaScript Specific
|
|
4995
|
+
* @target web
|
|
4996
|
+
* @since 1.6.0
|
|
4997
|
+
*/
|
|
4998
|
+
smuflFontSources: Map<FontFileFormat, string> | null;
|
|
4999
|
+
/**
|
|
5000
|
+
* Builds the default SMuFL font sources for the usage with alphaTab in cases
|
|
5001
|
+
* where no custom {@link smuflFontSources} are provided.
|
|
5002
|
+
* @param fontDirectory The {@link fontDirectory} configured.
|
|
5003
|
+
* @target web
|
|
5004
|
+
*/
|
|
5005
|
+
static buildDefaultSmuflFontSources(fontDirectory: string | null): Map<FontFileFormat, string>;
|
|
4984
5006
|
/**
|
|
4985
5007
|
* The full URL to the input file to be loaded.
|
|
4986
5008
|
* @remarks
|
|
@@ -5129,12 +5151,27 @@ declare interface CoreSettingsJson {
|
|
|
5129
5151
|
* where the Web Font files of [Bravura](https://github.com/steinbergmedia/bravura) are. Normally alphaTab expects
|
|
5130
5152
|
* them to be in a `font` subfolder beside the script file. If this is not the case, this setting must be used to configure the path.
|
|
5131
5153
|
* Alternatively also a global variable `ALPHATAB_FONT` can be set on the page before initializing alphaTab.
|
|
5154
|
+
*
|
|
5155
|
+
* Use {@link smuflFontSources} for more flexible font configuration.
|
|
5132
5156
|
* @defaultValue `"${AlphaTabScriptFolder}/font/"`
|
|
5133
5157
|
* @category Core - JavaScript Specific
|
|
5134
5158
|
* @target web
|
|
5135
5159
|
* @since 0.9.6
|
|
5136
5160
|
*/
|
|
5137
5161
|
fontDirectory?: string | null;
|
|
5162
|
+
/**
|
|
5163
|
+
* Defines the URLs from which to load the SMuFL compliant font files.
|
|
5164
|
+
* @remarks
|
|
5165
|
+
* These sources will be used to load and register the webfonts on the page so
|
|
5166
|
+
* they are available for rendering the music sheet. The sources can be set to any
|
|
5167
|
+
* CSS compatible URL which can be passed into `url()`.
|
|
5168
|
+
* See https://developer.mozilla.org/en-US/docs/Web/CSS/@font-face/src#url
|
|
5169
|
+
* @defaultValue Bravura files located at {@link fontDirectory} .
|
|
5170
|
+
* @category Core - JavaScript Specific
|
|
5171
|
+
* @target web
|
|
5172
|
+
* @since 1.6.0
|
|
5173
|
+
*/
|
|
5174
|
+
smuflFontSources?: Map<FontFileFormat | keyof typeof FontFileFormat | Lowercase<keyof typeof FontFileFormat>, string>;
|
|
5138
5175
|
/**
|
|
5139
5176
|
* The full URL to the input file to be loaded.
|
|
5140
5177
|
* @remarks
|
|
@@ -6177,7 +6214,6 @@ export declare class Environment {
|
|
|
6177
6214
|
private static readonly StaffIdBeforeEndAlways;
|
|
6178
6215
|
/* Excluded from this release type: MusicFontSize */
|
|
6179
6216
|
/* Excluded from this release type: HighDpiFactor */
|
|
6180
|
-
/* Excluded from this release type: createStyleElement */
|
|
6181
6217
|
/**
|
|
6182
6218
|
* @target web
|
|
6183
6219
|
*/
|
|
@@ -6203,7 +6239,6 @@ export declare class Environment {
|
|
|
6203
6239
|
* @target web
|
|
6204
6240
|
*/
|
|
6205
6241
|
static readonly fontDirectory: string | null;
|
|
6206
|
-
/* Excluded from this release type: bravuraFontChecker */
|
|
6207
6242
|
/**
|
|
6208
6243
|
* @target web
|
|
6209
6244
|
*/
|
|
@@ -6506,8 +6541,39 @@ declare class Font {
|
|
|
6506
6541
|
*/
|
|
6507
6542
|
static withFamilyList(families: string[], size: number, style?: FontStyle, weight?: FontWeight): Font;
|
|
6508
6543
|
toCssString(scale?: number): string;
|
|
6509
|
-
static fromJson(v: unknown): Font |
|
|
6510
|
-
static toJson(font: Font): Map<string, unknown
|
|
6544
|
+
static fromJson(v: unknown): Font | undefined;
|
|
6545
|
+
static toJson(font: Font | undefined): Map<string, unknown> | undefined;
|
|
6546
|
+
}
|
|
6547
|
+
|
|
6548
|
+
/**
|
|
6549
|
+
* Lists the known file formats for font files.
|
|
6550
|
+
* @target web
|
|
6551
|
+
*/
|
|
6552
|
+
export declare enum FontFileFormat {
|
|
6553
|
+
/**
|
|
6554
|
+
* .eot
|
|
6555
|
+
*/
|
|
6556
|
+
EmbeddedOpenType = 0,
|
|
6557
|
+
/**
|
|
6558
|
+
* .woff
|
|
6559
|
+
*/
|
|
6560
|
+
Woff = 1,
|
|
6561
|
+
/**
|
|
6562
|
+
* .woff2
|
|
6563
|
+
*/
|
|
6564
|
+
Woff2 = 2,
|
|
6565
|
+
/**
|
|
6566
|
+
* .otf
|
|
6567
|
+
*/
|
|
6568
|
+
OpenType = 3,
|
|
6569
|
+
/**
|
|
6570
|
+
* .ttf
|
|
6571
|
+
*/
|
|
6572
|
+
TrueType = 4,
|
|
6573
|
+
/**
|
|
6574
|
+
* .svg
|
|
6575
|
+
*/
|
|
6576
|
+
Svg = 5
|
|
6511
6577
|
}
|
|
6512
6578
|
|
|
6513
6579
|
/**
|
|
@@ -6522,21 +6588,6 @@ declare type FontJson = Font | string | {
|
|
|
6522
6588
|
weight: FontWeight | keyof typeof FontWeight;
|
|
6523
6589
|
};
|
|
6524
6590
|
|
|
6525
|
-
/**
|
|
6526
|
-
* This small utility helps to detect whether a particular font is already loaded.
|
|
6527
|
-
* @target web
|
|
6528
|
-
*/
|
|
6529
|
-
declare class FontLoadingChecker {
|
|
6530
|
-
private _originalFamilies;
|
|
6531
|
-
private _families;
|
|
6532
|
-
private _isStarted;
|
|
6533
|
-
isFontLoaded: boolean;
|
|
6534
|
-
fontLoaded: IEventEmitterOfT<string>;
|
|
6535
|
-
constructor(families: string[]);
|
|
6536
|
-
checkForFontAvailability(): void;
|
|
6537
|
-
private isFontAvailable;
|
|
6538
|
-
}
|
|
6539
|
-
|
|
6540
6591
|
/**
|
|
6541
6592
|
* Describes the sizes of a font for measuring purposes.
|
|
6542
6593
|
*/
|
|
@@ -12066,6 +12117,7 @@ export declare namespace rendering {
|
|
|
12066
12117
|
export declare class RenderingResources {
|
|
12067
12118
|
private static sansFont;
|
|
12068
12119
|
private static serifFont;
|
|
12120
|
+
/* Excluded from this release type: smuflFont */
|
|
12069
12121
|
/**
|
|
12070
12122
|
* The font to use for displaying the songs copyright information in the header of the music sheet.
|
|
12071
12123
|
* @defaultValue `bold 12px Arial, sans-serif`
|
|
@@ -12208,6 +12260,7 @@ export declare class RenderingResources {
|
|
|
12208
12260
|
* @target web
|
|
12209
12261
|
*/
|
|
12210
12262
|
declare interface RenderingResourcesJson {
|
|
12263
|
+
/* Excluded from this release type: smuflFont */
|
|
12211
12264
|
/**
|
|
12212
12265
|
* The font to use for displaying the songs copyright information in the header of the music sheet.
|
|
12213
12266
|
* @defaultValue `bold 12px Arial, sans-serif`
|