Sign up ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Without knowing anything about fonts, I innocently read an article on Postscript/Truetype Bezier curves.

The first picture in the article shows the letter Q, and it's Bezier control points. I'd like to look at more letters (also greek letters) and their Bezier construction.

I therefore installed the program fontforge and loaded a letter from the computer modern font (I belive) in /usr/share/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb


This visualization is perhaps technically useful, but not very pleasing. So, I wonder, could it be done inside TeX? Maybe using TikZ controls function: enter image description here.

Clarification for this option: The letter can be drawn with TikZ as well, but I'm more interested in a nice visualization of the control points.

It surely isn't easy, as the font is stored in a binary format. Perhaps it can be converted?


  • @g.kov shows a nice visualization using Asymptote.
  • I modified Andrew Stacy's script from this question, and am quite happy with it. See below.
share|improve this question
oops: related or duplicate?… –  Sebastian May 18 '14 at 15:00

3 Answers 3

up vote 19 down vote accepted

enter image description here

Control points of a glyph path(s) can be extracted with texpath() function in Asymptote:

// glyph.asy :
import fontsize;


real wd=0.6bp;
pen dotPen=deepblue+wd;
pen dotFill=dotPen;

pen dotPenB=blue+wd;
pen dotPenC=red+wd;

pen linePen=deepblue+wd;
pen fillPen=lightgreen+opacity(0.1);

pen thinLinePen=black+wd/2;

guide[] g;



pair a,b,c,d;
pair labdir;
int pointNo=0;

for(int i=0;i<g.length;++i){
  for(int j=0;j<size(g[i])-1;++j){
    label("$\scriptsize "+string(pointNo)+"$",a,labdir);
  label("$\scriptsize "+string(pointNo)+"$",d,labdir);

To get glyph.pdf, run:

asy -f pdf glyph.asy
share|improve this answer

After modifying Andrew's script, I get:

enter image description here omega percent sign letter g

How to do it:

  1. fontforge script font2svg.fontforge

    #! /usr/bin/env fontforge
    Generate($1:t:r + ".svg")
  2. running (chmod +x font2svg.fontforge)

    ./font2svg.fontforge /usr/share/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb

    Puts a file cmr10.svg into your folder. E.g. letter 'Omega':

    <glyph glyph-name="Omega" unicode="&#x2126;" horiz-adv-x="722"              
    d="M677 162l-33 -162h-159c-23 0 -26 0 -26 21c0 69 32 159 47 201c29 82 56 158 56 233c0 156 -106 228 -202 228c-91 0 -201 -68 -201 -228c0 -75 28 -154 49 -212c23 -64 54 -152 54 -222c0 -21 -3 -21 -25 -21h-160l-33 162h25c5 -25 10 -51 18 -74c5 -15 8 -23 66 -23
    h80c-13 56 -45 104 -89 170c-47 71 -88 140 -88 219c0 137 133 251 305 251c169 0 304 -112 304 -251c0 -79 -41 -148 -88 -219c-45 -66 -76 -114 -89 -170h80c58 0 61 8 66 24c9 24 13 47 18 73h25z" />

    Nice, these are the path specifications.

  3. Running the modified script

    ./ crm10.svg tmpstr

    My changes to Andrew's. It now writes (for each glyph), three files

    • chars/gly_<prefix>N, where N is the decimal unicode number. This file contains the glyph path (almost identical output of original script).
    • chars/bezier_<prefix>N containing the bezier control handles. TikZ 3.0 arrows.
    • chars/pts_<prefix>N containing all the points on the glyph outline (not used)
  4. Then, drawing a new glyph is as easy as including them in a tex file:

    \usepackage{tikz} % loads xcolor
    %Percent sign
share|improve this answer
BTW, you can use the SVG path data directly in PGF/TikZ; see the manual for SVG-Path Library. –  morbusg May 22 '14 at 14:37

Metapost also lets you do this, using the glyph operator.

enter image description here

This was produced by the glyph visualization program from section 9 of the MP manual, changed to show an Ω from "cmr10", and shown below.

The names of the fonts are those defined in the relevant map file (usually and the names of the glyphs are the usual PostScript names (see Appendix E of the PS Language Reference Manual for a list).

prologues := 3;
outputtemplate := "%j%c.eps";

  picture q;
  path p;
  interim ahlength := 9bp;
  interim ahangle := 25;
  q := glyph "Omega" of "cmr10" scaled .2;
  for item within q:
    p := pathpart item;
    drawarrow p withcolor (.6,.9,.6) withpen pencircle scaled 1.5;
    for j=0 upto length p:
      pickup pencircle scaled .7;
      draw (point j of p -- precontrol  j of p) dashed evenly withcolor blue;
      draw (point j of p -- postcontrol j of p) dashed evenly withcolor blue;
      pickup pencircle scaled 3;
      draw precontrol j of p withcolor red;
      draw postcontrol j of p withcolor red;
      pickup pencircle scaled 2;
      draw point j of p withcolor black;
share|improve this answer

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.