display.resources
display.resourcesJavaScriptresourcesJavaScriptdisplay.resourcesJSONresourcesJSONDisplay.Resources.netdisplay.resourcesAndroidAllows adjusting of the used fonts and colors for rendering. AlphaTab allows configuring the colors and fonts used for rendering via the rendering resources settings. Please note that as of today this is the primary way of changing the way how alphaTab styles elements. CSS styling in the browser cannot be guaranteed to work due to its flexibility.
Due to space reasons in the following table the common prefix of the settings are removed. Please refer to these examples to eliminate confusion on the usage:
| Platform | Prefix | Example Usage |
|---|---|---|
| JavaScript | display.resources. | settings.display.resources.wordsFont = ... |
| JSON | display.resources. | var settings = { display: { resources: { wordsFonts: '...'} } }; |
| JSON | resources. | var settings = { resources: { wordsFonts: '...'} }; |
| .net | Display.Resources. | settings.Display.Resources.WordsFonts = ... |
| Android | display.resources. | settings.display.resources.wordsFonts = ... |
Typesโ
Fontsโ
For the JavaScript platform any font that might be installed on the client machines can be used. Any additional fonts can be added via WebFonts. The rendering of the score will be delayed until it is detected that the font was loaded. Simply use any CSS font property compliant string as configuration. Relative font sizes with percentual values are not supported, remaining values will be considered if supported.
since 1.2.3 Multiple fonts are also supported for the Web version. alphaTab will check if any of the fonts in the list is loaded instead of all. If none is available at the time alphaTab is initialized, it will try to initiate the load of the specified fonts individual through the Browser Font APIs.
For the .net platform any installed font on the system can be used. Simply construct the Font object to configure your desired fonts.
Colorsโ
For JavaScript you can use any CSS font property compliant string. (#RGB, #RGBA, #RRGGBB, #RRGGBBAA, rgb(r,g,b), rgba(r,g,b,a) )
On .net simply construct the Color object to configure your desired color.
- JavaScript
- C#
- Kotlin
resources: RenderingResources = false;RenderingResources Resources { get; set; } = falsevar resources: RenderingResources = falseRenderingResourcesโ
Following resources exist for adjusting the style.
This public class contains central definitions for controlling the visual appearance.
class RenderingResourcesPropertiesโ
barNumberColorโ
The color to use for displaying the bar numbers above the music sheet.
barNumberFontโ
use elementFonts with BarNumber
The font to use for displaying the bar numbers above the music sheet.
barSeparatorColorโ
The color to use for rendering bar separators, the accolade and repeat signs.
copyrightFontโ
use elementFonts with ScoreCopyright
The font to use for displaying the songs copyright information in the header of the music sheet.
defaultFontsโ
The default fonts for notation elements if not specified by the user.
- JavaScript
- C#
- Kotlin
static defaultFonts: Map<NotationElement, Font>;static Map<NotationElement, Font> DefaultFonts { get; set; }companion object { var defaultFonts: alphaTab.collections.Map<NotationElement, Font> }directionsFontโ
use elementFonts with EffectDirections
The font to use for displaying the directions texts.
effectFontโ
use elementFonts with the respective
Ununsed, see deprecation note.
elementFontsโ
The fonts used by individual elements. Check defaultFonts for the elements which have custom fonts.
Removing fonts from this map can lead to unexpected side effects and errors. Only update it with new values.
- JavaScript
- C#
- Kotlin
readonly elementFonts: Map<NotationElement, Font>;Map<NotationElement, Font> ElementFonts { get; }val elementFonts: alphaTab.collections.Map<NotationElement, Font>engravingSettingsโ
The SMuFL Metrics to use for rendering music symbols.
- JavaScript
- C#
- Kotlin
engravingSettings: EngravingSettings = alphaTab;EngravingSettings EngravingSettings { get; set; } = alphaTabvar engravingSettings: EngravingSettings = alphaTabfingeringFontโ
Since 1.7.0 alphaTab uses the glyphs contained in the SMuFL font
Unused, see deprecation note.
fretboardNumberFontโ
use elementFonts with ChordDiagramFretboardNumbers
The font to use for displaying the fretboard numbers in chord diagrams.
graceFontโ
The font to use for grace notation related texts in the music sheet.
inlineFingeringFontโ
Since 1.7.0 alphaTab uses the glyphs contained in the SMuFL font
Unused, see deprecation note.
mainGlyphColorโ
The color to use for music notation elements of the primary voice.
markerFontโ
use elementFonts with EffectMarker
The font to use for section marker labels shown above the music sheet.
numberedNotationFontโ
The font to use for displaying the numbered music notation in the music sheet.
numberedNotationGraceFontโ
The font to use for displaying the grace notes in numbered music notation in the music sheet.
scoreInfoColorโ
The color to use for displaying the song information above the music sheets.
secondaryGlyphColorโ
The color to use for music notation elements of the secondary voices.
staffLineColorโ
The color to use for rendering the lines of staves.
subTitleFontโ
use elementFonts with ScoreSubTitle
The font to use for displaying the songs subtitle in the header of the music sheet.
tablatureFontโ
The font to use for displaying the guitar tablature numbers in the music sheet.
timerFontโ
use elementFonts with EffectBeatTimer
The font to use for displaying beat time information in the music sheet.
titleFontโ
use elementFonts with ScoreTitle
The font to use for displaying the songs title in the header of the music sheet.
wordsFontโ
use elementFonts with ScoreWords
The font to use for displaying the lyrics information in the header of the music sheet.