# How do I use glyphtounicode to make Caslon Pro ligatures searchable?

I am using Adobe Caslon Pro with a caslon.sty file which activates uncommon ligatures such as st, ct, longsl, longst &c. I use it in the following example (updated to match the answer in the comment below):

\documentclass[english]{book}
\usepackage[T1]{fontenc}
\input{glyphtounicode}
\pdfglyphtounicode{germandbls}{0073 0073} % Override: normally eszet does not match “ss”
% Extra Unicode characters
\pdfglyphtounicode{longst}{FB05}
\pdfglyphtounicode{st}{FB06} % This is not produced by caslon.sty
% Ligatures with no Unicode characters
\pdfglyphtounicode{longdbls}{0073 0073}
\pdfglyphtounicode{ct}{0063 0074}
\pdfglyphtounicode{longsh}{0068 0074}
\pdfglyphtounicode{longsi}{0069 0074}
\pdfglyphtounicode{longsl}{006c 0074}
\pdfgentounicode=1
\usepackage[longs]{caslon}
\begin{document}
Goose taste has hash sin slim fact passing pass past.
\end{document}


Unfortunately, I can no longer find the caslon.sty that I use online, nor do the files give any clue as to their authorship. (There are a few different Adobe Caslon Pro support files for LaTeX, in CTAN and other places, but none seems to support the extra ligatures.) Hence, I've put a Zip bundle online at:

-
I haven't tested this because I dont have a type 1 edition of Caslon Pro, but you could try \pdfglyphtounicode{st}{0073 0074}. –  Lev Bishop Aug 5 '12 at 5:10
Thanks @Lev, but it doesn't work either: copying and pasting the text results in a space at the position of the ligature either way. –  Reuben Thomas Aug 5 '12 at 22:09
I realised that in my example above, since I was using long s's, I should have been trying to render "longst", not "st"; changing the relevant line to \pdfglyphtounicode{st}{0073 0074} fixed it! If you could make your comment an answer, I'll choose it once I've confirmed more thoroughly. Thanks! –  Reuben Thomas Aug 5 '12 at 22:42
I've confirmed I can extend the technique to cover all the characters I want. This seems to be a better way to go for now than to try to get the more bleeding edge LuaTeX working . Thanks again, Lev! –  Reuben Thomas Aug 6 '12 at 2:31

This is easy if you use lualatex in the command line instead of pdflatex.

\documentclass[english]{book}
\usepackage{fontspec}
\setmainfont[Style = {Historic}] {ACaslonPro}
\begin{document}
In goose taste.
\end{document}


Is lualatex an option you could try?

-
Thanks very much for this suggestion: I tried using LuaTeX, and it did work as suggested (and in the process I battled some "interesting" packaging problems in Debian, the solution to which should benefit font handling for LuaTeX there!). However, LuaTeX does not support optical margin alignment with microtype, and more seriously, does not correctly use terminal s's at the ends of words (I'll try to work out where to report the bug). –  Reuben Thomas Aug 5 '12 at 15:11
Actually, it's much worse than I thought: almost none of the correct ligatures are output by LuaTeX with fontspec. But thanks for giving me my first taste of LuaTeX in use; I first heard of it nearly 6 years ago at the 2006 Lua Workshop, so it's been a long time coming! –  Reuben Thomas Aug 5 '12 at 17:48
@ReubenThomas: Please read the fontspec documentation and use TeXLive 2012 with TLContrib, not the TeX from Debian. –  Martin Schröder Aug 5 '12 at 20:41
I have read the fontspec documentation; what in particular should I have found? I am using the Debian packages of TeXLive 2012, repackaged for Ubuntu. –  Reuben Thomas Aug 6 '12 at 0:10
I've had another look at the fontspec documentation to try to guess what you were referring to above, @MartinSchröder, and ended up trying a line like this: \fontspec[Ligatures={Historic}, Contextuals = {WordFinal}] {Adobe Caslon Pro}. This results in warnings that these features are not available for that font. The required glyphs are certainly present in the OTF file, so does that mean that some other metadata is lacking? –  Reuben Thomas Aug 6 '12 at 1:27