# Set global non-ligature kerning with selnolig

Similar to this question I want to use selnolig but I don't like the fact that in words containing fl without ligature these two letters are too close together.

Like in Mico's answer I want to use the "new" method because I found that with the font I'm using this will make perfect kerning. Unfortunately the code given in this answer provides the "new" method only for single words.

Is it possible to use this method for every word with a non-ligature fl combination? In other words: Is it possible to add a fixed kerning between all f and l letters that are automatically broken into single letters by selnolig?

\documentclass[ngerman]{article}
\usepackage{fontspec}
\usepackage{selnolig}

\usepackage{luacode}
\begin{luacode}
function breaklig (s)
s = s:gsub ( 'Verzweiflung' ,
'Ver\\-zweif\\discretionary{-}{}{\\kern0.05em}lung' )
return s
end
breaklig , 'break ligatures in specified words' )
\end{luacode}

\begin{document}

Verzwei\uselig{fl}ung {V}erzweiflung Verzweiflung

\end{document}


• The first example uses a ligature that should not be used in this case.
• The second is the output produced by selnolig with the letters f and l too close together.
• The third uses the luacode above to create a 0.05em kerning that does not interfere with TeX's hyphening algorithms (as far as I know).

I want to use the third one for all words containing fl where selnolig breaks the ligature.

• Maybe you are interested in one of today's talks: tug.org/tug2018/program.html They will be broadcast via live stream youtube.com/watch?v=0afEOEX-rEM – user36296 Jul 20 '18 at 8:51
• It would be easier to understand what you wanted if you added minimal working example to show what you are doing: without code that exhibits your problem we have to guess what you are doing, which makes it much harder to help. – Andrew Jul 20 '18 at 9:12
• Not possible. selnolig breaks ligatures by inserting whatsits which completely disables kerning. You could modify selnolig to insert tagged whatsits and then have the linebreak_filter callback walk the hlist and reinsert kerning on tagged nodes. – Henri Menke Jul 20 '18 at 11:03
• The short answer to your questions is, unfortunately, "no". When breaking up a ligature -- whether by inserting a "whatsit" during the ligaturing callback phase (selnolig's current method) or by inserting an explicit amount of whitespace (David's method, or also the babel-shorthand method) -- it's also important to decide what to do regarding line-breaking possibilities. selnolig's approach was chosen, in part, so as not to interfere with TeX's hyphenation algorithms. Note that David's answer (in the link you provided) potentially runs into trouble in this regard. – Mico Jul 20 '18 at 11:07
• Actually I didn't link David's answer but your's. In your answer you used discretionary to not interfere with the hyphenation algorithms. So my questions is if one could expand your code to work with every word that uses fl with no ligature. – Erik Jul 20 '18 at 11:51