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?

  • 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). Commented Apr 23, 2013 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. Commented Apr 24, 2013 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. Commented Apr 24, 2013 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
    Commented Apr 24, 2013 at 19:14
  • 1
    It's not off-topic, because the question was how to apply the otherwise well-known command \pdfglyphtounicode in pdftex (which I linked to) to xetex, where that command doesn't work. The fact that the reason I want to do that is due to some (alleged) problems with the font is strictly speaking another matter. Ulrike's comment is a good answer to what I actually asked: "you can't do anything on the xe(la)tex side. xetex can't manipulate the glyph names". Both the title and the content of my question make it clear that this is about xetex, thus clearly "within the scope of TeX"
    – Sverre
    Commented Aug 4, 2013 at 13:17

2 Answers 2


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
    Commented Aug 14, 2013 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
    Commented Sep 6, 2013 at 13:24
  • Do you have any way to walk around this? tex.stackexchange.com/a/574619/81293 Another problem caused by fonts. For Times New Roman, it's none. For most other fonts, it's U+2010 while I'd like it to be U+002D, which is searchable in most PDF viewer.
    – Lei Zhao
    Commented Dec 11, 2020 at 19:32
  • A less perfect walkaround is to use \XeTeXgenerateactualtext. But /ActualText is less well supported in most viewers on my computer.
    – Lei Zhao
    Commented Dec 11, 2020 at 19:36

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.


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

    fluffier soufflé fisticuffs fb fh ffh fj ffj fk ffk ft fft tt Qu Th ch ck ct

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
    Commented Sep 28, 2014 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
    Commented May 11, 2016 at 13:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .