unified-font-object / ufo-spec

The official Unified Font Object specification source files.
http://unifiedfontobject.org
175 stars 30 forks source link

question about mark to ligature index number #223

Open aminabedi68 opened 1 year ago

aminabedi68 commented 1 year ago

Hi i'm working with fontforge to create a variable font.(fontforge→UFO+designspace→fontmake→VF) fontforge generate UFOs with no index number for ligature anchor marks like this(in features.fea):

  pos ligature \uniFEFC <anchor 977 4> mark @Anchor0 
    ligComponent
      <anchor 335 4> mark @Anchor0 ;

the glyph in fontforge GUI:

fontforge_UewJUOIppP

this situation triggers warning in fontmake:

WARNING:ufo2ft.featureWriters.markFeatureWriter.MarkFeatureWriter:duplicate anchor 'Anchor0' in glyph 'uniFEFC '

although the generated VF still working, but if i want to interpolate an instance the result will be like:

fontforge_tfOsmIWLm9

i tried to solve the problem by regex search and replace for @Anchor0 and @Anchor2 in those lines with appending an index to be like(for@Anchor0): @Anchor0_0 and @Anchor0_1 or @Anchor0#0 and @Anchor0#1 but it's not working. i thought the problem was from indexing but something is still wrong. so what is wrong according the ufo spec?

LettError commented 1 year ago

Do you mean the glyph picks up duplicate anchors along the way?

aminabedi68 commented 1 year ago

I'm not sure I understand you correctly, the issue comes from fontforge(with putting no index to ligatures anchors marks), apparently the fontforge developers don't know what is the right way according the ufo spec. it cause some problems in interpolation and if i open the interpolated ufo with fontforge, it couldn't pars those anchors. i'm trying to do some python hack between to fix it but don't know how. i prefer to solve my problem in first priority but also give a hint from you to fontforge developers to fix it in future releases.

anthrotype commented 1 year ago

the UFO spec doesn't currently attach any particular meanings to anchor names, so this can be regarded as a tool issue. I suggest you redirect this to ufo2ft repository

aminabedi68 commented 1 year ago

i don't think so @anthrotype , because even when fonforge directly generates UFO from its own SFD sources, i mean even without interpolation, ligatures anchors marks are not the same:

fontforge SFD source(two Anchor0 and two Anchor2): fontforge_DvvDllRFKc

fontforge opened its own generated UFO: fontforge_3G06NjF026

i think it's related to some kind of wrong implementations from fontforge side.

anthrotype commented 1 year ago

The UFO spec as such is silent about how anchor should be named for generating mark or mkmk features, there's only a brief mention of anchor naming convention for ligature carets. So fontforge is not implementing anything "wrong" because there's no official rule. We can try to come up with some shared behavior but as of now, the UFO specification does not specify this.

moyogo commented 1 year ago

Fontforge not being consistent between its exported UFO and its own SFD is problematic and should be fixed.

Have you tried using sfdLib?

aminabedi68 commented 1 year ago

@moyogo sfdLib not working for this case. (I don't know sfdLib has this issue or not at all, will check it with another project)