Closed SteelWagstaff closed 4 years ago
More details from Andre:
the fonts used are the ones listed here:
https://github.com/andremount/musictheorytutorial
There are a variety of reasons I need to import these fonts. In some cases, the imported font is just to get a clean looking circumflex above a digit. In most cases, though, they're being used throughout the book inside CSS pseudo elements to replace ASCII characters.
Here's an example of what I'm doing:
Bb major
I want that to show up like:
The HTML for this would be:
<span class="nowrap">B<span class="theorysymbol accidentalFlat"></span><span class="visuallyhidden">b</span></span> major
The lowercase "b" in "Bb major" is preceded by an empty element which is styled to include a ::before pseudo element. The content of the pseudo element is the character code for the flat symbol in the imported font. Here's the CSS:
.theorysymbol {
font-family: BravuraText;
}
.accidentalFlat::before {
font-size: 2em;
position: relative;
top: 0.25em;
padding-left: 0.02em;
padding-right: 0.01em;
display: inline-block;
line-height: 0.5em;
content: "\E260";
}
The "b" is wrapped in tags and hidden by the CSS:
.visuallyhidden {
position: absolute;
overflow: hidden;
clip: rect(0 0 0 0);
height: 1px;
width: 1px;
margin: -1px;
padding: 0;
border: 0;
left: 614px;
}
There are several reasons for doing it this way:
A network manager writes:
This particular author would also like to use BravuraTextFiguredBass: https://github.com/andremount/musictheorytutorial
Our preferred method would be to add support for 'Musical Notation' as a script/language and make the BravuraText available when it has been selected in a book.