Is there a way to create a font that uses the two Shift keys differently?

I'm not a professional font creator, so excuse me if I don't know much terminology. I'm hoping to create a font that has three options per letter--regular and two different diacritics--and one Shift key will add a diacritic, the other Shift key will add a different one. Does anybody know of font creating software capable of this? I haven't been able to find any information about a font that works this way.

Comments

  • In a word: no. Information about which keys were pressed does not make it down to the font (or even rendering) layer. The only way to achieve this would be custom keyboard layout software.
  • To provide a more detail beyond what Simon said (a bit technical, but useful to understand): 

    Digital text has an encoded form, which almost ubiquitously is Unicode. This assigns a numeric encoding for every character of every writing system, and that is how characters are stored in a computer or transmitted between computers. For example, the numeric value 65 (in Unicode hex notation, U+0041) is used as the encoded representation for Latin capital letter "A"; the value 3,627 (U+0E2B) is used to represent Thai letter ha "ห", etc.

    Everything that happens when entering, processing, or displaying text is done in terms of the encoded representation inside the computer. When you press a key on a keyboard and see something display on the screen, there is not a direct connection from keyboard to font. Rather there are two sequential interactions: the keypress results in generating the encoded representation stored in the computer, then a separate process takes that encoded representation and displays it on the screen using a font.

    The important point here is that there is no direct connection between a shift key or any other key and a font. The effect of pressing keys is to generate Unicode encoded sequences stored in the computer, and what the effect is of any key depends entirely on the programming of a keyboard input method. In principle, a keyboard input method can be created to allow two shift keys to behave differently in terms of the encoded sequences that get generated, but that is not common. On the other hand, it is not uncommon for the right Alt key on a PC to have different effects than the left Alt key.

    When creating a font, you generally should not be thinking about keying sequences that produce different visual results. Rather, you should think in terms of Unicode character sequences, and creating a font that will produce a display of text that reflects the Unicode-defined semantics of the encoded characters. Then, if you need a particular keying experience, there would be an independent exercise of creating an input method that produces a Unicode character sequence from the desired keypress sequences.

    If you create a font that produces some custom association between keystrokes and display, then most likely what you will have done is to create a font that assigns glyphs to Unicode encoding in a misaligned way, so that the font does not match the underlying Unicode semantics of the data. That will make the font and the data produce unusable by anyone except if displayed by that font.

    Back in 2001, I wrote a chapter in a book explaining these concepts; it's available online here:

    http://scripts.sil.org/cms/scripts/page.php?item_id=IWS-Chapter03

    In section 4, I gave an example of how this approach leads to data that works with the specific font but doesn't get along with anything else, which can lead to unexpected and undesired results.


    Hope that's not way too long to be helpful.
  • @Peter Constable is of course right. But to put it in more simple terms... what you want isn't a special font, it is a custom keyboard... on Windows, you'd want to use Keyboard Layout Creator, I think. https://www.microsoft.com/en-us/download/details.aspx?id=22339

    No idea if it can treat the two shift keys differently! That's another question....
  • James PuckettJames Puckett Posts: 1,470
    If the differences between diacritics are just stylistic you can put them into a stylistic set (an OpenType feature). But the software you’re using might not support stylistic sets.
  • I know it's possible to write code low-level enough to access specific keys... assuming keyboards haven't changed since the Commodore 64.  :->
  • I used the Microsoft Keyboard Layout Creator to create the customised keyboard that I need for typing Pāḷi. It relies heavily on dead keys for easy typing of different accents.
  • John SavardJohn Savard Posts: 140
    It certainly is possible to write Windows programs that obtain scan codes corresponding to keypresses from the keyboard, rather than requesting input of ASCII characters. Many game programs do so.

    However, the techniques involved are still considerably different from what would be used by a program written for the Commodore 64.

    The keyboard on a PC-compatible computer isn't part of the computer, and it could be connected by means of a PS2 connector (the internal connections of today's laptop keyboards are of that type) or by USB. In those two cases, a completely different set of scan codes are used - and the scan codes are translated by the operating system and/or device drivers.

    I wrote a program that edited upper- and lower- case on the Commodore 64; it worked by copying BASIC to RAM and just changing the keyboard layout table rather than attempting to drive the keyboard directly, though.
Sign In or Register to comment.