7

One well known problem with using the font Linux Libertine (presumably other fonts too), is that its many ligatures are not recognized in the resulting pdf-file, so that it's not possible to search for or copy a ligature such as 'Th'.

One way of fixing this is addressed in the question Make ligatures in Linux Libertine copyable (and searchable)

But the fix addressed there doesn't work with XeTeX. Compiling Ulrike's MWE will only result in an error message

> Undefined control sequence.
l.7 \pdfglyphtounicode

So what is the best fix for XeTeX?

  • I don't see any problem with fluffier soufflé fisticuffs flair; the \pdfglyphtounicode trick is for pdftex. – egreg Apr 23 '13 at 20:15
  • 3
    Putting ligatures in PUA is problematic, they should be ununcoded with names following Adobe Glyph Naming convention, so it is definitely a font issue (calling it a bug is too strong, the font is perfectly valid nevertheless). – Khaled Hosny Apr 23 '13 at 21:05
  • 4
    @Sverre: Is far as I know you can't do anything on the xe(la)tex side. xetex can't manipulate the glyph names. (There is a similar problem with oldstyle numbers). Write the maintainers of the fonts. They should adjust the fonts so that they follow the conventions mentioned by Khaled. – Ulrike Fischer Apr 24 '13 at 12:34
  • 1
    @egreg: If the glyphs are encoded even if in PUA (which is the case here) the code values is used and the name will be ignored. The glyphs need to be removed from PUA and be no assigned any Unicode values at all. – Khaled Hosny Apr 24 '13 at 19:01
  • 1
    It seems like doncherry reported a similar bug before? Cf. sourceforge.net/tracker/…. Where it says "Resolution: None", although I must admit I don't understand the answer to the bug report. – Sverre Apr 24 '13 at 19:14
7

XeTeX simply doesn't support the \pdfglyphtounicode primitive, so this route is not available. To understand why, remember that pdfTeX is 8-bit while XeTeX is natively UTF-8. AS such, it's perfectly reasonable for XeTeX to expect fonts to be 'properly' constructed to have glyphs in the appropriately-named slots and therefore to work correctly in the PDF output with no 'trickery'.

Taking the 'what to do' side of things, the problem is most likely with the font. For example, some fonts have the correct glyphs but in the 'wrong' places (e.g. in the Private Use Area). That's really not a 'TeX problem': all that can be done is to talk with the font designers and try to get them to fix it.

  • I'm answering the general XeTeX point: from discussion with the OP it's clear that this is the key part to the question, with the Libertine bit not the main focus. – Joseph Wright Aug 14 '13 at 7:21
  • A related discussion is here: tex.stackexchange.com/questions/49502/…. Where people seem to agree that the problem lies with XeTeX and not with the fonts. – Sverre Sep 6 '13 at 13:24
4

I realize that this post is old, but for future readers' sake, I thought I'd point out that I was able to create ligatures using Linux Libertine 5.3 and XeTeX 3.14159265-2.6-0.99991 (TeX Live 2014/W32TeX) (preloaded format=xelatex 2014.7.31) that are copyable and searchable when viewed in Adobe Reader 11.0.08.

\documentclass{article}

\usepackage{fontspec}
\setmainfont[Ligatures=Historical]{Linux Libertine O}

\begin{document}
    fluffier soufflé fisticuffs fb fh ffh fj ffj fk ffk ft fft tt Qu Th ch ck ct
\end{document}

You can check my output PDF to verify that the ligatures are indeed copyable and searchable.

Does anyone know what might have changed to make this possible since the original question and answers here? Linux Libertine 5.3 (the version I used) was available at the time of the original post.

  • 1
    I can verify that this works on my system too now. Also with old style numerals (adding Numbers = OldStyle as an option). Some changes must have been made to either fontspec or the xetex engine. – Sverre Sep 28 '14 at 13:34
  • 2
    @Sverre It works only in Adobe Acrobat/Reader though. In Mac OS Preview the ligatures are still not recognized. I have been trying to figure out what is wrong with ligatures for different fonts on a Mac as in this post but haven't made much progress. The problem seems to be a combination of fonts/xetex/pdf-viewer. – jan May 11 '16 at 13:12

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.