Bug no fontenc (ou libertino)?

Bug no fontenc (ou libertino)?

Estou trabalhando em um livro com aprox. Mais de 200 páginas A5. No processo de migração do pdflatex para o xelatex notei algumas diferenças sérias de layout. Em um esforço para rastrear o problema, comecei a seguir o MWE para pdflatex.

\documentclass[paper=a5,pagesize,fontsize=13pt]{scrbook}
\usepackage{showframe}
\usepackage[T1]{fontenc}
\usepackage[osf]{libertine}

\begin{document}
Hello, here is some text without a meaning. This text
should show what a printed text will look like at this place.
\end{document}

Se

\usepackage[T1]{fontenc}

estiver em vigor, a primeira linha do texto termina com "Este texto". Se comentado, termina com "Este texto deveria" também produzindo uma caixa cheia demais.

Responder1

A diferença se deve

AT1:

.\OT1/LinuxLibertineT-TOsF/m/n/13 i
.\OT1/LinuxLibertineT-TOsF/m/n/13 n
.\OT1/LinuxLibertineT-TOsF/m/n/13 g
.\OT1/LinuxLibertineT-TOsF/m/n/13 .
.\glue 3.7921 plus 4.875 minus 0.36096
.\OT1/LinuxLibertineT-TOsF/m/n/13  (ligature Th)
.\OT1/LinuxLibertineT-TOsF/m/n/13 i
.\OT1/LinuxLibertineT-TOsF/m/n/13 s
.\glue 3.25 plus 1.625 minus 1.08289
.\OT1/LinuxLibertineT-TOsF/m/n/13 t
.\OT1/LinuxLibertineT-TOsF/m/n/13 e
.\kern-0.091
.\OT1/LinuxLibertineT-TOsF/m/n/13 x
.\OT1/LinuxLibertineT-TOsF/m/n/13 t

T1:

....\T1/LinuxLibertineT-TOsF/m/n/13 i
....\T1/LinuxLibertineT-TOsF/m/n/13 n
....\T1/LinuxLibertineT-TOsF/m/n/13 g
....\T1/LinuxLibertineT-TOsF/m/n/13 .
....\glue 3.7921 plus 4.875 minus 0.36096
....\T1/LinuxLibertineT-TOsF/m/n/13 T
....\T1/LinuxLibertineT-TOsF/m/n/13 h
....\T1/LinuxLibertineT-TOsF/m/n/13 i
....\T1/LinuxLibertineT-TOsF/m/n/13 s
....\glue 3.25 plus 1.625 minus 1.08289
....\T1/LinuxLibertineT-TOsF/m/n/13 t
....\T1/LinuxLibertineT-TOsF/m/n/13 e
....\kern-0.091
....\T1/LinuxLibertineT-TOsF/m/n/13 x
....\T1/LinuxLibertineT-TOsF/m/n/13 t

isto é, a fonte OT1 possui uma ligadura Th que não está presente na fonte T1. Isso é um tanto surpreendente, mas não necessariamente um bug. Depois disso, os comprimentos das palavras são fracionadamente diferentes, o que é suficiente para fazer com que o separador de linha do parágrafo siga um caminho diferente.

Você poderia evitar a ligadura como

\documentclass[paper=a5,pagesize,fontsize=13pt]{scrbook}
\usepackage{showframe}
%\usepackage[T1]{fontenc}
\usepackage[osf]{libertine}

%\showoutput

\begin{document}
Hello, here is some text without a meaning. T{}his text
should show what a printed text will look like at this place.
\end{document}

Responder2

Você pode desativar a temida ligadura Th nas fontes OT1 carregando microtypee emitindo

\DisableLigatures[T]{encoding=OT1}

mas isso tem a desvantagem de que o kerning contra T também está desabilitado, como mostra o exemplo a seguir.

\documentclass[paper=a5,pagesize,fontsize=13pt]{scrbook}
\usepackage{showframe}
\usepackage[T1]{fontenc}
\usepackage[osf]{libertine}

\usepackage{microtype}
\DisableLigatures[T]{encoding=OT1}

\begin{document}

\fontencoding{OT1}\selectfont

Hello, here is some text without a meaning. This text
should show what a printed text will look like at this place.

To

\fontencoding{T1}\selectfont

Hello, here is some text without a meaning. This text
should show what a printed text will look like at this place.

To

\end{document}

insira a descrição da imagem aqui

Portanto, não há solução real para o seu problema. Você poderia pedir ao mantenedor do libertinepacote para adicionar uma opção para desabilitar a ligadura Th na codificação OT1 (é necessário um novo conjunto de fontes virtuais). Na minha opinião, isso seria ummuitobom recurso, pois acho a ligadura realmente horrível.

informação relacionada