3

I cannot post a comment under my previous question so (i fixed some files because i misunderstood somethings, but there is a problème with tt => fl in sffamily not smallcaps and it seems it cannot do sffamily regular

why do pdflatex have thoses ligatures but they do not work in tex4ebook (lualatex ?)

\documentclass[10pt,a5paper]{book}
\usepackage[utf8]{inputenc}
\usepackage[francais]{babel}
\usepackage[T1]{fontenc}
\usepackage[left=1.5cm,right=1.5cm,top=1.5cm,bottom=1.5cm]{geometry}
\usepackage{libertine}
\newcommand{\testfont}[1]{
rmfamily\\
{\rmfamily #1\\{\scshape #1}\\\\
\textbf{#1\\{\scshape #1}}\\\\
\textit{#1\\{\scshape #1}}\\}

sffamily\\
{\sffamily #1\\{\scshape #1}\\\\
\textbf{#1\\{\scshape #1}}\\\\
\textit{#1\\{\scshape #1}}\\}
}
\begin{document}
\testfont{ff fli ffi ffr tt th qu FF FLI FFI TT TH}
\end{document}

tex4ebook result

tex4ebook

pdflatex result

enter image description here

Problems with ligatures

  • 1
    Please clarify what the issue is. Which ligatures are missing? Do note that the Biolinum sans-serif font (which is loaded by the libertine package) contains fewer f-ligatures than does the Libertine serif font. – Mico Sep 30 '18 at 6:47
  • 1 - tt becomes fl in sffamily not smallcaps 2 - there is not ssfamily medium font The problem is that it gives wrong ligature, 'cette' => 'cfle' in sffamily – herve_02 Sep 30 '18 at 12:02
  • I'm afraid I'm unfamiliar with tex4ebook, even though I'm quite familiar with LuaLaTeX. A thought: Have you tried replacing the instruction \usepackage{libertine} with (a) loading the fontspec package and (b) executing \setmainfont{Linux Libertine O} and \setsansfont{Linux Biolinum O (with suitably chosen options, as needed)? – Mico Sep 30 '18 at 13:35
  • 1
    @Mico the problem is that tex4ht (which tex4ebook uses in the background) uses special files for translation between characters in the tfm file and Unicode. They also contain information about font style, weight, name, etc. These files must be created for each font and the files for Linux Libertine contain wrong mappings between certain ligatures and the output text. – michal.h21 Sep 30 '18 at 14:10
  • 1
    @Mico I don't think Libertine mappings are wrong, they just use some non-usual ligatures that are not present in the T1 fontenc, so wrong are tex4ht support files, which assume that they are in T1. – michal.h21 Sep 30 '18 at 16:39
3

This is result of wrong support files for Libertine fonts in tex4ht. Each used font needs special file with mapping of the character codes in the DVI file to Unicode. The mappings for fonts used in your document expects the standard T1 font encoding, but Libertine fonts use some additional ligatures, so some characters are mapped incorrectly.

The process of creation of the mapping files is quite difficult and error prone. I am working on a tool called Htfgen which can in ideal cases generate the mapping files automatically. It contain lot of scripts and libraries, the most interesting one is called dvitohtf. It can either parse dvi file for the missing map (htf) files, or read list of fonts from the standard input. It then outputs TeX file, which then writes htf files when processed with plain TeX.

This is the TeX file created by this script for all fonts used in your document: mylibertine.tex. I had to put it to a gist, because it is larger than Stackexchange allows in the posts.

Compile it using

tex mylibertine.tex

It should write all necessary HTF file.

Result:

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.