sebschub / FontPro

LaTeX support for Adobe's Pro opentype fonts: Minion Pro, Myriad Pro, Cronos Pro and possibly more
231 stars 43 forks source link

Build font without ligatures #41

Closed ghost closed 9 years ago

ghost commented 9 years ago

I'd like to build MyriadPro without ligatures, especially without f-ligatures. I know that this is possible with using microtype but when disabling ligatures using microtype other features get lost. Is there a way to not build ligatures at all using some option?

I had an idea to use --pack option. So I generated a Python script to delete all f-ligatures from glyphlist like:

import os

name_glyphlist = "MyriadPro-glyph-list-2.106"

path = os.path.dirname(os.path.realpath(__file__))
input_file = os.path.join(path, "scripts", name_glyphlist)
output_file = input_file + "-no-ligs"
ligature_pattern = ["""/f_""", """/fl\n""", """/ff\n""", """/fi\n""", """/fj\n""", """/ffi\n""", """/ffl\n""", """/ffj\n"""]

with open(input_file, "r") as input:
    with open(output_file, "w") as output: 
        for line in input:
            if not any(pattern in line for pattern in ligature_pattern):
                output.write(line)

and than built the font. When I now compile a document it uses all glyphs distinct from f-ligatures but if there should be an f-ligature like in Office it instead prints Oà ice. When I write Of{}fice it works. Now I'm not sure if there is a possibility to achieve my goal without using microtype.

ghost commented 9 years ago

(No kerning) solution: I now found out that I do not have to edit the glyphlist, but (at least with pdftex so also with luatex) one could easily write:

\AtBeginDocument{\sffamily\pdfnoligatures\font}

maybe you could add this as option one day.

Edit: Just found out that this is the same as using microtype. So building without ligs would be required as I assumed at begin :(

sebschub commented 9 years ago

Could you try the nolig branch of this repositpry and the --noligatures option? (run ./scripts/makeall MyriadPro --noligatures)

ghost commented 9 years ago

Thank you very much for the quick reply and feature implementation. My first tests are successful. It seems all works fine :) I'm not 100% sure if kerning is intact but seems to be the case. Can you describe what you did to get it working? Here http://tex.stackexchange.com/questions/1841/how-can-i-completely-suppress-ligatures/1848#1848 someone points out how it would work and I implemented this solution, but yours seem to work too without patching?!

sebschub commented 9 years ago

Actually, my solution is similar to the stackexchange one. In the conversion scripts, otftotfm is used to create the tfms. The switch -fliga is used to create the ligature entries. With the newly implemented --noligatures option, I just removed the -fliga switch.

sebschub commented 9 years ago

Feature implemented in 3dc1f48ceff3c403f37b038069908d782d5be896.