I am trying to draw some musical notes using the Bravura font from http://blog.steinberg.net/2013/05/introducing-bravura-music-font/ using core text functions.
A metadata json file accompanying this font has an "attach" coordinate in em unit fractions for where stems should be attached to certain musical notes. This attachment point is relative to a bounding box around the note glyph again with the dimensions in fractions of em unit.
My crude ASCII picture shows the attach point of the stem to the musical note:
|
|
|
/---\* <- attach point here
| |
\---/
From wikipedia: "An em is a unit of width in the field of typography, equal to the currently specified point size. For example, one em in a 16-point typeface is 16 points wide. Therefore, this unit is the same for all typefaces at a given point size."
I would like to use the Core Text
function CTFontDrawGlyphs
which takes a coordinate in pixels to use for the glyph placement.
I would also like to use the Core Graphics functions CGContextMoveToPoint
, CGContextAddLineToPoint
to draw the stems that attach to the musical note glyphs.
I'm a bit unclear how to go from a coordinate in em unit fractions to a particular coordinate in pixels for a glyph of a particular point size so that I can accurately place these stems to the musical note glyph.
I hope I have made my question clear.
Thanks for any help