![a proof of concept](https://i.stack.imgur.com/wk3vY.png)
A preliminary version: a proof of concept
{Fanfare} I'm so excited when writing these lines that I cannot even breathe (I'm feeling well, doctor, I'm really fine). :-) Well, it's a big TeX moment for me, you are a part of it!
I was reading Letterpress effect through PSTricks or Tikz where I've noticed that Andrew Stacey converted some STIX fonts to TikZ paths/curves somehow - I'm not sure if the source codes were OTF/PFB files or some other source files (PL, VPL, WFF, EOT, perhaps?). Maybe svgtopgf.pl script from http://bazaar.launchpad.net/~tex-sx/tex-sx/development/files/170 has been used (I've tried some random SVG picture and it wasn't working well for me). It's hard to guess without further research, but it works!
In the meantime, I've read in this question Outlining (filling) glyph outline with text in TikZ that all the major graphics engines (Metapost, PSTricks, Asymptote) should be able to load glyphs at the curve level. I'm not sure about TikZ, but it can load SVG paths, it might help.
Let's get back to our minimal working example.
Step 1: Downloading the fonts converted to paths
I've downloaded two files, pgflibraryshapes.letters.dtx
and
stikz-normal-paths.tex, to my working directory.
Step 2: Installing dtx file (it includes support TeX files)
I've processed/installed the first file by running this line once:
tex pgflibraryshapes.letters.dtx
Step 3: Running an example and using it
We can run any major LaTeX engine, e.g.
lualatex mal-letters.tex
This is the content of the TeX file:
% run: any major LaTeX engine mal-letters.tex
% Based on and inspired by:
% https://tex.stackexchange.com/q/62570/86
\documentclass{article}
\pagestyle{empty}
\usepackage{tikz}
\usetikzlibrary{shapes.letters}
\addtolength{\textheight}{2in}
%\usetikzlibrary{fadings} % I am cutting down the example to bare minimum...
%\usetikzlibrary{shadows.blur}
\usetikzlibrary{intersections}
\pgfkeys{
/pgf/letter/.cd,
load font={stikz}{normal},
size=4,
load encoding=char,
every letter/.append style={
fill, draw=red, line width=1pt,
},
}% End of \pgfkeys...
\makeatletter
\tikzset{
use letter path/.code={%
\pgfscope
\pgftransformscale{\letter@size}%
\letter@path{\letter@encode{#1}}%
\endpgfscope
}% end of use letter...
}% end of \tikzset...
\makeatother
\begin{document}
%\newcount\malrotate
%\malrotate=-10
%\loop
%\advance\malrotate by 10
\foreach \malrotate in {0,10,...,180} {% 45 0,10,...,180
\begin{tikzpicture}
\begin{scope}[xshift=20mm, yshift=-7mm, rotate=\malrotate]
\path[name path global=first, use letter path=T, fill=red];
% draw=green, line width=1pt,
\end{scope}
\begin{scope}[yshift=6mm, xshift=2mm, rotate=-\malrotate]
\path[name path global=second, use letter path=B, fill=blue, opacity=0.4];
% draw=green, line width=1pt,
\end{scope}
\fill[name intersections={of=first and second, name=i, total=\t}] [black]
\ifnum\t>0%
node{%
%\pgfmathparse{\t}%
%\global\let\mtotal=\pgfmathresult
\typeout{Number of intersection points: \t}%
}%
\foreach \s in {1,...,\t} {%
(i-\s) circle (1pt) node[above]{\footnotesize\s}%
}%
\else
node{\typeout{There are no intersection points!}}%
\fi;
%\typeout{Number of intersection points: \t};
\end{tikzpicture} %
}% End of \foreach...
%\ifnum\malrotate<180\repeat
\end{document}
The good news is that it's working, the bad news is that we are getting an incorrect number of intersection points when the picture is drawn within a cycle (\foreach
or \loop
...\repeat
), so there might be a bug (when using name path global
? Or maybe there is a problem in the support files? I don't know at the moment.). The very first and the very last message are correct for sure.
Number of intersection points: 4
Number of intersection points: 9
Number of intersection points: 20
Number of intersection points: 32
Number of intersection points: 19
Number of intersection points: 17
Number of intersection points: 23
Number of intersection points: 15
Number of intersection points: 13
Number of intersection points: 10
Number of intersection points: 16
Number of intersection points: 19
Number of intersection points: 17
Number of intersection points: 26
Number of intersection points: 19
Number of intersection points: 24
Number of intersection points: 19
Number of intersection points: 7
There are no intersection points!
This example loads two glyphs and names them. It transforms them with the help of the scope environments as it cannot be done directly in \path
command as far as I can say (although I haven't tested the cm
parameter, yet). Then we find intersection points and use them (see some more examples and settings in the TikZ manual, search for intersections
library).
If we draw one picture at a time, the number of points is correct.
Well, there is a lot of work ahead (converting some other fonts, setting up and testing optimization with different parameters on real examples), but this is the core.
I know about practical tasks where I'm going to need it soon for sure:
- a background picture consisting of touching glyphs for the forthcoming conference proceedings cover, it should be an improved version to this example How to differentiate glyphs by script (semi-)automatically?,
- a glyph inside a glyph which are inside another glyph..., e.g., letter T inside letter A and both inside letter B, and,
- putting some words inside an arrow with some specific whitespace reserve around the terms (that's a common case of the word clouds) as an advertisement for local theatre play.
I enclose a preview of that page and a closeup shot with some additional settings.
![mwe, full page](https://i.stack.imgur.com/6DINQ.png)
![mwe, closeup shot](https://i.stack.imgur.com/mLqwQ.png)
Best Answer
I was finally able to get my book printed by the company. Since multiple iterations of sending documents back and forth was out of the question, I changed two things at the same time, so it is unfortunately not possible to determine which of those changes was responsible.
Using an evaluation version of Callas pdfToolbox, I ran the same font check that the company did. No problems were flagged, so the problem was not due to XeLaTeX, but must have resulted from their manipulations of the PDF file (they added crop marks, for example).
This is what resulted in properly printed books:
exscale
package, as cfr suggested.