10

Is there a way to use kpfonts with fontspec ?

The math font is correctly used but just loading the kpfonts package is not enough for the text. If I add the \setmainfont line (see example) the kp font is used everywhere but bold text is not bold. If I add the \fontencoding line (see example) it is used correctly in the text (including bold) but not for the section titles (either regular kp font or bold computer modern font whether the other line is present or not). I don't really know what this line does (saw it somewhere on the internet).

Here is my minimal (non)working example:

\documentclass[article,a4paper,oneside]{memoir}
\usepackage{kpfonts}
\usepackage{fontspec}

\setmainfont[ExternalLocation]{jkpmn8a.pfb}

\begin{document}
\fontencoding{T1}\fontfamily{jkp}\selectfont

\section{section}
\section{other section}
\subsection{my subsection}

bla bla bla. \textbf{bold}
$v_t : \mathbb{R}^3 \rightarrow \mathbb{R}^3 $

\end{document}
Corentin
  • 9,981

1 Answers1

8

with XeLaTeX use:

\documentclass[article,a4paper,oneside]{memoir}
\usepackage{fontspec}
\usepackage[T1]{fontenc}
\usepackage{kpfonts}

\begin{document}    
\section{section}
\section{other section}
\subsection{my subsection}

bla bla bla. \textbf{bold}
$v_t : \mathbb{R}^3 \rightarrow \mathbb{R}^3 $

\fontspec{Garamond Premier Pro}
foo bar öäöä

\end{document}

then you'll get the embedded KP fonts:

herbert@shania:~/Dokumente> pdffonts test.pdf
name                          type              encoding         emb sub uni object ID
----------------------------- ----------------- ---------------- --- --- --- ---------
TKCZXS+Kp-Medium              Type 1C           WinAnsi          yes yes no       4  0
DRXZLW+Kp-Regular             Type 1C           WinAnsi          yes yes no       5  0
YKPDIX+Kp--M-Italic           Type 1C           Builtin          yes yes no       6  0
YASURJ+Kp--M-Syb-Regular      Type 1C           Builtin          yes yes no       7  0
DVMGXE+Kp--M-Sy-Regular       Type 1C           Builtin          yes yes no       8  0
QMYVMX+GaramondPremrPro-Identity-H   CID Type 0C Identity-H  yes yes yes 10  0