ToxicFrog / Ligaturizer

Programming Fonts with Ligatures added (& a script to add them to other fonts)
GNU General Public License v3.0
2.23k stars 113 forks source link

patching Hack font with the updated new script throws the following error #16

Closed vikky49 closed 6 years ago

vikky49 commented 6 years ago

fontforge -lang=py ligaturize.py input-fonts/Hack-Regular.ttf output-fonts/Hack-Regular.ttf

Copyright (c) 2000-2014 by George Williams. See AUTHORS for Contributors. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html with many parts BSD http://fontforge.org/license.html. Please read LICENSE. Based on sources from 11:11 UTC 25-Sep-2017-D. Based on source from git with hash: The following table(s) in the font have been ignored by FontForge Ignoring 'DSIG' digital signature table Ignoring 'TTFA' Reading ligatures from fira/FiraCode-Regular.otf Warning: Mac and Windows entries in the 'name' table differ for the Fullname string in the language English (US) Mac String: Fira Code Windows String: FiraCode-Regular Traceback (most recent call last): File "ligaturize.py", line 289, in creator = LigatureCreator(font, firacode, args) File "ligaturize.py", line 78, in init self.emwidth = self.font['m'].width TypeError: No such glyph

ToxicFrog commented 6 years ago

There is no input-fonts/Hack-Regular.ttf. It's input-fonts/Hack-Regular.otf.

The actual bug here, I think, is "Ligaturizer doesn't produce sensible errors when one of the input files is missing".

vikky49 commented 6 years ago

@ToxicFrog Thats not true . I personally added the Hack-Regular.ttf font inside the input fonts because the new version of Hack only has ttf fonts. The reason i add and i run that

fontforge -lang=py ligaturize.py input-fonts/Hack-Regular.ttf output-fonts/Hack-Regular.ttf

command individually for all the fonts so that i avoid the word "Liga" infront of every font. I tried the same for Source Code pro and that seem to be working

ToxicFrog commented 6 years ago

Ok, found the problem: indexing the font by string looks up the character by name, and while fonts often provide character names, they are not required to -- codepoint lookup is all that's actually used.

I'm working on another patch that I can roll a fix for this into (mostly around font names/metadata), but it may be a while before it's ready; in the meantime, you can work around it by changing line 78 from:

self.emwidth = self.font['m'].width

to

self.emwidth = self.font[ord('m')].width

command individually for all the fonts so that i avoid the word "Liga" infront of every font. I tried the same for Source Code pro and that seem to be working

It's probably easier to just edit the makefile (although this is one of the things I want to add a better configuration knob for): replace /Liga% in TTF_OUTS and OTF_OUTS with /%.

vikky49 commented 6 years ago

awesome ..Thanks will locally make that change