-
Notifications
You must be signed in to change notification settings - Fork 168
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
Implement support for syntax for STAT table #176
Comments
I'm curious to hear from the adobe type team on this :) |
Yes, a STAT table definition could exist be added to the feature file, but it needs thought. I haven't spent enough time on this yet, as we are still getting a complete CFF2 workflow to work. However, what we have now requires a lot of hand editing and understanding of low-level formats. Once this pass 1 is all done, which will be in just a few weeks, I and others in the team team will start thinking hard about to how to specify all the VF meta data in a way which is more elegant and easy to use. We will be sharing our ideas and seeking suggestions from all the usual contributors. |
Here's the proposed FEA syntax for the table STAT {
ElidedFallbackName {
name <name string>;+
};
DesignAxis <axisTag> <axisOrdering num> {
name <name string>;+
};+
# format 1 (if one pair specified)
# format 4 (if several locations specified)
AxisValue {
flag <FLAG>+ ;
location <axisTag> <value>;+
name <name string>;+
}
# format 2
AxisValue {
flag <FLAG>+ ;
location <axisTag> <nominalValue> <rangeMinValue>-<rangeMaxValue>;
name <name string>;+
}
# format 3
AxisValue {
flag <FLAG>+ ;
location <axisTag> <value> <linkedValue>;
name <name string>;+
}
# format 5 (to be proposed): range-based style linking,
# combination of format 2 & 3.
# The specified range (with nominal value) is to be linked
# to the specified linked value.
AxisValue {
flag <FLAG>+ ;
location <axisTag> <nominalValue> <rangeMinValue>-<rangeMaxValue> <linkedValue>;
name <name string>;+
}
} STAT; Examples table STAT {
ElidedFallbackName { name "Regular"; }
DesignAxis wght 0 { name "Weight"; }
DesignAxis ital 1 { name "Italic"; }
# These examples are for illustrative purposes only;
# they won’t all be in a single STAT table:
# format 1
AxisValue {
location wght 400;
name "Regular";
name 3 1 0x411 "\5B9A\671F\7684";
flag ElidableAxisValueName;
}
# format 2
AxisValue {
location wght 400 300-500;
name "Regular";
flag ElidableAxisValueName;
}
# format 3
AxisValue {
location wght 400 700;
name "Regular";
flag ElidableAxisValueName;
}
# format 3
AxisValue {
location ital 0 1;
name "Regular";
flag ElidableAxisValueName;
}
# format 4
AxisValue {
location wght 500;
location ital 1;
name "Mediumitalic";
}
# format 5 (to be proposed)
AxisValue {
location wght 400 300-500 700; # style-link 300-500 wght to 700
name "Regular";
flag ElidableAxisValueName;
}
} STAT; |
Hm, in my STAT-in-Designspace musings, I found 3 use-cases that need to be supported by a STAT generator:
The example you gave is the obvious choice for case 1, but what is to happen in cases 2 and 3? Should the feature compiler subset the given table? Then it needs to know what instances are defined (can look at the fvar table, what about static fonts though?) and which axes are missing and where the font stands on them (how?). Expect the designer to define the table twice in each main master's feature file? Again, static fonts? At Dalton Maag, we decided to ship fonts with various axis subsets, i.e. the big package has weight, width and slant axes while smaller packages have e.g. just a weight axis and we sell the uprights and slanted versions separately. We have just one set of UFOs, but multiple Designspace files with just the axes we want. How would a feature file fit in there? I hear @anthrotype's team is working on a variable font subsetter capable of subsetting axes, which would make this workflow obsolete though, so let's see. |
@madig @sairuspatel I think you may be expecting that one STAT table definition would be used for all the fonts in a family or package. This definition is in a font-specific feature file, not in the designspace file. All three of the cases would be covered by different STAT tables, each specific to each font. Also, just because a specific variable font (VF) does not use an axis does not mean it should be omitted from the STAT table for that VF - quite the opposite. All the static and variable fonts in a family should all share the the same list of axes, but would have different AxisValue records. Even a VF does not have an 'ital' axis, when it is part of a family which does, the VF font should have a DesignAxis element for 'ital', and an AxisValue 'location ital 0 1;' to say where it is in the family design space. |
That's what I mean -- but how would the proposed STAT table feature file syntax fit into the usual compilation workflow? When you generate two VFs out of Source Sans Pro (upright plus italic) and also static instances, both from two Designspaces, how do you inject the right STAT table and from where into the binaries? |
For at least the afdko workflow, the VF font inherits all the tables and features of the default source font. The STAT table is injected by defining it in the feature file for the default master font. (With some exceptions,, of course - the CFF table is converted to a CFF2 table, and some features and other data are modified.) |
So... what about e.g. the static instances then? |
they also inherit the features of the default master, normally. |
Which is not what we want here, no? |
I suspect you are thinking about a workflow in which one default font and all the region fonts and meta data are set up for the complete family, and build tools can start use the complete family data set to generate not only the complete family VF font, but also static fonts and VF fonts which contain a subset of the region fonts and axes. In the workflow this proposal is intended for, the static font would be built without VF machinery, just the way a font is usually built, but with a STAT table defined in the source feature file. The VF fonts which use a subset of the region source fonts and of the axes would also be built a feature file for the default font that is specific to the subset VF font. |
Ah wait, the workflow you're proposing is that you have masters with one default master, from which the feature file is taken for VFs, and the instances you generate and store separately so you can hand-edit their feature files and make per-instance STAT tables? I am thinking of running fontmake on a Designspace file and having it generate not only the VF, but also static instances in one go. In that workflow, the proposed feature file way won't work without subsetting smarts in fontmake. |
The proposal is about new FEA syntax for supporting the STAT table. There's nothing in there that ties it to a particular font production workflow. It's all FEA syntax, and in FEA syntax each document provides an abstraction (of OT tables and features) for one font, and one font alone. In FEA syntax there's no concept of nor support for a family of fonts. Sure, one can use
It's clear what you're trying to do, and your comments make sense in light of you trying to understand where and how to plug the STAT FEA code into fontmake. But we believe those are workflow questions that you'll need to solve, rather than limitations of the proposed STAT syntax. |
Any other comments? Else this syntax will be added to the feature file spec in a few weeks. |
I have some questions about how the proposed syntax would interact with other tables:
|
It would be useful if Having |
For question 1), I do see the issue that both the ElidedFallbackName and the axis valueNameID contain only the name table nameID value. I think that in the feature file spec, the name entries in the STAT table should support the full name table name record attributes. Access to the current state of the name table is implied. The implementation should reuse a name id if an exact match is found, else not. This should happen in makotfexe. For question 2), I think that validating that the fvar and STAT table axis names match in both text string and also script/platform/language should happen, but should be left to the font building tool. This is also where the optimization of sharing name records between the fvar and STAT table should happen. As Khaled points out, this can't happen in makeotfexe, as this creates the STAT table in the source default font, and in the current workflow, the fvar table is only created when the VF font is built. |
I implemented enough of
|
@khaledhosny: I discussed this with @josh-hadley and we agree with your suggested changes. We also agree that there is no need for you to implement format 5 since it is not part of the OpenType standard yet. |
Just to be clear, for |
Oh, sorry, we thought your proposal meant “if a string is specified, create a new name entry, and if an integer is specified, use that nameID”. After review and further discussion, we have a couple of refinements to suggest: 1) use the proposed syntax with braces, etc. for specifying a string ( So basically if a user wants to specify by ID/directly, the onus in on them to ensure it exists. Specifying a string, |
OK |
Could the AFDKO feature syntax support a
table STAT
statement? See @moyogo’s proposal to encode STAT in designspace documents, but @LettError didn’t like it (because he thinks it it adds too much cruft to the designspace format).The text was updated successfully, but these errors were encountered: