# How one can programmatically transform a text into Gothic, DoubleStruck, or something similar?

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?

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]


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]


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

• 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]. 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. 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? Mar 26 '12 at 17:14
• 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 Mar 26 '12 at 17:42
• By the way, you can get a list of all available fonts in Mathematica with FEEvaluate[FEPrivateGetPopupList["MenuListFonts"]] Mar 26 '12 at 18:05