Rather than tracing the border of a magnified character to find some critical points making the character as follows,
\documentclass[pstricks,border=12pt]{standalone}
\usepackage{pst-text,pst-eucl}
\DeclareFixedFont{\ps}{U}{psy}{m}{n}{12cm}% the symbol font
\DeclareFixedFont{\PS}{T1}{ptm}{m}{n}{11cm}% the times font
\def\x{4}
\psset
{
showpoints=true,
linecolor=red,
PointName=none,
dotscale=0.5,
}
\newpsstyle{gridstyle}
{
subgriddiv=10,
subgridcolor=lightgray,
subgridwidth=0.05pt,
subgriddots=0,
gridcolor=black,
gridwidth=0.1pt,
griddots=0,
gridlabels=5pt,
gridlabelcolor=red,
}
\begin{document}
\begin{pspicture}[showgrid](-\x,\x)(\x,-\x)
\rput(0,0){\pscharpath[linecolor=blue,linewidth=0.1pt]{\PS R}}
\pstGeonode
(-3.483, 3.700){n1}
(-0.800, 3.700){n2}
( 1.260, 3.700){c1}
( 2.340, 3.200){c2}
( 2.340, 1.700){n3}
\psline(n1)(n2)
\psbezier(n2)(c1)(c2)(n3)
\end{pspicture}
\end{document}
I want to extract such points directly from the font file.
Is it possible to do that?
The objective is to recreate such a character to be used for clipping discussed in my previous question How to fill a region bounded by a character and a graphic object with a color?
Best Answer
Here's the steps needed to convert a font character to a PGF path. It works on a Unix-based system (tested on Linux and MacOSX). I don't know if the required programs are available on other systems. The dependencies are FontForge and Perl. The former is fairly important, the latter is just the non-TeX language I know best.
Use FontForge to convert the font to SVG paths. You can do this in FontForge, or simply run the following script on the font file:
x2svg.pe /path/to/font/font.ttf
(ttf
simply for example, FontForge reads everything, save script asx2svg.pe
or change the calling command appropriately).Run the perl script
svgtopgf.pl
on the resulting file. Syntax issvgtopgf.pl font.svg prefix
whereprefix
is to make the resulting stuff unique. This creates a file that defines a load of paths, one for each glyph, and also contains their bounding box information. The paths, and bounding boxes, are labelled according to the decimal unicode number. The path commands are PGF basic layer commands.Then use these macros to define the relevant paths and the rest of the TikZ/PGF code to manipulate them as you wish. At the TeX-SX launchpad there's a PGF library that makes these letters into node shapes.