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

Creating opentype fractions (and checking them) #2441

Open
Gwenouille opened this issue Jul 27, 2015 · 8 comments
Open

Creating opentype fractions (and checking them) #2441

Gwenouille opened this issue Jul 27, 2015 · 8 comments
Labels

Comments

@Gwenouille
Copy link

Hi !

I wanted to know how you'd go about making opentype compliant fonts that allow for nice generic fractions…

I have succeded in making working smallcaps, numerators/denominaors, subscripts etc, but fractions are a bit more complicated it seems…
I have a proper fraction glyph.

I ahd success using contextual chaining substitution (named 'frac'), but i only mimicked what i found in the lookups of a nicely working font (namely Calibri). So that's a sort of black magic trick, with 2 'frac' lookups, a numr to dnom subtitution (?), a slash to division bar substitution, etc…
It works mind you, but i like to learn how to do these things the right way.

Is there a proper method to do that in FF ?

Another question: I mainly use FOSS (except the OS itself…: windows 7) . But i find it difficult to test my work: LibreOffice for instance doesn't do proper kerning on windows. Neither does Inkscape, but at least standard ligatures work, etc…
At the moment i can enjoy a month of InDesign testing for free, and the joy is immense: access to open-type features like fractions, alternate styles, ligatures, etc…
But i won't be able to afford a monthly subscription ONLY to be able to test open-type features of my work.
HEnce the question: do you know a nice piece of software on windows that would allow me to reliably test my fonts ?

Thanks a lot for every little hint you can give me !

Have fun with FF

Gwen

@sungsit
Copy link

sungsit commented Jul 28, 2015

I rarely use FontForge UI to create OT features but import *.fea files instead. I like the fact that FontForge will show error or warning messages when my feature files go wrong (syntax error, glyph missing, for example). Its lookup UI makes me confuse when the font has so many features and it's hard to debug.

I supposed you meant creating arbitrary fractions, my approach is chaining 3-4 lookups together and trigger them with frac tag (may be the same as your approach?). My sample code can be found here.

And because I mostly focus on creating fonts for the web, so "a nice piece of software" I use to test my fonts is any web browser which has HarfBuzz working as OT shaper. With HTML + CSS, Chrome, FireFox and new Opera can expose OT features quite consistently across OS. CSS3 can expose many OT features with font-feature-settings property (more than InDesign?, I guess), especially for complex scripts like Thai. My fraction & other features with HTML + CSS samples can be found here if you want to see it in action (it's a work-in-progress font though).

@Gwenouille
Copy link
Author

Very interesting Sungsit, thanks a lot !
I am completely new to .fea files and syntax, but it already seems quite logical and fairly straightforward so far! I do agree that the lookup UI is confusing, and i have troubles with conditionnal chaining substitution… I do like that external file approach !
Where did you find informations about the syntax and specifications for such files ?

Concerning the fractions, without being sure of what you've done, it seems quite similar…
You first turn ordinary numbers to nmur.
Than turn the slash to a proper fraction glyph.
It's the 3rd step i am not so sure about… (line 182, ie 161) What's going on here ?
Then you see if a match exist to transform the fractions to the existing fraction glyphs…

About testing with a browser… Hmm didn't think of that. My CSS/HTML knowledge is a bit rusty, but I'll give it a go… At first i was hoping that Scribus would be a match for InDesign, but text management is a bit cumbersome there, and i was quite disappointed.
Maybe in the realm of writers… I have to search some more

Besides, I am always in search of a good read, be it about OpenType features and implementations, FontForge, etc… Do you have an idea ?

@adrientetar
Copy link
Member

My sample code can be found here.

When the code inside a feature is only used once, you don’t need to wrap it into a lookup tag. Likewise you don’t need backslash before glyph names if these names are not an FEA keyword.
Also I don’t think you need to define GDEF manually, it can be inferred at compile-time – by makeotf at least.

Where did you find informations about the syntax and specifications for such files ?

Spec: http://www.adobe.com/devnet/opentype/afdko/topic_feature_file_syntax.html
Guide: http://www.opentypecookbook.com/

There is sample code for fractions in the guide. Or you can look at adobe-fonts/source-serif-pro FEA files for instance.

HEnce the question: do you know a nice piece of software on windows that would allow me to reliably test my fonts ?

lualatex — it is far superior to vanilla InDesign in many departments and OTL support is one of them.

@sungsit
Copy link

sungsit commented Jul 29, 2015

It's the 3rd step i am not so sure about… (line 182, ie 161) What's going on here ?

My fraction steps:

  1. Substitute all regular numbers with numerators (Latin.numr lookup).
  2. Substitute slash with fraction (LatinSlash.frac lookup).
  3. Substitute @numr with @dnom when @numr follow fraction or @dnom because the first step change all regular numbers to numerators (LatinContext.frac lookup)
  4. This is optional, if those fraction sequences above identical to pre-composed glyphs (onehalf, onequarter, etc.) then substitute them.

As @adrientetar pointed out, source-serif-pro's fraction may be a better example. But it's my preference to separate lookups & features to make all lookups reusable and easier to find even if it will be used only once.

And http://www.opentypecookbook.com/ is also my starting place to learn OT syntax.

I don’t think you need to define GDEF manually ...

I manually define GDEF for a reason as FontForge can't figure out what Thai glyphs should be included in combining class (at least when I merge features & generate font via python script and some applications can't display Thai properly). I'll test makeotf to see if that will cause any problem, thanks for pointing this out.

@sungsit
Copy link

sungsit commented Jul 29, 2015

@adrientetar, Ah I just got your point. I agree that I don't need to wrap this one and the like in any feature. Good spot, thank you.

@Gwenouille
Copy link
Author

Thanks both of you. In fact i stumbled upon the cookbook not very long after i asked you…

@sungsit :Thanks for the explanation. So it is just as I understood it, but the ' did throw me off… I didn't know what it was for.
I have a whole week of holidays next week, I think i will print a few things and take them with me to study: no internet for a week, can you imagine that ?!

@adrientetar : thanks for the suggestion. I'd rather stick to a WYSIWYG editor if possible though… I don't really have the time and patience to learn a script language just to check my font designs. But who knows ?
It seems that FOSS can't help me this time after all.

@adrientetar
Copy link
Member

I don't really have the time and patience to learn a script language just to check my font designs.

You only need some boilerplate document, and a couple of instructions. It does not take more time than when working with a GUI program for the first time.

@Gwenouille
Copy link
Author

Hi both of you !
I am just back from a 10 day trip to southern France, and I've finally got time to have a closer look at all this stuff.
There is one thing I am not sure about:
When working with .fea files, the features you import with Alt+Ctrl+Shift+K will replace all the stuff you've tweaked within FF ? Like lookups and kernings ?
Does that mean you have to translate all your metrics info into text ?

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

No branches or pull requests

3 participants