In my opinion you don't have many options here and honestly, I would not try to achieve this with Mathematica and Linux because the font-rendering was, is and will at least for some time be crappy. In the examples, I use the "Liberation Serif" which is the default serif font on my system.
Let me give some ideas: The easiest thing I know is to use FontTracking
to widen the characters.
ImportString@
ExportString[
Style["Русский", FontFamily -> "Liberation Serif",
FontSize -> 50, FontTracking -> "Wide"], "PDF"] //
First // Framed
As you see the "y" is still touching the "P" and "Wide" is the maximal possible setting to this option. This brought me to my second idea where you adjust the low-level boxes to make the spacing right. Basically it works like that:
You split your string into characters and Riffle
and invisible space between each character. This invisible space is wrapped in an AdjustmentBox
where you have the option to set margins to all directions.
An outer StyleBox
takes all your options for FontSize
and so on. To see the spacing even to the left, right, bottom and top of the string, I used a FrameBox
ImportString@
ExportString[
FrameBox@
StyleBox[
RowBox[Riffle[Characters["Русский"],
AdjustmentBox["\[InvisibleSpace]",
BoxMargins -> {{0.15, 0}, {1, 1.5}}], {2, -1, 2}]],
FontFamily -> "Liberation Serif", FontWeight -> Plain,
FontSize -> 50] // DisplayForm, "PDF"] // First
How to implement the method 1
Try first the easy way which is to select appropriate fonts and setting the FontTracking
to "Wide". This is more fiddling than a science but what I basically tried was the following. I created two text-cells with the same content. I leave the first one as it is and adjust the second to try what changes. If you find settings which are acceptable, you can transfer them into a stylesheet and use it.
So here is my test-environment. Create a new document from within a notebook, this will make saving the pdf and looking at the result much easier:
nb = CreateDocument[];
Button["SAVE ME!",
Export["/home/oliviaWild/Desktop/cyrillicTest.pdf", nb]]
Create 3 text-cells, where the first and the second one contain the same cyrillic text and the last one maybe an upper-case (see ToUpperCase
) English text for comparison.
First thing is, to set the font manually by marking the second cell and using Format->Font. Then save the document and check in you pdf viewer, whether the font is embedded (in evince, File->Properties->Fonts). I used DejaVu Serif
and get the following font properties in the pdf viewer
See, that the default text-cells use Times
which could not be embedded since it is not installed.
Go again in the second text cell and press Ctrl
+Shift
+E
. You can append the FontTracking option there
е).\\>","Text",
CellChangeTimes->{3.5602729176824493`*^9},
FontFamily->"DejaVu Serif",FontTracking->"Wide"]
Press Ctrl
+Shift
+E
again and see the pdf. Like this you can play with all settings, either by marking the cell and use the *Format` menu or by adding the appropriat option directly in the cell expression.
When you are finished, you can store this in a style-sheet by using Format->Edit Stylesheet and selecting Text under "Choose a style". Click on this text cell, press Ctrl
+Shift
+E
and add the font options at the end:
Cell[StyleData["Text"],FontFamily->"DejaVu Serif",FontTracking->"Wide"]
Press Ctrl
+Shift
+E
and store the stylesheet.
How to implement the method 2
This is more work and I don't have time to investigate in this right now but what you basically have to do is to implement a function which transforms your text into this low-level box style. For some words Mathematica is doing this automatically. Make to text-cells, in the first you type "Latex is nice", in the other "LaTeX is nice". Look at the underlying expressions and you see that the word "LaTeX" was transformed in the same way I did above.