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.


6 Answers 6


Run it with the sequence latex->dvips->ps2pdf. It does not work with xelatex

\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


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 https://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.


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);};


  • I agree on the interest of such a TikZ library.
    – Marcos
    Apr 1, 2015 at 20:02

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


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.

  • 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, 2012 at 5:43
  • here are some examples: tug.org/PSTricks/main.cgi?file=Examples/Text/WriteBig
    – user2478
    Jun 7, 2012 at 6:26

Something similar is possible in ConTeXt with Metafun. I am no expert, so here is just a snippet copy-pasted from the manual.

  draw outlinetext.b ("\bf Funky")
  (withcolor blue)
  (withcolor red withpen pencircle scaled 1/5)
  scaled 3 ;

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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