MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Postscipt fonts in graphics

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", 
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


  • Prev by Date: Re: a Quaternion quadratic level Pisot polynomial
  • Next by Date: Hadamard -Sylvester Matrix Self-Similarity by substitution and reparatitioning
  • Previous by thread: Sequences from chemical structures as Hadamard self-similar matrices
  • Next by thread: Re: Postscipt fonts in graphics