9

I'm trying to write some text in german and spanish using babel and the font calligra. I have found out that when it comes to the "ß" character, the outputs is actually "e" (see words in red). Is there any way to include or define a calligraphic form of this "ß" character, that is not "ss"? I wouldn't want the readers to think that some words were misspelled.

A minimal working example is shown below:

\documentclass[10pt,final]{article}
 \usepackage[utf8]{inputenc}
 \usepackage[T1]{fontenc}
\usepackage[paperwidth=21cm, paperheight=10.5cm, top=4mm, left=8mm, right=8mm, bottom=4mm]{geometry}
\usepackage{fontspec}
\usepackage[german,spanish]{babel}
\usepackage{tikz}
\usepackage{pgothic}
\usepackage{calligra}
\usepackage{graphicx}

\usepackage{yfonts}
\usepackage[protrusion]{microtype}


\begin{document}
\calligra


\selectlanguage{german}{
Weit hinten, hinter den Wortbergen, fern der Länder Vokalien und Konsonantien leben die Blindtexte. Abgeschieden wohnen Sie in 
Buchstabhausen an der Küste des Semantik, eines {\color{red}{großen}} Sprachozeans. Ein kleines Bächlein namens Duden {\color{red}{fließt}} 
durch ihren Ort und versorgt 
sie mit den nötigen Regelialien.}

\vspace{\baselineskip}
\selectlanguage{spanish}{Bendito el varón que se fía 
en jehová, y cuya confianza es jehová. porque él será como el árbol plantado junto a las aguas, que junto a la 
corriente echará sus raíces, y no verá cuando viniere el calor, sino que su hoja estará verde; y en el año de sequía no se fatigará, ni 
dejará de hacer fruto.}
\end{document}
2
  • Your claim that the output is actually "e" under XeLaTeX and LuaLaTeX isn't quite correct. What's happening is, rather, that the ß glyph isn't produced at all.
    – Mico
    Nov 20, 2016 at 18:53
  • Are you sure that you want to use \usepackage[T1]{fontenc} with xetex or luatex (it means hyphenation would be wrong with xetex for example) Nov 20, 2016 at 19:12

3 Answers 3

11

Package inputenc is deactivated with recent LaTeX:

Package inputenc Warning: inputenc package ignored with utf8 based engines.

Therefore, ß is not active and mapped to \ss. It directly addresses the slot of the font callig15.pfb that is encoded in T1 font encoding. However, the position of ß in Unicode and T1 differs, the former is 223 (U+00DF), the latter is 255 (0xFF). At position 223, font Calligra does not have a glyph, therefore the missing sharp s.

Workaround: The sharp s can be made active:

\documentclass[10pt,final]{article}
 \usepackage[T1]{fontenc}
\usepackage[
  paperwidth=21cm, paperheight=10.5cm,
  top=4mm, left=8mm, right=8mm, bottom=4mm]{geometry}
\usepackage{fontspec}
\usepackage[german,spanish]{babel}
\usepackage{calligra}
\usepackage[protrusion]{microtype}

