Is Replace Feature broken in 2.6.1(1230)


I’m trying to use the Replace Feature custom parameter to swap contextual GPOS code (Indic ABVM feature) and it doesn’t seem to be working.

Note: I’m using the # Automatic Code End keywords (but omitting this doesn’t change the result)

in the ABVM feature I have the following code:

# Automatic Code End
lookup contextual_positioning {
pos iMatra-deva base j_ja-deva <anchor 250 250> mark @mark_top';
} contextual_positioning ;

in the Replace Feature parameter of a lighter instance I have:

# Automatic Code End
lookup contextual_positioning {
pos iMatra-deva base j_ja-deva <anchor 300 300> mark @mark_top';
} contextual_positioning ;

I’ve tried using Wei’s method of using external .fea files and using the Replace Prefix and include options but this puts the lookup in the beginning (thus getting overwritten by the auto-generated ABVM code) despite me using # Automatic Code End. Also, for the include method I need to specify markClass which may be affecting the order?

Any help is appreciated! Many thanks in advance :slight_smile:

EDIT: feature code Syntax
EDIT: More context

The class names in the code sample are lacking the @ at the beginning.

Which class names? base_glyphs and more_base_glyphs is used as placeholder for glyphs names.

I’ve edited it to make it more obvious.

Ah, I see. Can you:

  1. try in build 1252?
  2. send me a file that shows the unwanted behavior?

Sure, sending it right away.

[Build 1339]

I tried to replace the blwm feature in an instance, but it didn’t work.

In Font Info → Features:

# Automatic Code End
script khmr;
pos ka-khmer uaMark-khmer' <100 0 0 0>;

In Replace Feature parameter in Medium instance:

# Automatic Code End
script khmr;
pos ka-khmer uaMark-khmer' <20 0 0 0>;

The generated .fea file for Medium is not replaced with the value from the custom parameter.

Sample file: TEST_01.glyphs (18.5 KB)
Text: កួ

Any update on this? I’m also trying to input different positioning values for each instance. Example:

Replace feature (Black instance)

#Automatic Code End
pos [macroncombdouble macroncombdouble.wide] @ThaiAboveMarks' <0 500 0 0>;

This has no effect, the positioning is the same as in every other instance.

@sovichet did you manage to solve your case? Did you try without the Khmer script tag? I noticed also you don’t have the feature tag mark; on your first line.

There’s indeed something very fishy going on. I want to write default positioning values for the regular master, but then add different values for the other weights. In this particular situation (doublemacroncomb + Thai marks) I need to add the Thai script tag to the lookup or nothing happens at all.

If I put the positioning into the mkmk feature, with an # Automatic Code End statement, it works in the regular weight, but when I replace with a custom parameter to adjust those values in the Black master, the Regular values are still used.

If instead I put the positioning into the dist feature, and have the custom parameter to replace it in the other weights, (removing the # Automatic Code End statement, because there is no automatic dist code), only one of the rules is applied in the Regular and Black, and all other contexts are ignored.

Hi Bendy,

Did you try this approach? For what it’s worth, i’ve never gotten this to work. I ended up using fontmake with replace feature custom parameter at master-level (unsupported by Glyphs, but supported by GlyphsLib with the added advantage of the values interpolated automatically for intermediate instances.

Maybe try it out? Let me know if you’re running into issues.


1 Like

Thanks Kalapi, will try this idea. I already tried putting each instance’s positioning rules in a separate lookup in a prefix and then calling the correct one using ReplaceFeature, but unfortunately that didn’t work. @GeorgSeifert is there a way you can advise, or fix the ReplaceFeature mechanism in G2?

I fixed it.

1 Like

Wow, Georg, that sounds fantastic! Look forward to trying it out with the next update, thank you :slight_smile:

This is working beautifully, thank you. One request, could the colour coding work the same way as in the main features panel? Much easier to work with when the keywords turn blue.

That is done in a future version.

1 Like

I’m on 2.6.7 (1355) and the # Automatic Code End bit has stopped working again. Any idea why?

Okay I was able to debug this. Then using the # Automatic ... tag with the dist feature, if a script tag is included, Glyphs fails to include the lookups. If there is no scripts tag, the lookups will be added to all scripts (which I think is still a bug, but it doesn’t affect the work i’m doing now so should be fine).

1 Like