Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to use kerning #34

Closed
daniellAlgar opened this issue Feb 15, 2017 · 7 comments
Closed

Unable to use kerning #34

daniellAlgar opened this issue Feb 15, 2017 · 7 comments

Comments

@daniellAlgar
Copy link

daniellAlgar commented Feb 15, 2017

Hi all!

I'm facing an issue where the kerning isn't read properly from the font.

file_name = ARGV.first || File.join(__dir__, './my_font.ttf')
file = TTFunk::File.open(file_name)
puts "kerning? : #{file.kerning.exists?}"

result in kerning? : false

The font does contain kerning and I've verified it by installing it in the MacOS Font Book and used the font in TextEdit.

Any thoughts or similar experiences? Or even better, any solution?

@ramhoj
Copy link

ramhoj commented Feb 15, 2017

+1

@mojavelinux
Copy link
Contributor

mojavelinux commented Feb 15, 2017

This is due to the fact that ttfunk only recognizes kerning in a font that either has an old-style kern table or is in the Apple TTF format. These are both options when you can enable when you save the font with FontForge.

See the second screenshot on https://fontforge.github.io/en-US/documentation/interface/generate/.

If you're using a FontForge script, you'd set the following flags:

genflags = 0x90 + 0x800

which I pass into the Generate command as follows:

Generate(export_file, "", genflags)

@mojavelinux
Copy link
Contributor

I think that saving in the Apple format is just another way of enabling the old-style kern table.

@mojavelinux
Copy link
Contributor

mojavelinux commented Feb 15, 2017

Btw, those flags are:

  • 0x90 - neither OpenType or Apple
  • 0x800 - generate old-style 'kern' table

It isn't necessary to trim the font down like that. It's just what I use.

@daniellAlgar
Copy link
Author

@mojavelinux Thanks a million! That was indeed the issue.

As a side note: FontForge warns about

Ignoring 'LTSH' linear threshold table
Ignoring 'VDMX' vertical device metrics table
Ignoring 'hdmx' horizontal device metrics table

Is that serious in any way?

@mojavelinux
Copy link
Contributor

mojavelinux commented Feb 15, 2017 via email

@daniellAlgar
Copy link
Author

Sounds good enough :).

Thank you so much again! I'm closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants