Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

In the pieces of text created programmatically I would like to be able to fix that the text is done in one of the styles available in the special characters palette, such as Gothic. It may be useful in preparation of a demonstration or making a title of say, a panel and so on. Is it possible?

share|improve this question

1 Answer 1

Edit:

Quoting from Heike´s comment: "The font families used for Greek, script, gothic, and double struck symbols are respectively "Mathematica1", "Mathematica5", "Mathematica6", and "Mathematica7" "

With this knowledge, just use Styletogether with the FontFamily option:

Style["Doth this help?", FontFamily -> "Mathematica6", 
      FontSize -> 100]

Mathematica graphics

Now for my first version, which seems like prime obfuscation. The one benefit is that characters that are not in the special fonts do not get replaced. So I´ll leave this for purely educational purposes:

text = "Hello world!";

gothic = StringReplace[
   text, {x_?UpperCaseQ :> 
     ToString @ ToExpression["\\[GothicCapital" <> x <> "]"],
          x_?LowerCaseQ :> 
     ToString @ ToExpression["\\[Gothic" <> ToUpperCase[x] <> "]"]}];

Style[gothic, 30]

Mathematica graphics

You can get the right prefixes for this solution by looking at the FullForm of your favorite special character (here: Gothic or GothicCapital).

share|improve this answer
6  
I don't have much to add to Yves' solution except that the font families used for Greek, script, gothic, and double struck symbols are respectively "Mathematica1", "Mathematica5", "Mathematica6", and "Mathematica7", so so to get double struck text you can do something like Style["This is some text", FontFamily -> "Mathematica7", FontSize -> 30]. –  Heike Mar 26 '12 at 16:02
    
Knowing that now, the first part of my answer looks a bit silly (but I did warn). I' d say your comment should be elevated to answer status. –  Yves Klett Mar 26 '12 at 16:28
    
@Heike I added your comment to the answer. Hope that is all right. And while I´m at it: Is there a way to get a characters font programmatically? –  Yves Klett Mar 26 '12 at 17:14
2  
Yes that's fine. I don't know how to get a font of a character programmatically I'm afraid. I found the corresponding fonts in the file UnicodeFontMapping.tr located in $InstallationDirectory/SystemFiles/FrontEnd/TextResources –  Heike Mar 26 '12 at 17:42
4  
By the way, you can get a list of all available fonts in Mathematica with FE`Evaluate[FEPrivate`GetPopupList["MenuListFonts"]] –  Heike Mar 26 '12 at 18:05

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.