-
Notifications
You must be signed in to change notification settings - Fork 30
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
Better anchor definition #32
Comments
Related questions:
|
@graphicore I think another issue can be opened for a way to define ligature caret. The point of this issue is ligature anchors. |
There are also cursive anchors, but in general how do you tell what type a given anchor is, base, mark, ligature, entry, exit. I don’t see how one would be able to use of the anchors without knowing such essential information about it. |
@moyogo the point is that you need the type of the glyph -- ligature -- and how many components it has, for both. @khaledhosny right. I think Glyphs uses a naming scheme where |
I've done a lot of work with using glyph names to indicate feature states and behavior. Pretty much every fancy OpenType font that I've written code for has had a specific naming scheme and a script that interprets it into .fea. The names are ultimately not very flexible and they are really cumbersome for designers. It's not fun to type /o.010340/o.120140 when you just want to compare a couple of "o" designs. Anyway, I think a much more future proof solution would be to publicly define a structure that can be stored in the lib that defines GSUB/GPOS behavior for a particular glyph. That would open up a huge number of interesting possibilities. But... How far does it go? Do we define what the generated .fea should look like? Or, do we stop at saying, "this is a ligature and here's some data about it" and "this is a mark"? This is going to get really deep, really fast. Even more problematic, how is a tool supposed to know when something that exists in .fea should be replaced with auto-generated .fea code and when it should be left alone because the designer made an edit? Don't get me wrong, I think some sort of data structure that can deeply describe the intended use of a glyph would be really useful. Defining how that is used is something that I'm not sure we can get consensus on. |
|
That would be very useful. As I mentioned in a fontParts issue, having an anchor lib also would be nice to add other information like context of mark positioning. This context information can be stored in glyph lib now, but by removing the anchor, any authoring tool should also remove that information from glyph lib. If there will be an anchor type property I prefer to store the information there instead of glyph lib. I guess I can store more elaborate data structure using XML there if it's string but not sure if this is considered standardized or not. |
As explained in the issue you reference, adding lib to anchor is problematic, so please focus on solutions that don't require that. Regarding
Is that correct and complete? Likewise for the type of a glyph? |
I will probably use this type property then.
I think so. But I don't know what's the use for ligature type though. Example in Arabic is that it's either base or mark. On the ligatures the base anchor gets an index for the order. |
Only from this set:
https://docs.microsoft.com/en-us/typography/opentype/spec/gdef#glyph-class-definition-table-overview |
(Just to be clear for anchor type)
Base anchor can get an index attribute for the logical order of mark in a ligature. |
Actually in adobe fea file a ligature mark and base mark are defined differently.
But personally I don't need to know if an anchor is ligature type when I generate the feature. I just check if it's a base and if it has an index. |
Current solution to prevent adding any property to anchor is having name conventions for anchors. The advantage of naming convention is that the intention of the anchor is visible. The name corresponds to the anchor mark that is going to be placed on the base. So if a |
See also: googlefonts/ufo2ft#330 (comment) Suggestion:
In other words:
|
I will do that, thank you for pointing them out. One note for now. If the glyph type is mark, it could include both mark and base anchors. In a glyph that is defined as a mark, the base anchor is used for mark to mark positioning. Takeaway: anchor type cannot always be inferred from its glyph type. |
One limitation of the above scheme is that it allows only one cursive anchor/lookup in the entire font. |
Could you give an example where there is a need for multiple lookups for cursive anchor? |
OpenType allows it, I don’t see why we should have such a limitation otherwise. I have a font that has cursive anchors with RTL flag and without it, based on whether it wants the rightmost of the leftmost glyph to be the one setting on the baseline. |
Good point. Thank you! |
This also adds the question, do we need a |
Is this googlefonts/ufo2ft#303 ? @khaledhosny, are there any other fundamental problems that are good to consider up front? |
No, another font that I didn’t convert to UFO since fontmake does not support cursive anchors at all. May main problem with UFO anchors right now is that there behavior is unspecified. Tools like fontmake and ufo2ft try to follow Glyphs but 1) Glyphs is not a UFO editor 2) Its behavior is not specified either 3) it has arbitrary limitations (like supporting only one cursive anchor per font). I prefer being explicit than implicit, so I think One thing that would still be unsolved is contextual mark positioning. I have no idea how that would be supported for anchors without full OpenType machinery in the format. So I guess people will have to keep writing that manually or have font-specific scripts to handle them. |
This is the main limitation of anchors for me in UFO. A context cannot be written in the name. I would love to have the option to write it in the anchor but there is None atm. |
A possible solution for future, adding an attributes dictionary to the anchor with (standardized) string keys? |
A solution for now, write all the related info for mark and cursive positioning inside the glyph lib and define the spec. An authoring tool (e.g. RF extension) is required to show the preview, change its attributes and to compile it to features. |
Another disadvantage for anchor naming scheme, the intention of the designer is unclear. The anchor naming scheme for generating mark positioning is exactly similar to build precomposed accented glyphs. Is the anchor made to generate mark positioning or just to build precomposed accented glyphs? This could lead to unnecessary extra data in the final binary. An anchor that is used for glyph construction is not necessarily supposed to be used for mark positioning and position of a precomposed mark can be different from a mark that is going to be placed using mark positioning on the actual base glyph (very common in Arabic). One solution, a new data structure only for generating marks and cursive attachment that could be saved in glyph lib and also to segregate these data. |
That's an interesting question. On the one hand: well, maybe it is cool to have mark features for (latin) accents? But |
lol. @typoman hijacked another thread. :) |
I've been instructed to not to post a comment on anything I find relevant to the subject. I will do it in one huge post when I gathered all I could. Thank you all for your patience and sorry for distractions! |
yes!
I can think of an additional category of anchors which are used during the design stage and are not needed in the generated font. examples:
exploratory questions:
|
While FontForge sticks to one anchor type per anchor as its model is close to the OT model, Glyphs.app and fontmake/ufo2ft currently may assign more than one anchor type per anchor. For example when circumflexcomb has only a mark-to-base mark anchor, FontForge will have just that. Glyphs.app and fontmake/ufo2ft will be happy with a |
What a MarkToMark base anchor is going to do? I've never heard of that one. MarkToMark is supposed to attach a mark to another mark. Why should it be written on a base glyph? |
For the above example, I think what @moyogo means for |
Then what is a difference between mark-to-mark base anchor and a mark-to-mark mark anchor? |
Because the base is a diacritic carrying a precomposed mark? Typically, my mark-to-mark anchors involve 2nd glyph y adjustments to obtain a consistent optical distance between the top of the 1st mark and the bottom of the 2nd mark for above marks (and vice versa for below marks), while my mark-to-base anchors use the default vertical alignment of the marks. Obviously the mark-to-mark anchor adjustments should also apply when the mark is applied to a diacritic glyph with a precomposed mark. So, e.g. applying acutecomb to ä would need the mark-to-mark adjustment of the height of the acutecomb from the mark-to-diaeresis mkmk anchor. So either one needs to use the mark-to-mark anchor on the diacritic bases, or to have a third anchor for mark-to-diacritic. |
@moyogo for your Glyphs/ufo2ft example, is my assumption that the tool has some knowledge of what marks should be in the mark to mark feature correct? (this is the way I've done it in the past, just want to double check my assumption). |
|
@typoman You should study the OpenType spec, in much more detail than you know currently.
What does "is a base glyph" mean / refer to here? "comb" in the glyph name means combining. |
Thank you for clarification, I think @moyogo terminology is different from what I've understood so far, ergo the confusion. But in my experience in Glyphs app and in a combining mark, any anchor mark in Adobe feature syntax will get one rule per anchor.
What's the third rule he's refering to? I don't see it in Glyphs app feature file. |
@benkiel Indeed, Glyphs.app and ufo2ft follow specific rules that get translated to AFDKO feature syntax, which then gets translated into GPOS lookups. Adobe’s markFeatureWriter.py follows similar rules but isn’t as complete. In short, an anchor will translate to a mark-to-mark lookup only if it is both a base anchor and a mark anchor in glyphs that also have mark anchors, and an anchor will translate to a mark-to-liga lookup only if there are matching numbered anchors in ligature glyphs. @typoman The AFDKO feature syntax is higher level than GPOS lookups so you won’t see exactly the same structure. In short the _top is only defined once in the AFDKO example you give, but it will be duplicated, one in the mark lookup and another one in the mkmk lookup in GPOS. So you could very well have "_top", "_topmkmk" (at the same coordinates), and "topmkmk" in circumflexcomb that will produce the same GPOS structure as having "_top" and "top". Glyphs.app and ufo2ft make the anchor type implicit as long as you follow their rules. Sorry, I’m just babbling about how different authoring tools work without providing a way forward. @gferreira’s |
I think we should reconsider adding a |
One other thought, if we allowed a mark to have more than one type, it would accommodate what Glyphs/UFO does and also what FontForge does and allows for anchor re-use but also more specificity. |
Here I've gathered some information about how tools deal with anchors in UFO. I hope this could be useful for people who are trying to figure out how things already work in UFO tools. Some of this is just copy-paste from different places in GitHub.
Glyphs appTibetan script ( FDK mark feature writer
I dropped some minor details. For more details read the source of markFeatureWriter in ufo2ft or WriteFeaturesMarkFDK in python module repo of the FDK. What’s the issueTo interpret what’s the purpose of anchor there is lots of guesswork on the anchor name and glyph data during the binary compile. Some features are generated only on the compile without getting exposed to the user (composites anchor propagation). Writing OpenType features is a user’s job, not the compiler. An authoring tool could automate some of it (like propagating composite anchors) but there shouldn't be anything left for compiler's guessing. Also for the sake of transparency adding some attributes to anchor can help to remove the guesswork and give more control to the user. My suggestion is either to have an anchor lib or the following attributes: Anchor DefinitionExplicit anchor attributes to define its definition:
Lookup definitionStill, the compiler needs to guess how to write the flags, lookups and which feature the anchor definitions belong to. Again this can be automated by an authoring tool and saved in the UFO but it shouldn't be a compiler's guesswork. This could be achieved with data structures on the font level and anchor could reference that data. This could be one way of doing it:
In the end, maybe |
The ligature anchos are without underscore prefix.
Glyphs.app defines several attributes for each glyph: script, category (letter, mark), subCategory (ligature, nonspacing), decomposition (list of glyphInfo objects (that each have all the above info)). ligature component count can be computed from the decomposition info (iterate it and count the number of none mark glyphs).
In the issue it stats that is complicated and .ufo doesn't support it. Both problems can be solved.
sometimes anchos are only used to position components. That can be true for all five types. So a flag that says: Don't consider when generation GPOS.
entry/exit anchor don’t need differentiations. They have a unique name. If you add any suffix (a '#' or an emoji) the anchors are used to (cursively) position components but are ignored when generating GPOS (see above). I see how it could be possible to add options to have multiple cursive lookups. But maybe I’ll wait what is decided on this topic here. About the "Anchor Definition" and "Lookup definition": |
the |
My understanding of the current state is that we're going to add a |
Good. The comment was just for the .type case. |
@schriftgestalt I think @justvanrossum has folded on this, |
I understand. I had wrote that just before he meeting and posted it because I had written it. |
For ligature anchors, many UFOs designed with one authoring tool don’t work with other authoring tools as they have different ways of storing this information. Some authoring tools expect specific suffixes (like
_1
,_2
,... or#1
,#2
,...) while others expect specific prefixes. It would be better to standardize this, either in the name or preferably with an attribute (for exampleligatureIndex
)./cc @graphicore @khaledhosny @jamesgk
The text was updated successfully, but these errors were encountered: