I'm trying to prepare some plots for publication using Mathematica 14.1. Although I give Mathematica the FontFamily->"Arial" option repeatedly in my code, it continues to use MathematicaSans and/or MathematicaSans-Bold fonts in the output. When I save the plots as PDF and then open in Adobe Illustrator, it gives a missing font error and prompts for replacement of these fonts. How can I force Mathematica to use Arial, Arial Bold, etc.? I'm not using any glyphs in my plots that aren't available in the Arial font family, so why is Mathematica picking a proprietary font?
Below is a pared-down example to demonstrate the issue (my actual plots source their data from an Excel spreadsheet instead of the Table commands in this toy example):
commonOptions[yaxisname_, aspectRatio_, imageSize_, imagePadding_,
axesFontSize_, legendFontSize_, legendPosition_,
dataLabels_] := {PlotRange -> {All, All},
AspectRatio -> aspectRatio, ImageSize -> imageSize,
ImagePadding -> imagePadding,
BaseStyle -> {FontSize[10], FontFamily -> "Arial"},
TicksStyle -> {FontFamily -> "Arial"},
PlotStyle -> {{Black,
Directive[FontFamily -> "Arial"]}, {GrayLevel[0.7], Dashed,
Directive[FontFamily -> "Arial"]}},
PlotLegends ->
Placed[LineLegend[
Text@Style[#, Bold, legendFontSize, FontFamily -> "Arial"] & /@
dataLabels, LegendFunction -> Framed], legendPosition],
Frame -> True,
LabelStyle ->
Directive[AbsoluteThickness[1.0], FontSize -> axesFontSize,
FontFamily -> "Arial"], AxesOrigin -> {0, 0},
FrameLabel -> {Text@
Style["Time (min)", Bold, axesFontSize, FontFamily -> "Arial"],
Text@Style[yaxisname, Bold, axesFontSize,
FontFamily -> "Arial"]}};
aspectRatio = 1;
imageSize = 300;
imagePadding = {{60, 20}, {55, 20}};
titleFontSize = 24;
axesFontSize = 18;
legendFontSize = 14;
firstPlot =
ListLinePlot[{Table[Sin[t], {t, 0, 2*Pi}],
Table[Sin[0.98*t] + 0.1, {t, 0, 2*Pi}]
}, commonOptions["y-axis", aspectRatio, imageSize, imagePadding,
axesFontSize,
legendFontSize, {0.3, 0.25}, {"Data 1", "Data 2"}]];
secondPlot =
ListLinePlot[{Table[Cos[t], {t, 0, 2*Pi}],
Table[Cos[0.934*t] - 0.02, {t, 0, 2*Pi}]
}, commonOptions["y-axis", aspectRatio, imageSize, imagePadding,
axesFontSize, legendFontSize, {0.6, 0.8}, {"Data 1", "Data 2"}]];
Labeled[GraphicsGrid[{{firstPlot, secondPlot}}, ImageSize -> 800,
Frame -> All, Alignment -> {Right, Bottom}, Spacings -> {20, 20}],
Style["Signals vs. Time", Bold, titleFontSize,
FontFamily -> "Arial"], Top, FrameMargins -> Tiny]
If I right-click on this graphic, pick "Save Graphic As...", and save it as a PDF, when I open the PDF in Illustrator, I get the missing font problem.
Below is a screenshot of what I see when opening the PDF in Adobe Illustrator:


PlotStyleis used for styling the plot itself (i.e., color of curve or points, shape of points, dashing, etc.). I useBaseStyle -> {FontSize[10], FontFamily -> "Arial"}as one of the options inPlot. This tends to work for me. Then, instead of using "Save Graphic As...", I export the plot programatically with something likeExport["MyPlot.pdf", plot], whereplotis the plot. $\endgroup$Export[]. Maybe there's a workaround:ImportString[ ExportString[Style["-1.0", FontFamily -> "Arial"], "PDF"], "FormattedText"] // InputForm$\endgroup$Labeledwhich is wrapped around the plots. I was able to use the workarounds for a plain plot but once it is insideLabeledit will not work. i.e. the Mathematica fonts are added. $\endgroup$