Experimental (idiotic) use of Opentype. Help?

Lewis_Bullock's picture

Hi,

I am nearing the end of a project I'm doing using Opentype features in an experimental way. I call it experimental because my usage isn't particularly informed and there's probably a much easier way to be doing this. That's where I'd like your help.

I have set myself up to translate (I use translate very loosely) "txtspeak" into normal english (hereby called 'txt' and 'text'). I have beginners knowledge of coding Opentype features and my idiocy will probably make a lot the experts squeal, but I don't mind that. Current ignorance has proven to be experimental bliss, but I'm more than willing to dive into deeper grounds to rectify problems I think I will ultimately come across.

So far I've used "calt" to swap words from the 'txt' spelling into 'text' spelling i.e. "txt" into "text", "shizz" into "stuff" and so on. I've also used "dlig" to swap profanities into asterisked words (I won't be as rude to give an example of that).

Here's where you cringe: I've told the "calt" feature to

sub d d n t space by d_i_d_n_singlequote_t_space ;

For the "ddnt"»"didn't" this has worked great as it has with "shiz"»"stuff" and a few others. I came across a problem when I tried "iz"»"is" because the spaces either side of "iz" when typing were, or rather could be, eaten up by translating a word before it. So, the code became

sub space i z space by space_i_s_space ;
sub i z question by i_s_question ;
sub i z exclam by i_s_exclam ;
sub i z period by i_s_period ;
sub i z comma by i_s_comma ;
sub i z space by i_s_space ;

Lewis_Bullock's picture

Cont...(pt.2)

Here you can see I accomodated the space after "iz" to be grammatical points also for if the word is used at the end of a sentence. To accomodate the word existing in the middle of a sentence, with the possibility of a space-eating word existing just before that, I made the last line of code above. This caused problems with words such as "quiz" and "whiz". I rectified this by writing in the code:

sub i z space by i_s_space ;
sub b i z space by b_i_z_space ;
sub b i z question by u_i_z_question ;
sub b i z exclam by u_i_z_exclam ;
sub b i z period by u_i_z_period ;
sub b i z comma by u_i_z_comma ;

Lewis_Bullock's picture

Cont...(pt.3)

I did this with all possible preceeding characters (in this case b, f, w, p, u, r and t). I got this info (ashamedly off a website) to lessen my already rapidly growing glyph library by only including active/popular preceeding characters to "iz". This also worked fine until "y"»"why" when after coding twenty-four possible preceeding letters and their possible grammatical endings, the sentence "iz y, yet" turned into "is why, whyet". I countered this by including:

sub space y e by space_y_e ;
sub y e by y_e ;

Lewis_Bullock's picture

Cont...(pt.4)

This solved the problem sentence given yet I can't help feel it's going to have repercussions later on in the project. Words before worked fine and after-words such as "yet" and "youth" both work when the word eats space to the right in translation and doesn't eat space to the right.

I haven't use classes because the class style I used (@lc) didn't replace the lowercase character. I also don't know of any 'if'-like parameters used in flash. I do however, realise that flash may be a much easier way to do it (with learning), like Amy Papaelias used in her 2005 TypeTalk project but I feel this is a pseudo-solution in that it doesn't use Opentype features to do the translation. I'm sticking to my guns (I can justify later if interested) by using Opentype but the deadline is looming and I fear it may fall flat on it's face at a future point.

Here is where I'd like to ask for help, advice, questions of "why are you even doing this?" and vexed virtual slaps for the insane mis-use of Opentype. I will also happily send my Fontlab files to those wishing to poke around at the code.

Thanks in advance and apologies for the "post-and-comment" structure of this post,
Lewis

Nick Shinn's picture

Amy did this in OpenType in 2005.
She used Flash for online simulation, as it has proven difficult to implement interactive OpenType "typesetting" online.
Only last year, MyFonts introduced the first OpenType online "Type Tester".
IIRC Richard Kegler at P22 has done similar work.

Stephen Rapp's picture

I think part of the problem with the "sub i z space by i_s_space ;" part of the code is your intention seems to be for a beginning of line context. I usually use a lookup for this. First create a class: such as:
All = all letters including space

feature clig {

lookup calt_iz.start {
ignore sub @All i' z';
sub i' z' by i_s;
} calt_iz.start;

} clig;

Stephen Rapp's picture

Oops… That should be:

feature clig {

lookup calt_iz.start {
ignore sub @All i' z';
sub i' z' space by i_s;
} calt_iz.start;

} clig;

Stephen

Lewis_Bullock's picture

Thanks for the replies guys.

@Nick: I've sent Amy an email to ask for tips so fingers crossed. Do you have anything more on Richard Kegler's work of the same vein? I found this interview where he describes random Opentype features to alternate a distressed look but couldn't find anything about word substitution?

@Stephen: Thanks for the coding. I tried a naked test file and it worked perfectly to change the 'iz' usage to 'is' when at the start of a sentence and not elsewhere as you said. However, I need to change all instances of 'iz' into 'is', neglecting those at the end of words (like whiz) or in the middle of words (fizz) or with letters following (izaak). It's very possible that I'm trying to manipulate basic Opentype to do things that other strings of code can do. Would it be possible for you to explain the sections of your code or forward me to a code-learning site?

Thanks again,
Lewis

Lewis_Bullock's picture

Update:

I've just received a (speedy!) reply from Amy who has given me a great link for anybody interested.

This project is admittedly my first usage of Opentype, so it's been quite a learning curve and whilst I'm still trying to wrap my head around the coding side, it has been so much better for it. Thanks again for everyone's input!

Lewis

canderson's picture

I recall playing around with some of my own "prank" font experiments as soon as learned about the feature. There was nothing as well thought out as what Amy did. The problem with creating a diabolically funny prank font circa 2005 was that few applications supported OTF layout. OpenType can do more crazy stuff than just the calt as well.

I think I also played around with the idea of the "secret word". That is, you type a secret word and get a special ligature or symbol. Of course with the various glyphs pallets people can still find it, so its not very exclusive.

Syndicate content Syndicate content