Working through the text the font handling in Cello I find that it meshes well with Core Text. The extent of what I am currently doing requires me to create CTFonts and get glyph curves. This is very similar to some early work I was doing in Cello and as I progress a few modest functions into my Core Text support there is an opportunity to share code.
If you have not used Core Text before it is a little different in terminology - the CTFont is a little more akin to a style than I am accustomed to and carries bit more information than say an ATSUI font (ATSUI will be deprecated in Snow Leopard). For example a CTFont has an idea of size and transformation matrix. Deploying this is not rocket science and it is more a question of jumping through the hoops.
I am unit testing the functions that I write as I add them - also I am taking he opportunity to fill in a few gaps in work that did earlier. For example I have written a simple test for the retrieval of kerning tables. To have any kind of stability unit testing can't depend on fonts on your machine - these can and do vary across system releases. Relying on fonts that are installed on a particular machine is just as fraught.
As a solution I am embedding the few fonts I use in unit test into the test bundle, as I have done with GIFs, PNGs and JPEGs in earlier tests as covered in an earlier post here. At the start of a given test I can activate them using ATSFontActivateFromFileReference, and deactivate them afterwards using ATSFontDeactivate. This means that I can write tests that depend on particular fonts.
Note ATSFontActivateFromFileReference will be deprecated in Snow Leopard - however there is no Core Text function currently available that will activate fonts.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment