Matlab and Inkscape, Times New Roman fonts on Mac OS

6 ビュー (過去 30 日間)
Daniel Golden
Daniel Golden 2012 年 5 月 31 日
移動済み: Walter Roberson 2023 年 2 月 19 日
I was having a problem with Matlab fonts for quite a while and wasn't able to find a solution on the Internet. I eventually managed to solve the problem on my own, so I'm posting the problem and solution here in the hopes that it will help others.
I'm using Matlab R2012a and Inkscape 0.48.2 on Mac OS X 10.7 Lion. I make figures for scientific journal publications by exporting PDFs from Matlab and importing them into Inkscape for finer control over layout, etc. I like using the Times New Roman font in Matlab, so I usually use it in my figures by executing the following Matlab command after I make the figure:
set(findall(gca, '-Property', 'FontName'), 'FontName', 'Times New Roman');
I save to PDF via the Matlab command:
print -dpdf ~/path/to/file.pdf
When I then import the PDF file into Inkscape via File -> Import, the font is not rendered correctly; it's called "Times" (not Times New Roman) and it appears as a mis-kerned Arial. I do have a font named "Times" installed (as well as a different font named "Times New Roman"), which comes with the Mac. I can see the Times font via OS X's Font Book, but Inkscape doesn't appear able to render it correctly, possibly because Times is a "dfont" file.
The solution is to extract the TTF fonts from Times.dfont via the program "fondu" (available via macports) and put them in the ~/.fonts folder. This can be done in the terminal as follows:
# First install fondu via macports (www.macports.org)
sudo port install fondu
# Then extract and install the Times font in ~/.fonts
mkdir ~/Desktop/times
cd ~/Desktop/times
cp /System/Library/Fonts/Times.dfont .
fondu Times.dfont
mkdir ~/.fonts
cp *.ttf ~/.fonts
rm -rf ~/Desktop/times
Then, when restarting Inkscape and XQuartz, the Times font will render correctly when importing the Matlab PDF into Inkscape.

採用された回答

Daniel Golden
Daniel Golden 2013 年 11 月 1 日
編集済み: Daniel Golden 2013 年 11 月 1 日
The solution is in the question, so this post is a dummy answer that I can accept to close the issue.
  2 件のコメント
Willy
Willy 2013 年 8 月 16 日
移動済み: Walter Roberson 2023 年 2 月 19 日
Thanks a lot for posting the solution to this issue! I had the exact same problem. Very clearly and nicely explained!
Ben Watson
Ben Watson 2021 年 11 月 28 日
移動済み: Walter Roberson 2023 年 2 月 19 日
Thanks,that what I need

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with MATLAB についてさらに検索

製品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by