Closed curran closed 7 years ago
We can use fonts from http://www.smufl.org/fonts/
Should look like the "C" part in this:
SVG font elements here https://github.com/rism-ch/verovio/tree/master/data/Bravura
The mensuration text code "C|" should map to glyph number ܍
(decimal) or 
(hex) in the Bravura font. I Loaded the OTF version into the OS X font folder and browsed the characters from there to find the mensuration sections of the glyphs:
The other mensuration signs found nearby:
mensuration "O." (the capital letter "O" and a period): ܅
or 
(called "Circle dot"):
Then mensuration "O" at ܆
or 
(this is called "Circle")
Then mensuration "O|" at ܇
or 
(this is called "Cut Circle")
The mensuration "O|." at ܈
or 
(this is called "Cut Circle Dot")
The mensuration "C." at ܉
or 
(this is called "C Dot")
Then mensuration "C" at ܊
or 
(this is called "C")
Then mensuration "Cr" at ܋
or &#E916;
(this is called "Reverse C")
Then mensuration "C|." at ܌
or &#E917;
(this is called "Cut C Dot")
Then mensuration "C|" at ܍
or &#E918;
(this is called "Cut C")
Then mensuration "C|r" at ܎
or &#E919;
(this is called "Reverse Cut C")
Then "C.r" which is never used in JRP (at least yet)
Then "O/" which is never used in JRP
Then "O-" which is never used in JRP
Then "C/" which is never used in JRP
Then "C/." which is never used in JRP
Then "C/r" which is never used in JRP
These mensurations should cover 90-95 percent of mensuration signs. There will be some more which are primarily compound-glyph mensurations, mixing these signs with numbers. I will add this week a list of all of the mensuration signs, how often they occur in the data, and sample musical scores which contain the mensuration signs so you can see what they should look like.
Here is the list of mensuration sign glyphs on the SMuFL website:
http://www.smufl.org/version/latest/range/medievalAndRenaissanceProlations
Here is the full list of mensurations used in JRP data along with their SMuFL enumeration codes.
Column meanings in the table below:
(1) The occurrence count for the mensuration (2) The mensuration code (3) An example which which has the mensuration (typically at the beginning of the work)
Using this URL as a template:
http://josquin.stanford.edu/cgi-bin/jrp?a=notationEditText&f=Xxx9999
Replace Xxx9999 with the catalog number in column 3 to view the graphic representation of the mensuration in a PDF of the music.
(4) The SMuFL characters representing the mensuration. The word "over" means that the characters are the first one over the second one. For example, the mensuration code: C|/2 means C| over 2, which graphically looks like this:
When there are two items over a third, the third is typically placed under the second top item: O3/2 which is O next to 3 over 2:
6775 C| Jos2721 
2198 O Jos2405 
1194 C Mar2020 
921 3 Mar3020 
702 C2 Rue1004b 
333 O| Rue1005e 
193 C|3 Rue1007d 
155 O/3 Jap3009 &#e911; over 
139 O2 Jos0401d 
101 C3 Gas2017a 
64 C. Bus1001a 
50 O. Bus1001b 
29 3/2 Jos1903 &#e928; over &#e927;
26 O3 Bru2012 
21 C|2 Ort2004 
17 2 Jos0402e 
13 O3/2 Tin1001c  over 
10 O|3/2 Jos0903b  over 
10 O|3 Jos0406b 
8 C.3/2 Mar2079 㤨 over 
7 Cr Rue1001b 
6 C|/3 Jos0406d &#e918; over 
5 C.| Ock1013e 
4 C|/2 Jos0902d  over 
4 C2/3 Tin1001b &#e927; over 
4 2/1 Tin1001a  over 
3 C|r Bus1001c 
3 C|. Ock1008b 
2 4/3 Tin2001  over 
1 C.3/8 Tin1001e  over 8 (no "8" mensural glyph)
1 6/4 Tin3006 6 over 
1 2/3 Tin2001 &#e927; over 
1 14/18 Tin3006  over 8
Here is some basic info about mensurations:
https://en.wikipedia.org/wiki/Mensural_notation#Mensurations
These are awesome details. Thank you so much @craigsapp for your guidance here.
Closed in #59
Here's what it looks like:
@craigsapp I just want to confirm our understanding - these mensuration symbols will only appear at the beginning of a work, is that correct? Or, might these symbols appear within a work?
We're facing issues where the font is not rendering consistently across systems.
One solution would be to use these SVG versions https://github.com/rism-ch/verovio/tree/master/data/Bravura
FINALLY some progress! It's been an 8-week (non-intensive) effort to figure this out, and I finally have been able to extract and convert the Bravura glyphs into SVGs. (screenshot attached). I'm now creating a sprite sheet for them, so we can use them in the viz.
Please note, these are only symbols E910 through E920
Nice! Curious about your flow for getting/creating these SVGs.
@curran, I'll use these comments to live-document.
I found this post, which led to using this script:
import sys
if len(sys.argv) < 2:
print('Usage: python {} webfont-file.svg')
sys.exit()
with open(sys.argv[1], 'r') as r:
lines = r.read().split('\n')
glyphs = [x for x in lines if '<glyph' in x]
# for every glyph element in the file
for i in range(0, len(glyphs)):
with open(str(i + 1).rjust(3, '0') + '.svg', 'w') as w:
w.write('<?xml version="1.0" standalone="no"?>\n')
w.write('<svg width="1500px" height="1500px" version="1.1" xmlns="http://www.w3.org/2000/svg">\n')
# replace 'glyph' with 'path' and flip vertically
w.write(glyphs[i].replace('<glyph', '<path transform="scale(1, -1) translate(0, -1500)"') + '\n')
w.write('</svg>')
It doesn't quite work right, because that path replacement is blind. I then imported into inkscape, saved it back out to optimized svg, and there they were. (the screenshot, as you can probably tell, is from the inkscape phase).
So, you run that file like: python blah.by css/fonts/Bravura.svg
and it creates numbered svg files (1001.svg, 1002.svg, ad nauseum) I think the behaviour would be better if it named the files according to the glyph name (e918.svg).
Ideally, the output should be a <symbol>
with the viewBox defined. that way, it will automatically scale to fit whatever container it gets <use>
called from.
@seemantk I believe we only need one of those symbols, the one on the right side? If you could share the SVGs that you managed to generate so far, or otherwise share the work so far in a branch/PR, that would be super useful in enabling me to also work on this. Thanks!
@curran, actually the set in use is about 10 symbols, and I've added them in mensurations.svg in the main directory just now.
@craigsapp there are inconsistencies in the symbol names. E917 is coded as both "C|." and "C.|" -- this makes it challenging to handle properly.
Is there a standard naming scheme for these?
This might be a good lead for us:
We can paste in the humdrum files from e.g. https://github.com/josquin-research-project/Jos/tree/540bc4f070e79c119be1abd587303bad04a886f8 into that viewer to get some visual clarity on the mensuration symbols.
Cut-C is 2/2, which is the same as 4/4 with respect to quarter notes. So, if there are 8 "beats" in one measure, therefore one "beat" (unit of time) encoded in the JSON data actually represents an eighth note.
This holds true also for "3", if we assume that 3 means 3/2 (12/8 --> 6/4 --> 3/2).
There are four possible layouts for the symbols:
@seemantk I just realized a way to see the rendered mensuration symbols.
For each mensuration symbol, we can:
Quite tedious but may help.
Thanks @curran! I've been working on the rendering here, and have made progress in terms of rendering the symbols. The current activity is placing them properly. There's a transformation applied to turn them right side up, as well.
Here is an early sampler of the mensuration signs that I made:
http://wiki.ccarh.org/wiki/MuseData_Example:_mensural_signs
(Measures 2 & 4 do not exists in the current JRP data).
I'll create an updated table for the ribbon wiki.
@craigsapp there are inconsistencies in the symbol names. E917 is coded as both "C|." and "C.|" -- this makes it challenging to handle properly.
Is there a standard naming scheme for these?
I would say that C.|
is better than C|.
, so assume the first one, and I will fix data which contains the second one.
Quite tedious but may help.
Yes, that was the idea 😜
So, you run that file like: python blah.by css/fonts/Bravura.svg and it creates numbered svg files (1001.svg, 1002.svg, ad nauseum) I think the behaviour would be better if it named the files according to the glyph name (e918.svg). Ideally, the output should be a
with the viewBox defined. that way, it will automatically scale to fit whatever container it gets
I haven't worked directly with Bravura, but I do work with it indirectly when working with verovio: https://github.com/rism-ch/verovio
So reverse engineering from there:
Extracted Bravura font symbols can be found in this directory: https://github.com/rism-ch/verovio/tree/develop/data/Bravura This contains a subset of the symbols in the font, but there are no mensuration signs...
Here is a sample listing of the font symbols in separate files:
Here is the contents of E909-mensuralCclefPetrucciPosMiddle.xml:
<symbol id="E909" viewBox="0 0 2048 2048" overflow="inherit">
<g transform="scale(1,-1)">
<path d="M51 1638q19 0 19 -34v-971q8 -68 51 -68h248q35 -1 46 19t15 57v465q0 23 6 29q7 6 21 6h18q25 0 25 -35v-2220q0 -23 -6 -29t-19 -6h-26q-19 0 -19 35v485q-8 78 -61 78h-238q-53 0 -61 -78v-975q0 -22 -6 -28t-20 -6h-26q-18 0 -18 34v3208q0 22 6 28t20 6h25z M131 -346h248q43 -1 51 67v54q-5 75 -55 75h-260q-41 -10 -45 -75v-45q8 -76 61 -76zM430 231v78q-14 47 -55 47h-256q-37 0 -49 -47v-73q8 -76 61 -76h248q37 0 47 47q4 16 4 24z"/>
</g>
</symbol>
Which is for the symbol:
(http://www.smufl.org/version/latest/range/medievalAndRenaissanceClefs/)
Notice the scale(1, -1)
which flips the vertical axis. So I am assuming that the source fontfile uses PostScript coordinates (origin at the bottom) rather than SVG (origin at the top).
There is another file containing the font metrics for all of the extracted symbols: https://github.com/rism-ch/verovio/blob/develop/data/Bravura.xml such as for the example symbol:
<?xml version="1.0" encoding="UTF-8"?>
<bounding-boxes font-family="Bravura" units-per-em="2048">
...
<g c="E909" x="0.0" y="-1638.0" w="500.0" h="3276.0" h-a-x="499" />
If you need to extract symbols, note that the source files for the font are in the directory:
https://github.com/rism-ch/verovio/tree/develop/fonts
It seems that the font symbols and font metrics are extracted with XSLT programs:
https://github.com/rism-ch/verovio/tree/master/fonts
No documentation or makefiles, but the generate_all.sh
script seems to do all of the work. It talks about using Oxygen tools:
# Requires saxon9ee and phantomjs
# saxon9ee can be aliased from Oxygen in ~/.bash_profile
# alias saxon9ee="java -jar /Applications/oxygen/lib/saxon9ee.jar"
Oxygen: https://www.oxygenxml.com
I don't have Oxygen and have a low tolerance for XSLT and Java, so I don't know how to extract the desired symbols myself using this system. Some scripts are also using phantomjs: http://phantomjs.org, which seems similar to nodejs.
To extract the glyphs with this system, it seems that you add the code points to the file: https://github.com/rism-ch/verovio/blob/develop/fonts/supported.xsl
And then run the shell script https://github.com/rism-ch/verovio/blob/develop/fonts/generate_all.sh#L31-L33 which in turn extracts the bounding box information from Bravura.svg using the saxon9ee interpreter from Oxygen and the extract-glyphs.xsl style sheet and then a secondary processing with phantomjs using the script generate-bbox.js.
It seems easier to just pull out the code points by hand from the Bravura.svg font file: https://github.com/rism-ch/verovio/blob/develop/fonts/Bravura.svg (which you probably did).
Cut-C is 2/2, which is the same as 4/4 with respect to quarter notes. So, if there are 8 "beats" in one measure, therefore one "beat" (unit of time) encoded in the JSON data actually represents an eighth note. This holds true also for "3", if we assume that 3 means 3/2 (12/8 --> 6/4 --> 3/2).
You won't have to worry about the meaning of the mensuration signs now that the performance time in seconds are provided by the JSON proll data (and their meanings are not necessary for displaying the graphic symbols on the plots).
Cut-C is actually 2/1, which is the same as 8/4 with respect to quarter notes. The JSON proll score times are all in units of quarter notes, so you should notice that the distance between barlines in Cut-C in the proll data is 8 units. Cut-time in modern music notation is a direct descendent of Cut-C, and using modern rhythmic values, it is now equivalent to a 2/2 time signature (which has the same number of quarter notes as 4/4 time signature).
I submitted a pull request for the mensuration documentation which will go to the URL:
http://ribbon.humdrum.org/doc/mensuration-sampler
when it is pulled. It has a graphical sample of each mensuration other than some rare ones that only occur in Tinctoris's music (he was trying to get people to adopt his mensuration notation system, which no one did).
For completeness, here is the sampler:
That seems to cover all questions in this thread.
Closing, now that we are using SVG symbols for each mensuration combination, thanks to @craigsapp
Start from https://github.com/sul-cidr/josquin-ribbon/blob/master/poc/Jos2721-La_Bernardina.json#L15