9

I would like to use the Alegreya font in a document that features several diacritic symbols from eastern European languages. Whith xelatex everything works fine, but I would like to use pdftex, and this is where I experience a problem: With pdftex most common accents are displayed well, but in some cases there is an extremely large vertical distance between the letter and the diacritic sign. I see this effect with the breve (\u) on lower case and upper case letters, and with the caron/hacek (\v) and circumflex (\^) only on uppercase letters. Below you find an example that will show my problem. It is a list of names of eastern European composers:

\documentclass{scrbook}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{Alegreya}
\usepackage[english,ngerman]{babel}

\begin{document}

Rodion \^{S}edrin

\u{U}ladz\`{i}m\`{i}r Damarackij

V\^{a}\v{c}\`{e}sla\u{u} Kuzn\^{a}co\u{u} 

\end{document}

Do you know if this is a weakness of the Alegreya font with pdftex or if there is a way to fix it?

enter image description here

egreg
  • 1,121,712
Stephan
  • 93

2 Answers2

14

The parameters in the font metric file for the Alegreya font are wrong; the x-height (stored in \fontdimen5) is too small as the following test file shows. Some accents are placed correctly, because in the T1 encoding they're precomposed; the problem shows only when the accented letter is not precomposed and TeX's method (based on \fontdimen5) must be used.

\documentclass{scrbook}
\usepackage[T1]{fontenc}
\usepackage{Alegreya}

\begin{document}

The x-height: \expandafter\texttt\expandafter{\the\fontdimen5\font}

The height of `x': \expandafter\texttt\expandafter{\the\fontcharht\font`x}

\fontdimen5\font=\fontcharht\font`x

Rodion \^{S}edrin

\u{U}ladz\`{i}m\`{i}r Damarackij

V\^{a}\v{c}\`{e}sla\u{u} Kuzn\^{a}co\u{u}

\end{document}

(the \expandafter tokens are just for pretty printing the value of the parameter using the current font before \texttt changes it).

enter image description here

In the test file I change the x-height to a more sensible value and you can see that the result is correct.

You should file a bug report. For the moment you can work around the issue with the following hack:

\documentclass{scrbook}
\usepackage[T1]{fontenc}

%%%%% ADD THIS TO YOUR PREAMBLE BEFORE LOADING Alegreya
\DeclareFontFamily{T1}{Alegreya-LF}{}
\newcommand{\adjustalegreya}{\fontdimen5\font=\fontcharht\font`x }

\makeatletter
\let\Alegreya@@scale\@empty
%%% uncomment the next line if you want to scale the font,
%%% changing the value to what suits you
% \def\Alegreya@@scale{s*[0.9]}%
\makeatother

\DeclareFontShape{T1}{Alegreya-LF}{k}{n}{
      <-> \Alegreya@@scale Alegreya-Black-lf-t1
}{\adjustalegreya}

\DeclareFontShape{T1}{Alegreya-LF}{k}{it}{
      <-> \Alegreya@@scale Alegreya-BlackItalic-lf-t1
}{\adjustalegreya}

\DeclareFontShape{T1}{Alegreya-LF}{k}{sl}{
      <-> ssub * Alegreya-LF/k/it
}{\adjustalegreya}

\DeclareFontShape{T1}{Alegreya-LF}{b}{n}{
      <-> \Alegreya@@scale Alegreya-Bold-lf-t1
}{\adjustalegreya}

\DeclareFontShape{T1}{Alegreya-LF}{b}{it}{
      <-> \Alegreya@@scale Alegreya-BoldItalic-lf-t1
}{\adjustalegreya}

\DeclareFontShape{T1}{Alegreya-LF}{b}{sl}{
      <-> ssub * Alegreya-LF/b/it
}{\adjustalegreya}

\DeclareFontShape{T1}{Alegreya-LF}{m}{n}{
      <-> \Alegreya@@scale Alegreya-Regular-lf-t1
}{\adjustalegreya}

\DeclareFontShape{T1}{Alegreya-LF}{m}{it}{
      <-> \Alegreya@@scale Alegreya-Italic-lf-t1
}{\adjustalegreya}

\DeclareFontShape{T1}{Alegreya-LF}{m}{sl}{
      <-> ssub * Alegreya-LF/m/it
}{\adjustalegreya}

\DeclareFontShape{T1}{Alegreya-LF}{bx}{sl}{
      <-> ssub * Alegreya-LF/b/sl
}{\adjustalegreya}

\DeclareFontShape{T1}{Alegreya-LF}{bx}{n}{
      <-> ssub * Alegreya-LF/b/n
}{\adjustalegreya}

\DeclareFontShape{T1}{Alegreya-LF}{bx}{it}{
      <-> ssub * Alegreya-LF/b/it
}{\adjustalegreya}

%%%% NOW YOU CAN SAFELY LOAD Alegreya (don't pass a scale option)
\usepackage{Alegreya}

\begin{document}

The x-height: \expandafter\texttt\expandafter{\the\fontdimen5\font}

The height of `x': \expandafter\texttt\expandafter{\the\fontcharht\font`x}

Rodion \^{S}edrin

\u{U}ladz\`{i}m\`{i}r Damarackij

V\^{a}\v{c}\`{e}sla\u{u} Kuzn\^{a}co\u{u} 

\footnotesize

The x-height: \expandafter\texttt\expandafter{\the\fontdimen5\font}

The height of `x': \expandafter\texttt\expandafter{\the\fontcharht\font`x}

Rodion \^{S}edrin

\u{U}ladz\`{i}m\`{i}r Damarackij

V\^{a}\v{c}\`{e}sla\u{u} Kuzn\^{a}co\u{u} 

\end{document}

enter image description here

Update

The version of Alegreya released on 2014-05-18 seems to have solved the problem. Here's the original test, without any addition except for repeating the same text in the four main styles.

enter image description here

egreg
  • 1,121,712
1

TeXLive also has the OpenType version:

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Alegreya SC}
\setsansfont{Alegreya Sans SC}
\begin{document}
The x-height: \expandafter\texttt\expandafter{\the\fontdimen5\font}\\
The height of `x': \expandafter\texttt\expandafter{\the\fontcharht\font`x}\\
Rodion \^{S}edrin\\
\u{U}ladz\`{i}m\`{i}r Damarackij\\
V\^{a}\v{c}\`{e}sla\u{u} Kuzn\^{a}co\u{u} \\

\footnotesize
The x-height: \expandafter\texttt\expandafter{\the\fontdimen5\font}\\
The height of `x': \expandafter\texttt\expandafter{\the\fontcharht\font`x}\\
Rodion \^{S}edrin\\
\u{U}ladz\`{i}m\`{i}r Damarackij\\
V\^{a}\v{c}\`{e}sla\u{u} Kuzn\^{a}co\u{u} 

\sffamily\normalsize
The x-height: \expandafter\texttt\expandafter{\the\fontdimen5\font}\\
The height of `x': \expandafter\texttt\expandafter{\the\fontcharht\font`x}\\
Rodion \^{S}edrin\\
\u{U}ladz\`{i}m\`{i}r Damarackij\\
V\^{a}\v{c}\`{e}sla\u{u} Kuzn\^{a}co\u{u} \\

\footnotesize
The x-height: \expandafter\texttt\expandafter{\the\fontdimen5\font}\\
The height of `x': \expandafter\texttt\expandafter{\the\fontcharht\font`x}\\
Rodion \^{S}edrin\\
\u{U}ladz\`{i}m\`{i}r Damarackij\\
V\^{a}\v{c}\`{e}sla\u{u} Kuzn\^{a}co\u{u} 
\end{document}

enter image description here