Fonts & Character SetsCustom kerning

Information and discussion about fonts and character sets (e.g. how to use language specific characters)
Post Reply
Laurentius
Posts: 132
Joined: Wed Feb 11, 2009 11:38 pm

Custom kerning

Post by Laurentius »

Was thinking of doing something like

Code: Select all

\XeTeXinterchartoks f ’ {\kern 2pt}
to modify kerning between f and end quote. can it be done? or perhaps there is a better way? I find that in Adobe Caslon Pro the f extends too much to the right for some of the kernings.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

Custom kerning

Post by cgnieder »

This seems to work:

Code: Select all

\documentclass{article}
\usepackage{fontspec}

\XeTeXinterchartokenstate=1
\newXeTeXintercharclass\fooA
\newXeTeXintercharclass\fooB
\XeTeXcharclass `\f=\fooA
\XeTeXcharclass `\’=\fooB
\XeTeXinterchartoks \fooA \fooB {\kern 2pt}

\begin{document}

\begingroup
  % disable feature for comparison:
  \XeTeXinterchartokenstate=0
  f’
\endgroup

f’

\end{document}

%%% Local Variables: 
%%% coding: utf-8
%%% mode: latex
%%% TeX-engine: xetex
%%% End: 
kerning.png
kerning.png (3.3 KiB) Viewed 7900 times
Best
site moderator & package author
Laurentius
Posts: 132
Joined: Wed Feb 11, 2009 11:38 pm

Re: Custom kerning

Post by Laurentius »

Thanks again, Clemens. I thought about this but wondered if perhaps there were a simpler way. But this works fine.

Lorenz
Post Reply