How does the tilde-input work?

sepp88's picture

Hey guys,

I wondered if someone could explain to me how the input of the tilde acutally works and if I can emulate/imitate the same key-behaviour in OTF substitution?

I'm talking about the following fact:

I'm able to type ALT-N and create a "selected" Tilde. If I keep typing for instance an a I get an a-tilde character.
However if I press the space-bar the Tilde is going to stay in place and I can go on with my typing.

Is it possible to mimic this behaviour in OTF programming?

Thank you in advance,
Sepp

John Hudson's picture

You wouldn't want to. The keyboard behaviour you observe is an Apple deadkey input mechanism, so what ends up stored in the text strings are the appropriate precomposed Unicode diacritic characters, such as ã ñ etc..

OpenType Layout is glyph level processing that doesn't affect character strings, so you would end up displaying ã or ñ but the text string behind them would be ~a and ~n.

sepp88's picture

Dear John,

thank's for your answer: I know that the text-string behind it would be ~a and ~n and I'm fine with this.
I'm working with this for a university project where this is totally ok.

Is it technically possible to do this with OTF programming?

E.g. sub degree p by pring;
So when I type the degree and a p I get a new character p with a ring above.
I know that the underlying string would still be degree and p however it displays the thing I'm after.

Now imagine i just want to type °p side by side. I would need to be able to have the same mechanism like the tilde is having right now.

Is that possible somehow?

Kind regards,
Sepp88

agisaak's picture

In principle you could, but you'd be much better off editing your keyboard layout to achieve this goal. Google 'SIL Ukelele'.

André

sepp88's picture

Dear Agisaak,

thank you for the Tipp. I'll give Ukelele a try.

However I'd still be very interested in how to achieve this with OTF programming. Would you mind giving me a link or any direction how to do this?

Thank you in advance.

Michel Boyer's picture

There is no letter "latin small letter p with a ring above" in unicode. You can however get a p with a ring above when you type p followed by U+030A, "combining ring above" in Times New Roman, Calibri, Cambria etc.

Modifying an Austrian keyboard layout so that ° becomes a dead key and so that when you type °p side by side you get p followed by the combining ring above is quite easy. That means that with such a layout, you can type °p side by side and get p with a ring above in Times New Roman, Calibri etc. without ever modifying those fonts (which you are not allowed to do, anyway). That will work with any font that correctly handles combining diacritical marks. Switching from one keyboard layout to another can be done quite fast (just typing command space for instance). I regularly switch between the US Extended and the Canadian French CSA keyboard layouts that way.

John Hudson's picture

Yes, what you want to do is certainly possible with OTL. I still think it's a bad idea, but the implementation is pretty easy. Most of what you'd do is simple ligature lookups e.g.

asciitilde n -> ntilde

For any sequence not covered in the ligature lookup, you'd get ~ followed by whatever came next.

In the special case where you want to display '~n' instead of 'ñ', you could easily mimic the deadkey keyboard behaviour, using a contextual ligation lookup that removes the space glyph when '~ ' is followed by any of the letters in the first ligature lookup coverage, e.g.

asciitilde space -> asciitilde
| n etc.

[Note that I've used VOLT lookup syntax here. If you're using an AFDKO-based tool for OTL programming, you'll need to translate this into the appropriate syntax.]

Igor Freiberger's picture

Matthias, I have my MacBook keyboard completely customized with Ukelele to make typing easier. The app is not hard to learn, but I consider its documentation a bit confusing. If you face any trouble, fell free to contact me.

Syndicate content Syndicate content