Re: Postscipt fonts in graphics
- To: mathgroup at smc.vnet.net
- Subject: [mg68639] Re: Postscipt fonts in graphics
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Mon, 14 Aug 2006 06:44:10 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <ebmtqg$6kh$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Diamond, Mark wrote: > I have two questions related to fonts in graphics. First, I have a number of > postscript fonts installed. They appear as one would expect in the > Mathematica menu under Format->Font, and also, if I use something like > > txt = StyleForm["Hello World", FontSize -> 36, FontFamily -> "AmazingFont", > FontWeight -> "Ordinary"] > then the output appears correctly (i.e., it looks right, having the correct > font) as the display value for txt. Furthermore, if I simply embrace this in > Text[] such as > > Text[txt, {0,0}] > > the output shows > > Text[Hello World, {0,0}] > > again with the text of "Hello World" being displayed within the Notebook in > AmazingFont. But when I put that Text[] into a graphic, > > Show[Graphics[Text[txt,{0,0}]]] > > the font is now substituted with Helvetica. I have used Ctrl-E to examine > the postscript of the graphic, which confirms the Helvetica. What am I doing > wrong, and please, how can I correct it? > > The second question is a repeat of one which appeared many years ago on the > newsgroup (1992?) but received no reply at the time. It is this. Can one > interrogate the font metrics from within Mathematica so that one can > discover the dimensions of, say, the letter "i" in Helvetica font 14 point. > > Cheers, > > Mark R. Diamond > > > Hi Mark, What system/platform do you use? On my system (Windows XP SP2, Intel Pentium IV, Mathematica 5.2), the following code works like a charm: txt= StyleForm[ "Hello World", FontSize->36, FontFamily->"Garamond", FontWeight->"Bold"] Text[txt, {0, 0}] Show[Graphics[Text[txt, {0, 0}]]] Looking at the Postscript code, the correct font is here: [...] %%IncludeResource: font Garamond-Bold %%IncludeFont: Garamond-Bold /Garamond-Bold findfont 36.000 scalefont [1 0 0 -1 0 0 ] makefont setfont 0.000 0.000 0.000 setrgbcolor (Hello) show 157.563 28.563 moveto (World) show [...] Regards, Jean-Marc