dpidirect2ddirectwrite

DirectWrite'ing glyphs such that the em square has a specific size


I'm working on an application that renders music notation. The musical symbol are specified in regular font files, which use the convention that the height of the em square corresponds to the height of a regular five-line staff of music. For example, the glyph for a note head is approximately 0.25 em high, the distance between two lines of the staff.

When it comes to rendering, I use a coordinate system in which 4 units corresponds to the height of a five-line staff of music. Therefore, I need to render glyphs such that the em square ends up rendered 4 units high. However DirectWrite only allows specifying text size in device independent pixels (DIPs) and I'm confused about how to juggle between the coordinate systems. There are two parts to this:

And for good measure:


Solution

  • After some more experimentation and research, I have come to the following conclusions.

    I was unable to find information about the effect of arbitrary transformations on font hinting, however.