TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have worked with Illustrator and CorelDraw and I usually take fonts and convert them to curves after which I would fill in the curves with patterns, merge them with other vectors or the sort. Is it possible to do this in LaTeX. To some extent is like changing the color of the fonts but these would have to probably be zoomed for the pattern to be obvious.

If this is possible can it then the vector format be translated into TikZ or pstricks to facilitate the fill. An example of this would be appreciated.

share|improve this question
PSTricks can get the outlines from Type1 fonts via pst-text package. Or you can use Asymptote for better control. TikZ has no such ability. See also tex.stackexchange.com/questions/21548 – Leo Liu Jun 7 '12 at 4:04
Without access to the paths of each character, you can use fadings like in tex.stackexchange.com/a/63174/14500 – Paul Gaborit Jul 24 '12 at 8:34
up vote 17 down vote accepted

Run it with the sequence latex->dvips->ps2pdf

\DeclareFixedFont{\pi}{U}{psy}{m}{n}{4mm}% the symbol font
\DeclareFixedFont{\ps}{U}{psy}{m}{n}{12cm}% the symbol font
\DeclareFixedFont{\PS}{T1}{ptm}{m}{n}{5cm}% the times font

\psboxfill{\black\Large\pi p}

    addfillstyle=boxfill,fillangle=20,fillsep=1mm,fillloopaddx=10]{\ps p}}
  \pscharpath[fillstyle=solid,fillcolor=red!40]{\PS Pi}}


enter image description here

share|improve this answer

TikZ/PGF has no direct access to the font shapes, but once it has been told the paths then it can work with them in exactly the same way as any other path. So whilst PSTricks is probably the better choice if you have a completely free choice, then if you're already using TikZ/PGF in your document you may prefer to use this method even though it is slightly more complicated.

The general idea is to convert a font to PGF paths. This is done via a combination of fontforge and some scripts. It has to be done once for each font, but obviously once it's been done then the results can be cached and reused without that overhead. I've done the conversion for the STIX fonts and the scripts I used are available on the TeX-SX Launchpad Site. Also there are some ideas for a TikZ library to make use of the paths in a "natural" way. If you download pgflibraryletter.shapes.dtx and run tex on it then the following code will work:

  load font={stikz}{normal},
  load encoding=char,

\node[draw,fill=blue!40,letter=π] (pi) {};
\node[draw,fill=red!40,letter=P,right of previous letter,] (P) at (pi.east) {};
\node[draw,fill=red!40,letter=i,right of previous letter,] (i) at (P.east) {};

and produce the following picture:

TikZ letter shapes

This is by no means stable code - and I've found that doing complicated stuff (such as complicated decorations) on the paths quickly exhausts TeX's limits. It can do kerning, but not ligatures (well, you can always insert them manually but it won't automatically convert them).

This started out life in response to the question that Leo Liu linked to: Outlining (filling) glyph outline with text in TikZ and was also used in http://tex.stackexchange.com/a/51462/86. Contrary to the impression given in some of the comments on the first of these, the paths are faithful representations of the font glyphs in that cubic beziers are used at every stage of the process.

share|improve this answer

While it is true that tikz has no access to glyph paths, the PDF format allows stroking and clipping (besides filling) with text paths; cf. the use of \pdfliteral in the example below. 2 Tr means "fill, then stroke", and 5 Tr means "stroke text and add to clipping path". The most usual text rendering mode, which is simply filling glyphs, is activated with 0 Tr.

An interface to this functionality would make a nice tikz library...


  \path (0,0) node {
         \pdfliteral{2 Tr} %Needs pdfTeX

  \path (0,-1) node {
         \pdfliteral{5 Tr}
         \tikz[trim left,baseline=1mm]
         \shade[upper left=red,upper right=green,lower left=blue,lower right=yellow]
         (0,0) rectangle (-20mm, 7mm);};


share|improve this answer
I agree on the interest of such a TikZ library. – Marcos Apr 1 '15 at 20:02

The pstricks pst-text package offers some functionalities in that direction. I am not aware of anything equivalent with TikZ since it looks like by definition, TikZ has no access to the spline definition of fonts. Anyway, as you said, it is still possible to export text as splines from your preferred application and subsequently use these splines within pstricks or TikZ to perform what you want. To this end, you may want to have a look at the eps2pgf graphic package [for TikZ] and maybe the pst-verb command [for pstricks].

Unfortunately, all these merging commands (union, intersection, subtraction...) are quite involved and will not be available directly in LateX since they require some complicated operations I guess.

share|improve this answer
Could you maybe give an example of some working code to use with pst-text? It looks like that package is the right way to go, but I couldn't get it to work (with the examples from the documentation). – JohnReed Jun 7 '12 at 5:43
here are some examples: tug.org/PSTricks/main.cgi?file=Examples/Text/WriteBig – Herbert Jun 7 '12 at 6:26

A simple solution with only tikz :


\node[scale=20, transparent!0] at (0,0) {\bfseries A};

\node[scale=20] at (0,0) {\bfseries A};
\path[path fading=A,fill=red,draw=blue,fit fading=false] (0,0) circle (2);
\path[draw=blue] (0,0) circle (2);

It doesn't not, however, convert the letter into a path (no stroke), but allow you to use it as a clipping path !

enter image description here

share|improve this answer
Yes. It's the same way as tex.stackexchange.com/a/63174/14500. – Paul Gaborit Jul 24 '12 at 8:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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