@@ -47,7 +47,6 @@ import type { ScoreLayout } from '@src/rendering/layout/ScoreLayout';
4747import { ScoreBarRendererFactory } from '@src/rendering/ScoreBarRendererFactory' ;
4848import type { ScoreRenderer } from '@src/rendering/ScoreRenderer' ;
4949import { TabBarRendererFactory } from '@src/rendering/TabBarRendererFactory' ;
50- import { FontLoadingChecker } from '@src/util/FontLoadingChecker' ;
5150import { Logger } from '@src/Logger' ;
5251import { LeftHandTapEffectInfo } from '@src/rendering/effects/LeftHandTapEffectInfo' ;
5352import { CapellaImporter } from '@src/importer/CapellaImporter' ;
@@ -140,62 +139,6 @@ export class Environment {
140139 */
141140 public static HighDpiFactor = 1 ;
142141
143- /**
144- * @target web
145- * @internal
146- */
147- public static createStyleElement ( elementDocument : HTMLDocument , fontDirectory : string | null ) {
148- let styleElement : HTMLStyleElement = elementDocument . getElementById ( 'alphaTabStyle' ) as HTMLStyleElement ;
149- if ( ! styleElement ) {
150- if ( ! fontDirectory ) {
151- Logger . error ( 'AlphaTab' , 'Font directory could not be detected, cannot create style element' ) ;
152- return ;
153- }
154-
155- styleElement = elementDocument . createElement ( 'style' ) ;
156- styleElement . id = 'alphaTabStyle' ;
157- const css : string = `
158- @font-face {
159- font-display: block;
160- font-family: 'alphaTab';
161- src: url('${ fontDirectory } Bravura.eot');
162- src: url('${ fontDirectory } Bravura.eot?#iefix') format('embedded-opentype')
163- , url('${ fontDirectory } Bravura.woff') format('woff')
164- , url('${ fontDirectory } Bravura.otf') format('opentype')
165- , url('${ fontDirectory } Bravura.svg#Bravura') format('svg');
166- font-weight: normal;
167- font-style: normal;
168- }
169- .at-surface * {
170- cursor: default;
171- vertical-align: top;
172- overflow: visible;
173- }
174- .at-surface-svg text {
175- dominant-baseline: central;
176- white-space:pre;
177- }
178- .at {
179- font-family: 'alphaTab';
180- speak: none;
181- font-style: normal;
182- font-weight: normal;
183- font-variant: normal;
184- text-transform: none;
185- line-height: 1;
186- line-height: 1;
187- -webkit-font-smoothing: antialiased;
188- -moz-osx-font-smoothing: grayscale;
189- font-size: ${ Environment . MusicFontSize } px;
190- overflow: visible !important;
191- }` ;
192-
193- styleElement . innerHTML = css ;
194- elementDocument . getElementsByTagName ( 'head' ) . item ( 0 ) ! . appendChild ( styleElement ) ;
195- Environment . bravuraFontChecker . checkForFontAvailability ( ) ;
196- }
197- }
198-
199142 /**
200143 * @target web
201144 */
@@ -255,12 +198,6 @@ export class Environment {
255198 */
256199 public static readonly fontDirectory : string | null = Environment . detectFontDirectory ( ) ;
257200
258- /**
259- * @target web
260- * @internal
261- */
262- public static readonly bravuraFontChecker : FontLoadingChecker = new FontLoadingChecker ( [ 'alphaTab' ] ) ;
263-
264201 /**
265202 * @target web
266203 */
@@ -327,8 +264,12 @@ export class Environment {
327264 }
328265
329266 // normal browser include as <script>
330- if ( 'document' in Environment . globalThis && document . currentScript ) {
331- return ( document . currentScript as HTMLScriptElement ) . src ;
267+ if (
268+ 'document' in Environment . globalThis &&
269+ document . currentScript &&
270+ document . currentScript instanceof HTMLScriptElement
271+ ) {
272+ return document . currentScript . src ;
332273 }
333274
334275 return null ;
0 commit comments