Different parens before and after lowercase and uppercase

Hi,
I designed two different parenleft and parenright which should appear before and after lowercase and uppercase words (excepting: d, f, l). After lowercase it is optically centered to the x high.
Now these are alternates but it should work as an opentype feature.
I think this should be something contextual alternate feature but I don’t know how.
Could anyone help me in it?
Thank you.

Consider a situation like: (Example), your attempted solution would output two unequal parentheses. I suggest naming your uppercase parentheses with a .case suffix. That way the user can decide. And all cap setting will trigger it.

If you still want to do a contextual substitution, take a look at this tutorial: https://www.glyphsapp.com/tutorials/features-part-2-contextual-substitutions

1 Like

Thank you Mekkablue!

The uppercase glyphs are the normal parens and the lowercase glyphs are the unusual ones.

I am trying now this:
sub [a c d e g i j m n o p q r s t u v w x y z] ‘parenleft.alt by parenleft.alt;
sub [a b c e g h i j k m n o p q r s t u v w x y z] parenleft.alt’ by parenright.alt;

it should be like this:

lowercase = [a c d e g i j m n o p q r s t u v w x y z]; // define a class in the class section.

sub parenleft' @lowercase by parenleft.alt;
sub @lowercase parenright' by parenright.alt;
1 Like

Thank you!
at the calt section?

Yes.

1 Like

I made a lowercase class but i got an error message:
syntax error at “lowercase” missing

You need to call the class ‘lowercase’ and it should only contain glyph names.

1 Like

Hi everyone,

I’m trying to use calt to automatically swap bracket glyphs when they enclose uppercase letters. Ideally, the logic would be (and always apply to both brackets):

  • (Word) → no calt

  • (WORD) → calt

With my current approach (sub parenleft' @uppercase by parenleft.calt; sub @uppercase parenright' by parenright.calt;), the opening bracket can be substituted while the closing bracket remains unadjusted, which means the brackets are not in sync.

I understand that OpenType calt can only look one glyph forward or backward. Is there a way in Glyphs (or in OpenType syntax) to conditionally trigger alternates based on the case of the entire bracketed sequence, so that opening and closing brackets are always matched? Or is manual substitution via ssXX the only solution?

No. That kind of variable context is beyond Opentype.

1 Like

I found a work around which works for most sane cases:

sub parenleft' @uppercase [@uppercase parenright] by parenleft.calt;
sub @uppercase parenright' by parenright.calt;
sub braceleft' @uppercase [@uppercase braceright] by braceleft.calt;
sub @uppercase braceright' by braceright.calt;
sub bracketleft' @uppercase [@uppercase bracketright] by bracketleft.calt;
sub @uppercase bracketright' by bracketright.calt;

You can have several characters of context:

lookup parenUpper1 {

sub parenleft' @Uppercase @Uppercase @Uppercase @Uppercase @Uppercase @Uppercase @Uppercase parenright by parenleft.calt;
sub parenleft' @Uppercase @Uppercase @Uppercase @Uppercase @Uppercase @Uppercase parenright by parenleft.calt;
sub parenleft' @Uppercase @Uppercase @Uppercase @Uppercase @Uppercase parenright by parenleft.calt;
sub parenleft' @Uppercase @Uppercase @Uppercase @Uppercase parenright by parenleft.calt;
sub parenleft' @Uppercase @Uppercase @Uppercase parenright by parenleft.calt;
sub parenleft' @Uppercase @Uppercase parenright by parenleft.calt;
sub parenleft' @Uppercase parenright by parenleft.calt;
} parenUpper1;
lookup parenUpper2 {

sub parenleft.calt @Uppercase @Uppercase @Uppercase @Uppercase @Uppercase @Uppercase @Uppercase parenright' by parenright.calt;
sub parenleft.calt @Uppercase @Uppercase @Uppercase @Uppercase @Uppercase @Uppercase parenright' by parenright.calt;
sub parenleft.calt @Uppercase @Uppercase @Uppercase @Uppercase @Uppercase parenright' by parenright.calt;
sub parenleft.calt @Uppercase @Uppercase @Uppercase @Uppercase parenright' by parenright.calt;
sub parenleft.calt @Uppercase @Uppercase @Uppercase parenright' by parenright.calt;
sub parenleft.calt @Uppercase @Uppercase parenright' by parenright.calt;
sub parenleft.calt @Uppercase parenright' by parenright.calt;

} parenUpper2;

Add as many line as you need.
and use the class name Uppercase. Then Glyphs can update it automatically.