# How can some eastern European diacritics be correctly displayed with the Alegreya font and pdftex?

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?

-

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\fontx}

\fontdimen5\font=\fontcharht\fontx

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).

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}

\DeclareFontFamily{T1}{Alegreya-LF}{}

\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

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

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

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

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

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

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

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

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

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

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

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

%%%% 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\fontx}

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\fontx}

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}


# 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.

-

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\fontx}\\
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\fontx}\\
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\fontx}\\
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\fontx}\\
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}


-