OpenType feature to flip between two sets

Pieter van Rosmalen's picture

Hi all,

I'm working on a typeface with two versions of each character. I made two sets and called them @set1 and @set2. Every set has five characters after which I like to 'swap' to the other set. The characters are C E J S Z and c e j s z.
For example. I like to go like this: ABCdeFGHIJklmnopqrsTUVWXYZabcDE etc
I can't get the code working, can somebody help me?
Thanks!

Pieter

Pieter van Rosmalen's picture

This is the feature I wrote:


feature liga {
# Latin
sub C @set1' by @set2;
sub E @set1' by @set2;
sub J @set1' by @set2;
sub S @set1' by @set2;
sub Z @set1' by @set2;
sub c @set2' by @set1;
sub e @set2' by @set1;
sub j @set2' by @set1;
sub s @set2' by @set1;
sub z @set2' by @set1;
sub @set2 @set1' by @set2;
sub @set1 @set2' by @set1;
} liga;

Pieter

Stephen Rapp's picture

You might need to show us what your classes are, but from the get go this doesn't look like it belongs in the liga feature, but rather calt.

Jackson's picture

Are you saying you want to use those letters as a switch to change all the letters that appear after them?

Pieter van Rosmalen's picture

@ Stephen: I know, but I choose the liga feature because it's on at default in a few programs.

@ Jackson: Yes, that's what I like.

classes:

@set1 = [A B C D E F G H I J K L M N O P Q R S T U V W X Y Z];
@set2 = [a b c d e f g h i j k l m n o p q r s t u v w x y z];

Thanks!
Pieter

Jackson's picture

The main problem is that the trigger glyphs were in the classes you were switching. Try this:

feature CALT {

@set1 = [A B D F G H I K L M N O P Q R T U V W X Y];
@set2 = [a b d f g h i k l m n o p q r t u v w x y];
@trip1 = [C E J S Z];
@trip2 = [c e j s z];

sub @trip1 @set1' by @set2;
sub @trip1 @set2 @set1' by @set2;
sub @set2 @set2 @set1' by @set2;
sub @set2 @set2 @trip1' by @trip2;

sub @trip2 @set2' by @set1;
sub @trip2 @set1 @set2' by @set1;
sub @set1 @set1 @set2' by @set1;
sub @set1 @set1 @trip2' by @trip1;

} CALT;

Pieter van Rosmalen's picture

Hello Jackson,

Thanks for the code, but unfortunately it's not working: ABCdefghijklmnopqrstuvwxyz
It's not flipping back to @set1 anymore.

This is what I like to happen: ABCdeFGHIJklmnopqrsTUVWXYZabcDEfghijKLMNOPQRSTuvwxyzAB etc

Pieter

Jackson's picture

feature CALT {

@set1 = [A B D F G H I K L M N O P Q R T U V W X Y];
@set2 = [a b d f g h i k l m n o p q r t u v w x y];

@trip1 = [C E J S Z];
@trip2 = [c e j s z];

sub @set1 @trip1 @set1' by @set2;
sub @set2 @trip2 @set2' by @set1;

sub @trip1 @trip1' by @trip2;
sub @trip2 @trip2' by @trip1;

sub @set2 @set1' by @set2;
sub @set2 @trip1' by @trip2;

sub @set1 @set2' by @set1;
sub @set1 @trip2' by @trip1;

} CALT;

I should've paid more attention to your string...

Jackson's picture

Err.. needed one more thing:

feature CALT {

@set1 = [A B D F G H I K L M N O P Q R T U V W X Y];
@set2 = [a b d f g h i k l m n o p q r t u v w x y];

@trip1 = [C E J S Z];
@trip2 = [c e j s z];

sub @set1 @trip1 @set1' by @set2;
sub @set2 @trip2 @set2' by @set1;

sub @trip1 @trip1' by @trip2;
sub @trip2 @trip2' by @trip1;

sub @set2 @set1' by @set2;
sub @set2 @trip1' by @trip2;
sub @trip1 @set1' by @set2;

sub @set1 @set2' by @set1;
sub @set1 @trip2' by @trip1;
sub @trip2 @set2' by @set1;

} CALT;

Jackson's picture

Err.. needed one more thing:

feature CALT {

@set1 = [A B D F G H I K L M N O P Q R T U V W X Y];
@set2 = [a b d f g h i k l m n o p q r t u v w x y];

@trip1 = [C E J S Z];
@trip2 = [c e j s z];

sub @set1 @trip1 @set1' by @set2;
sub @set2 @trip2 @set2' by @set1;

sub @trip1 @trip1' by @trip2;
sub @trip2 @trip2' by @trip1;

sub @set2 @set1' by @set2;
sub @set2 @trip1' by @trip2;
sub @trip1 @set1' by @set2;

sub @set1 @set2' by @set1;
sub @set1 @trip2' by @trip1;
sub @trip2 @set2' by @set1;

} CALT;

Thomas Phinney's picture

"@ Stephen: I know, but I choose the liga feature because it’s on at default in a few programs."

So is calt.

T

Pieter van Rosmalen's picture

Hello Jackson,

It's working! Thank you very much! You made me a happy man.

Pieter

Pieter van Rosmalen's picture

Hello Thomas,

I didn't know that. Thanks!

Pieter

Pieter van Rosmalen's picture

Hello Jackson,

I like to thank you again! :) It's perfect!

Pieter

Jackson's picture

No problem, that was a fun distraction on a lazy working day.
I'm curious how this is going to translate into a design, look forward to seeing it.

Pieter van Rosmalen's picture

Hello Jackson,

I will show you later. It's for a client and I'm not allowed to show it before the official introduction.

Pieter

Jackson's picture

Awesome, good luck!

dezcom's picture

...
ChrisL

Syndicate content Syndicate content