3
$\begingroup$

Style[\[WhiteKnight], FontFamily -> "Segoe UI Symbol"]

The output I'm getting looks like it is in the Mathematica.ttf font, not the designated Segoe UI Symbol font. How can I get the character displayed in the font I have chosen?

$\endgroup$
5
  • $\begingroup$ I guess it's just a crazy symbol which does not exist in other fonts $\endgroup$ Commented Sep 30, 2015 at 3:25
  • $\begingroup$ when an unicode character like [WhiteKnight] both exists in the Mathematica font and Segoe UI Symbol font, Mathematica use its own to render. How can I force it to use the Segoe UI Symbol font? $\endgroup$ Commented Sep 30, 2015 at 4:28
  • $\begingroup$ Are you on Win10? See Google, and note only if the Font is installed the font will be rendered correctly, See also Export to PDF on OS X, font missing on Windows $\endgroup$
    – user9660
    Commented Sep 30, 2015 at 5:55
  • $\begingroup$ Win 7 here. I don't know whats up but that font doesn't work properly even manually applying font format in a text cell ( Yes its installed and displays fine in office . Unicode 9816 is a glyph of a train in Segoe UI Symbol in Word ) $\endgroup$
    – george2079
    Commented Sep 30, 2015 at 14:41
  • $\begingroup$ MemberQ[$FontFamilies, "Segoe UI Symbol"] -> True $\endgroup$
    – george2079
    Commented Sep 30, 2015 at 14:46

1 Answer 1

4
$\begingroup$

Yes, Mathematica forces to display some usual characters into Mathematica font only. This is the case of your \[WhiteKnight]:

Style[\[WhiteKnight], FontFamily -> "Apple Symbols", FontSize -> 40]

enter image description here

I clearly have a different \[WhiteKnight] symbol available in my "Apple Symbols" system font but it is not displayed here above.

Actually I found some nice solutions in these posts: wrong-font-selection-for-some-characters-in-mathematica-10-for-linux and how-to-write-plain-greek-in-a-text-cell

As I have Mathematica version >= 10.0, i followed @DBM / @AlexeyBobrick well explained instructions and I am now able to get the "correct" display:

enter image description here

To do the same you'll have to know the character code of your symbol, which is given by:

ToCharacterCode @ ToString @ \[WhiteKnight]

{9816}

Automated "fix" for v>=10

In case, you have version >=10.0 and don't want to fix the problem manually, I wrote an automated version:

1. Check first if the system file "FontMap.tr" exists:

fontmapfile = FileNames["FontMap.tr", $InstallationDirectory, Infinity] // First
/Applications/Mathematica.app/Contents/SystemFiles/FrontEnd/\
TextResources/FontMap.tr

If the command fails and does not return a file path as above, STOP here (there might be some different approach for your system).

2. If the file exists, you can modify it automatically this way (it should be safe, as you can see i backup the original file and don't modify it)

backupfile = fontmapfile <> ".BKUP";
backupfile // If[Not@FileExistsQ[#], CopyFile[fontmapfile, #]] &;
ToExpression@Import[backupfile] /. {9816 -> Sequence[]} // Compress // 
  Export[fontmapfile, "CompressedData[\"" <> ToString@# <> "\"]", 
    "String"] &;

(If you want to include other symbols, you'll just have to add their code to the list {9816 -> Nothing})

3. That's it. Quit and Restart mathematica and you should now be able to display your symbol(s).

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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