[OS X TeX] Computer Modern in a Mac program

Doug McKenna doug at mathemaesthetics.com
Sat Oct 27 23:04:46 EDT 2012


This isn't quite a direct TeX question, but I was hoping somebody 
familiar with Mac innards and TeX fonts might know the answer.  It's 
about (I think) making Computer Modern fonts available to other Mac 
software.

In a Mac program I'm working on, I'm trying to draw a mathematical sigma 
summation glyph to the screen.  So I thought I'd try to reproduce exactly 
the summation sign used in TeX (MacOS 10.6, TeXLive 2010 via TeXShop) and 
its Compuer Modern typeface, as this font has a long history of being a 
good one for math.

The character code for the glyph is (hex) "58, as I found in some font 
encoding documentation for the math extension font whose metrics are kept 
in "cmex10.tfm".

Using plaintex/pdftex, I ran a source file containing the display:

$$\sum$$

The job's log file then says that the font used was "cmex10.pfb" (found 
down in the ./amsfonts/cm/ folder in my ./texlive/ tree).  Not knowing 
what this was, I soon researched it to find that it's a PostScript Font 
Binary file, presumably glyph definitions that parallel the metric 
information in "cmex10.tfm".

I'm not using LaTeX, so there's none of the extra layers of font encoding 
that complicates things even more.  So that means that pdftex is somehow 
directly converting the internal origal reference to "cmex10.tfm" 
(presumably preloaded by plaintex) into a "cmex10.pfb" file reference.

Well, my Mac font system doesn't know about this file, and doesn't know 
about ".pfb" files either.  I tried putting a copy of this file into my 
~/Library/Fonts/ folder, but FontBook didn't show any change.

So using a web utility that I found, I (allegedly) converted a copy of 
the "cmex10.pfb" file into an OpenType font file, "cmex10.otf", and then 
dropped it into my ~/Library/Fonts folder.  Just to be sure, I rebooted.  
Re-opening FontBook then showed a new entry for "Computer Modern", with a 
style of "Medium".  It reported no errors verifying the font.  The 
information internally said its official name was "CMEX10", the language 
"Greek", etc.  But the Fontbook window showed only about 10 or so glyphs, 
one of which is the summation/sigma glyph.

My conundrum is that even though it's now visible to FontBook and 
presumably the rest of the Mac's tools and APIs, I don't know how to 
access that font and glyph from my Mac program.  I've tried to change the 
current font in Core Graphics using the differing names "Computer 
Modern", "Computer Modern-Medium" and "CMEX10", but to no avail.  The CG 
function doesn't find the font, so it chooses some default font, where 
the glyph found for "58 is the usual ASCII 'X' character.  It then draws 
an 'X' in my program's window.  Not what I want.

There's just too much stuff going on silently in various places under the 
hood to be able to know what step I've missed or otherwise what to do.  
It's gotta be something simple, right?

Any elucidation and/or advices would be appreciated.  Thanks.


Doug McKenna




More information about the MacOSX-TeX mailing list