Skip to content

zongpingding/char2path

Repository files navigation

CTAN Version GitHub Release GitHub Last Commit Actions Status GitHub Repo stars

The char2path Package

The char2path package provides a LaTeX package for converting characters into TikZ paths.

Overview

The package provides the \chartopath and \chartoclip macro

\chartopath [<keys>] {<font>} {<string>}
\chartoclip [<keys>] {<font>} {<character>}

to print TikZ paths for characters in a string.

See char2path.pdf for more. Happy TeXing!

Generate TikZ paths from font

First, install the dependencies. For Windows users:

cd resources/scripts
pip install -r requirements.txt

for Linux users:

cd resources/scripts
pip3 install -r requirements.txt

on macOS, run the following command:

cd resources/scripts
brew install cairo pkg-config
python3 -m pip install -r requirements.txt --break-system-packages

Next, custom your own config.toml, An example configuration is:

[flow]
method = "font2svg"
gensvg = true
extsvg = true
gentkz = true

[font_spec]
folder = "../Fonts/"
name   = "texgyreadventor-regular.otf"
alias  = 'texgyre'

[svg_dir]
folder = "SVGs"
sub_1  = "."
sub_2  = "_moreSVGs_"
caps   = "caps"
small  = "small"
nums   = "nums"
others = "others"

[tkz_data]
folder = "../data"
caps   = "ctp-%ALIAS%-alpha-caps.data.tex"
small  = "ctp-%ALIAS%-alpha-small.data.tex"
nums   = "ctp-%ALIAS%-arabic.data.tex"
others = "ctp-%ALIAS%-others.data.tex"
digits = 3
# coor_x = "+\\ctpXshift"
# coor_y = "+\\ctpYshift"

Command-line arguments take precedence over the TOML file.

usage: font2path [options]

font2path: a tool that converts font into TikZ paths.

options:
  -h, --help           show this help message and exit
  -m, --method         tikz path generating method.
  -s, --string         the string for conversion('fonttools' only).
  -p, --folder         font folder.
  -d, --data           tikz path data folder.
  -a, --alias          font name alias.
  -g, --gensvg (Bool)  'True' to generate SVGs from font.
  -e, --extsvg (Bool)  'True' to extract SVGs from previous run.
  -c, --gentkz (Bool)  'True' to generate tikz path from previous run.
  -q, --quiet (Bool)   'True' to suppress message.
  -f, --font           font name('*.ttf' or '*.otf').

Finally, run the command below:

python font2path.py

Issues

The issue tracker for char2path is currently located on GitHub.

Build status

This project uses GitHub Actions as a hosted continuous integration service. For each commit, the build status is tested using the current release of TeX Live.

Current build status: build status

References

[1] https://www.gust.org.pl/projects/e-foundry/latin-modern/download

[2] https://www.unicode.org/standard/standard.html

Copyright and License

Copyright (C) 2025 by Zongping Ding <zongpingding5@outlook.com> and Mingyu Xia <myhsia@outlook.com>


This package's `lm' data is converted from the Latin Modern family, based on the Computer Modern fonts, which are released into public domain by AMS (1997). It's licensed under The GUS Font License (GFL).

This package's `tg' data is converted from the TeX Gyre fonts, which are being released under The GUS Font License (GFL).


This work may be distributed and/or modified under the conditions of the LaTeX Project Public License (LPPL), either version 1.3c of this license or (at your option) any later version. The latest version of this license is in

http://www.latex-project.org/lppl.txt

and version 1.3c or later is part of all distributions of LaTeX version 2008 or later.

This work has the LPPL maintenance status `maintained'.

The Current Maintainer of this work is Zongping Ding and Mingyu Xia.

About

A LaTeX package that converts characters into TikZ paths

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •