5

Inputting glyphtounicode when compiling with pdflatex makes sure that various ligatures in the output are copy- and searchable. With the Alegreya package, however, the ligatures for fj and ffj aren't rendered correctly. Is there a way to work around it?

\documentclass{article}
\usepackage{Alegreya}
\input glyphtounicode
    \pdfgentounicode=1
\begin{document}
fb ffb ff fh ffh fi ffi fj ffj fk ffk fl ffl ft fft
\end{document}

Copy-and-paste from .pdf:

fb ffb ff fh ffh fi ffi f fk ffk fl ffl ft fft

  • @barbarabeeton glyphtounicode should be in tex live 2015, because I haven't installed or downloaded anything manually. (I have an idea about how Alegreya is mapping those non-unicode ligatures, but I'm on my way out now, so I'll come back to that. But in short, I believe the f in inputs like fb, fk, etc. is mapped to a different f glyph, which then glyphtounicode is able to map back onto an f. So, the output fk here is not a single ligature, it's just the combination of a different f + k. I guess fj is a real ligature, and glyphtounicodecan't deal with it. – Sverre Aug 13 '15 at 18:18
  • since unicode does not assign a code to the fj ligatures (nor to fb, fh, fk or ft ligatures), it's not clear to me how Alegreya is making these connections. they're not defined in glyphtounicode. under the circumstances, this seems to be something that should be reported to the maintainers of Alegreya. – barbara beeton Aug 13 '15 at 18:23
  • fj should be a real ligature! (and norwegians should complain otherwise, as should slartibartfast.) (and i have since found glyphtounicode in tex live 2015, although i'm unable to locate it directly on ctan.) – barbara beeton Aug 13 '15 at 18:28
  • @barbarabeeton Sure, what I mean is that fb, fk and ft aren't "real" ligatures in the Alegreya font in the sense that they are composed of a single glyph - they just look like ligatures because the font provides context sensitive variants of f. Whereas it seems like fj is a single glyph in the font, and that's why glyphtounicode can't do anything about it (since the ligature is not included in Unicode). (And yes, as a Norwegian I am very unhappy about fonts without a fj ligature :)) – Sverre Aug 13 '15 at 18:32
  • actually, glyphtounicode doesn't even contain anything i could recognize as an fi of ff ligature, so they are recognized in some other way which i can only speculate about. you say that they "aren't rendered correctly", but it's implied that they do appear correct in the output, and the problem is with cutting and pasting that result back to input form. if you could add the output view of your example, that would be more clear. (there must be some way of determining the "unicode" or utf8 value of these glyphs; i suspect this one is in the private use area.) – barbara beeton Aug 13 '15 at 19:01
10

If you compile with pdflatex you can do this:

\documentclass{article}
\usepackage{Alegreya}
\input glyphtounicode
\pdfgentounicode=1

\pdfglyphtounicode{fj}{0066 006A}% f j

\begin{document}
fb ffb ff fh ffh fi ffi fj ffj fk ffk fl ffl ft fft
\end{document}

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.