\catcode`\ß=\active
\defß{\ss}

\begin{document}
\calligra

\selectlanguage{german}{
Ein {\color{red}{großer}} Sprachozean.
Das Bächlein Duden {\color{red}{fließt}} durch ihren Ort.}
\end{document}

Result

Generate and use OpenType font

The copyright of the font callig15.pfb:

Copyright 1992 Peter Vanroose, 1999 S. Dachian You may freely use, modify and/or distribute this file, as long as this copyright notice is retained

Therefore, it should be allowed to generate the font in OpenType format with the fix for the width of ß. Package calligra redefines \ss to append a \kern-.22em.

This can be done with FontForge, either interactively or by a small Python script:

#!/usr/bin/env python

import fontforge

font = fontforge.open('callig15.pfb')
glyph = font['germandbls']
glyph.width -= .22 * font.em

font.generate('callig15.otf')

The generated font callig15.otf can be stored in the current directory or a TDS location. Example for TeX Live and shell bash:

export TDS=`kpsewhich -expand-var \\$TEXMFLOCAL`
echo $TDS
mkdir -p $TDS/fonts/opentype/public/calligra
cp callig15.pfb $TDS/fonts/opentype/public/calligra/
mktexlsr $TDS

Then the font can be used with LuaTeX/XeTeX. It is scaled as in package calligra. Because the scaling also affects the inter word space, it is reversed for the space.

\documentclass[10pt,final]{article}
\usepackage{fontspec}
\usepackage{color}
\usepackage[protrusion]{microtype}

\newfontface\calligra{CALLIG15}[Scale=1.44, WordSpace=.7]

\begin{document}
\calligra

Ein {\color{red}{großer}} Sprachozean.
Das Bächlein Duden {\color{red}{fließt}} durch ihren Ort.

\end{document}

Result

5

You can use \newunicodechar so to map ß to \ss, which in turn will be mapped to the right glyph.

\documentclass{article}

\usepackage{fontspec}
\usepackage[german,spanish]{babel}

\usepackage{xcolor}
\usepackage{calligra}
\usepackage{newunicodechar}

\newunicodechar{ß}{\ss}

\begin{document}
\begin{otherlanguage*}{german}
Weit hinten, hinter den Wortbergen, fern der Länder Vokalien 
und Konsonantien leben die Blindtexte. Abgeschieden wohnen Sie in 
Buchstabhausen an der Küste des Semantik, eines \textcolor{red}{großen} 
Sprachozeans. Ein kleines Bächlein namens Duden \textcolor{red}{fließt} 
durch ihren Ort und versorgt sie mit den nötigen Regelialien.
\end{otherlanguage*}

\bigskip

Bendito el varón que se fía en jehová, y cuya confianza es jehová. 
porque él será como el árbol plantado junto a las aguas, que junto a la 
corriente echará sus raíces, y no verá cuando viniere el calor, sino 
que su hoja estará verde; y en el año de sequía no se fatigará, ni 
dejará de hacer fruto.

\bigskip

\calligra

\begin{otherlanguage*}{german}
Weit hinten, hinter den Wortbergen, fern der Länder Vokalien 
und Konsonantien leben die Blindtexte. Abgeschieden wohnen Sie in 
Buchstabhausen an der Küste des Semantik, eines \textcolor{red}{großen} 
Sprachozeans. Ein kleines Bächlein namens Duden \textcolor{red}{fließt} 
durch ihren Ort und versorgt sie mit den nötigen Regelialien.
\end{otherlanguage*}

\bigskip

Bendito el varón que se fía en jehová, y cuya confianza es jehová. 
porque él será como el árbol plantado junto a las aguas, que junto a la 
corriente echará sus raíces, y no verá cuando viniere el calor, sino 
que su hoja estará verde; y en el año de sequía no se fatigará, ni 
dejará de hacer fruto.

\end{document}

enter image description here

You seem to believe that \selectlanguage{german} takes the German text as a braced argument: it's not true. I fixed the usage.

0
3

It appears that the calligra font package handles both \ss and ß correctly under pdfLaTeX but not under either XeLaTeX or LuaLaTeX. More specifically, the ß isn't produced at all.

If you need to use either XeLaTeX or LuaLaTeX along with the calligra package, I suggest you replace all instances of ß with \ss{}.

enter image description here

\documentclass[10pt,final]{article}
\usepackage{ifluatex,ifxetex}
\ifluatex
  \usepackage{fontspec}
\else
  \ifxetex
    \usepackage{fontspec}
  \else
    \usepackage[utf8]{inputenc}
    \usepackage[T1]{fontenc}
\fi\fi
\usepackage[paperwidth=21cm, paperheight=10.5cm, 
            vmargin=4mm, hmargin=8mm]{geometry}
\usepackage[german]{babel}
\usepackage{xcolor}
\usepackage{calligra}
\usepackage[protrusion]{microtype}

\begin{document}
\calligra
\textrm{LuaLaTeX and XeLaTeX produce:}

\textcolor{red}{gro\ss en} \textcolor{red}{flie\ss t} 

\textcolor{blue}{großen} \textcolor{blue}{fließt}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .