Typophile

Getting the first glyph of a word/sentence in openType?

Heedless

I've been playing around with fontlab/openType for a school assignment but I'm not really getting it.

I'm really interested in scripting a font. A teacher told me you don't have a lot of options nowadays since postscript type 3 isn't supported anymore? But you should still be able to do some nice things with openType I think.

What I am after is the following;
I'm making a font that lets all the characters respond to each other. Basically I want to check what the first character of a word is, and let the other characters choose the appropriate glyph based on that.

So, when I write 'nosebleed' (wow, random) I want the o,s,e,b,l,d to choose their glyphs belonging to the n, some something like o.n, s.n, e.n etc.

For the combination CA you could do something like this:

feature replace{
sub C A by C.A; (where C.A is a glyph containing both a C and an special version of the A)
} replace;

But of course, this won't let you change the whole word.

This;
ignore substitute @LETTER f' i';
substitute f' i' by f_i.init;

Lets you change glyphs to make a ligature at the beginning of a word. But can you reverse this? Like; only replace the glyph if it's NOT at the beginning of the word, and replace it by it's version belonging to the FIRST character of the word.

In other scripting languages I would do something like this:

See if the typed character is the first character of the word being typed.
If it is, use the standard glyph. If not, see what the first character was and make the typed character the glyph 'typedCharacter.firstCharacter';

Does anyone know if there is a way to do this? Or something like this? Or something to get me started?

Check out the OpenType features for positional forms: init, medi, fina, isol. They are made for stuff like this. I think InDesign CS3 supports them.

A more conventional approach would be a calt feature, something along these lines:

sub [A A.A B.A C.A D.A E.A] [A B C D E]' by [A.A B.A C.A D.A E.A];
sub [B A.B B.B C.B D.B E.B] [A B C D E]' by [A.B B.B C.B D.B E.B];

[A B C D E]' will be replaced, the class before is is what serves as context. This means, in the first line, any glyph following an A will be replaced by an .A alternate, and any subsequent glyph (i.e. following an .A alternate) will be replace by an .A alternate too. The first glyph of a word will not be replaced -- the above context definition requires that at least one glyph precedes the glyph to be replaced.
Just wondering, how many alternates do you want to draw?  ;-)

Well, I have to make a typeface with the full 256 characters, so that means something like 265 * 265 = 70.255 glyphs

But I'm not even sure if that amount is supported.
I won't make them all myself. I'm pretty handy with scripting, so I'll just write some script which will generate the glyphs in PDF / illustrator format (and then I'll have to find a way of easily importing them in fontlab, instead of copy pasting them).
But I think I will start with about 5 * 5 = 25 glyps so see if it works :p

Thanks for the reply btw

Karsten,
Are your replacements ligatures or single glyph alternates in your example?

ChrisL

You may need the Asia-Font Studio because FLS refuses to save fonts with more than, I don't remember, 6000-7000 glyphs.  :D

Hello Mr Lozos, it's just glyph alternates. I used as suffix the first-glyph-of-word to which the alternate relates, so "B.A" is an alternate B which is used in words starting with A.

> You may need the Asia-Font Studio because FLS refuses
> to save fonts with more than, I don’t remember, 6000-7000
> glyphs. :D

6,399 is the maximum number of glyphs in a font that can be created with FontLab Studio 5. You should be glad to hear that this limit will be lifted in FontLab Studio 6 (which we are working on) so the maximum number of 65,535 glyphs per font will be possible.

Adam

Ah, now I get it, forgive a blind old geezer :-)

ChrisL

Captured from web.archive.org on 28 Jan 2013. view this capture