0

When is use this code

\documentclass{amsart}

\usepackage{calligra,lipsum}
\usepackage[T1]{fontenc}

\DeclareRobustCommand{\normalfont}{\calligra}
\AtBeginDocument{\normalfont}

\title{A title}
\author{An author}

\begin{document}

\maketitle

\section{A section}
\lipsum[1]

\end{document}

everything goes fine, but when i try

\documentclass{book}
\usepackage{titlesec}
\usepackage{titling}
\usepackage{xunicode}
\usepackage{fontspec}
\usepackage{xltxtra}
\usepackage[T1]{fontenc}

\newfontfamily\headingfont[]{Calligra}
\titleformat{\chapter}[display]
  {\huge\headingfont}{\chaptertitlename\ \thechapter}{20pt}{\Huge}
\titleformat*{\section}{\LARGE\headingfont}
\titleformat*{\subsection}{\Large\headingfont}
\renewcommand{\maketitlehooka}{\headingfont}

\begin{document}

\chapter{First Chapter}

The title above does not show any font.

\end{document} 

I get fontspec error: "font-not-found" The font "Calligra" cannot be found. I am using XeLaTex.

alfred
  • 607
  • Yes the package is installed and works fine in the first example. – alfred Oct 13 '17 at 23:50
  • Please see the answer to the duplicate above... Other type of fonts are used in each case. (See the last comment in the answer too for a solution) – koleygr Oct 13 '17 at 23:53
  • I read the other post but cant follow it. Should I install FontForge ? – alfred Oct 14 '17 at 00:01
  • I used FontForge to generate a ttf and installed it, but the result isnt pretty. Characters arent recognized etc. Is it possible to modify the second code and still the LaTeX version of the font ? – alfred Oct 14 '17 at 00:14
  • I am looking here and found out I have available this command on my debian: https://ctan.org/tex-archive/fonts/calligra-type1/ But didn't manage to do something with it... I will look for a solution for some more time. – koleygr Oct 14 '17 at 00:24
  • It works. Should I delete the question ? Or is there an answer to get out of this – alfred Oct 14 '17 at 00:33
  • 1
    Just answer your question with the final way you found. I don't really know it. May be the question will be marked as a duplicate but it will be useful for other users because there is not a real step by step (I mean final) solution on the other post – koleygr Oct 14 '17 at 00:36
  • Redefining \normalfont doesn’t seem a good idea. – egreg Oct 14 '17 at 06:47
  • never use \usepackage[T1]{fontenc} in xetex, and you do not want tfm or type1 versions of the font either, so it isn't clear what you are doing with fontforge, – David Carlisle Oct 14 '17 at 08:40
  • It's not recommended to load xltxtra these days either and only load xunicode if you need it – David Carlisle Oct 14 '17 at 08:43
  • It's a code I took from another question, all I wanted was changing the chapter font. – alfred Oct 14 '17 at 09:11
  • The question was marked as a duplicate and I cant add an answer now. Dommage. For the second code example, fonts had to be installed in the system (via a .ttf file in windows for example). To do this Calligra could be converted using FontForge, as mentioned in the other question, using this as a source https://ctan.org/tex-archive/fonts/calligra-type1/ (link provided by koleygr) – alfred Oct 14 '17 at 10:28
  • In my case the font was installed as CALLIG15 in the system, so it should be called with \newfontfamily\headingfont[]{CLLIG15} – alfred Oct 14 '17 at 10:55

0 Answers0