Add Contextual Alternates to Mimic Random Glyph Rotation

Before asking a question on FontCreator look here for possible solutions and tutorials. Please do not post support requests here.
Erwin Denissen
Moderator
Moderator
Posts: 6589
Joined: Fri Oct 04, 2002 12:41 am
Location: De Bilt, The Netherlands
Contact:

Add Contextual Alternates to Mimic Random Glyph Rotation

Postby Erwin Denissen » Thu Feb 06, 2014 4:20 pm

Over the years numerous people have experimented and even implemented pseudo random functionality in/with fonts.

The idea is type one or more characters, and use different glyphs for the same character. This can be accomplished by adding Contextual Alternates to your font.

In this example, we will have a font which contains only one character, namely the zero. It also contains four alternate glyphs for it.
fontcalt.png
fontcalt.png (28.18 KiB) Viewed 2906 times


We will then add this script through the OpenType Layout Feature editor.

Code: Select all

script latn {
  # Latin
  feature ContextualAlternates1;
}

group @Group1 [zero];
group @Group2 [zero.2];
group @Group3 [zero.3];
group @Group4 [zero.4];
group @Group5 [zero.5];

feature ContextualAlternates1 calt {
  # Contextual Alternates
  lookup Lookup1;
  lookup Lookup2;
}

lookup Lookup1 {
  # Referenced by feature "ContextualAlternates1"
  context (@Group1) @Group1;
  sub 0 Lookup3;
  context (@Group2) @Group1;
  sub 0 Lookup4;
  context (@Group3) @Group1;
  sub 0 Lookup5;
  context (@Group4) @Group1;
  sub 0 Lookup6;
}

lookup Lookup2 {
  # Referenced by feature "ContextualAlternates1"
  context (@Group5 @Group4) @Group1;
  sub 0 Lookup7;
  context (@Group2 @Group5) @Group2;
  sub 0 Lookup7;
  context (@Group4 @Group2) @Group3;
  sub 0 Lookup7;
  context (@Group1 @Group4) @Group4;
  sub 0 Lookup7;
  context (@Group5 @Group1) @Group5;
  sub 0 Lookup7;
  context (@Group3 @Group5) @Group1;
  sub 0 Lookup7;
  context (@Group2 @Group3) @Group2;
  sub 0 Lookup8;
  context (@Group1 @Group2) @Group3;
  sub 0 Lookup8;
  context (@Group4 @Group1) @Group4;
  sub 0 Lookup8;
  context (@Group3 @Group4) @Group4;
  sub 0 Lookup9;
}

lookup Lookup3 {
  # Referenced by lookup "Lookup1"
  sub zero -> zero.2;
}

lookup Lookup4 {
  # Referenced by lookup "Lookup1"
  sub zero -> zero.3;
}

lookup Lookup5 {
  # Referenced by lookup "Lookup1"
  sub zero -> zero.4;
}

lookup Lookup6 {
  # Referenced by lookup "Lookup1"
  sub zero -> zero.5;
}

lookup Lookup7 {
  # Referenced by lookup "Lookup2"
  sub zero -> zero.2;
  sub zero.2 -> zero.4;
  sub zero.3 -> zero;
  sub zero.4 -> zero.5;
  sub zero.5 -> zero.3;
}

lookup Lookup8 {
  # Referenced by lookup "Lookup2"
  sub zero.2 -> zero;
  sub zero.3 -> zero.4;
  sub zero.4 -> zero.3;
}

lookup Lookup9 {
  # Referenced by lookup "Lookup2"
  sub zero.4 -> zero.5;
}


And we're ready to test it!

fontwofftest.png
fontwofftest.png (63.48 KiB) Viewed 2906 times


Here is the project file, in case you want to further experiment with this.
AlmostRandom.fcp
(5.06 KiB) Downloaded 130 times


And here is the online web font demo, so you can play with it.
http://www.high-logic.com/fontcreator/d ... index.html
Erwin Denissen
High-Logic
Proven Font Technology

Erwin Denissen
Moderator
Moderator
Posts: 6589
Joined: Fri Oct 04, 2002 12:41 am
Location: De Bilt, The Netherlands
Contact:

Re: Add Contextual Alternates to Mimic Random Glyph Rotation

Postby Erwin Denissen » Fri Feb 07, 2014 10:29 am

And here is the OpenType font made with FontCreator.

AlmostRandom.otf
(4.21 KiB) Downloaded 147 times
Erwin Denissen
High-Logic
Proven Font Technology


Return to “FontCreator - Tutorials and Solutions”

Who is online

Users browsing this forum: No registered users and 3 guests