Wildly OT: pop-up virtual keyboard for Mac or Linux?

Chris Angelico rosuav at gmail.com
Tue Feb 10 17:12:43 EST 2015


On Wed, Feb 11, 2015 at 8:33 AM, Laura Creighton <lac at openend.se> wrote:
> I'm using this:
> http://michel.staelens.pagesperso-orange.fr/clavier/index_GB.htm#
> to get cyrillic.  Not sure the other alternatives will get you what
> you want -- my keyboard is rather well loaded with accented letters
> from the get-go.

That looks a lot more general than what I use:

https://github.com/Rosuav/shed/blob/master/translit.pike

The code's a bit messy, largely because the human languages involved
are complex, but broadly, here's the plan:

Mode 1: Reversible transliteration. In any of several modes (Cyrillic
(Russian, Ukrainian, and Serbian variants), Korean, Elder Futhark, and
Greek), it converts the input ASCII text into a non-ASCII script, and
back again. Normally I use that to key in text that I can't otherwise
type, but I can also copy and paste the other script and check it.
Some of them also support diacriticals, as per the other mode.

Mode 2: Latin-only mode. Fairly simple: the 'diacriticals' function
just transforms some backslash escapes into individual Unicode
characters, usually the combining ones, and then performs an NFC
normalization on the resulting string. So, for instance (using Python
string literal format; in actual usage, these would be single
backslashes):

Input: "\\!Sue\\'ltalo!"
Step 1: "\u00A1Sue\u0301ltalo!"
Step 2:"\u00A1Sue\u0301ltalo!"
Step 3: "\u00A1Su\u00E9ltalo!"
Displayed text: ¡Suéltalo!

In usage, it's pretty simple. You key in a letter, then you hit
backslash and a (usually mnemonically-appropriate) symbol, and it
combines in an appropriate diacritical mark. There are a few oddities
in the transformation table (for instance, "i\." produces a dotless i,
but "I\." produces a dotted I; and "\-" produces a combining macron,
unless it follows a D or d, in which case it produces a crossed D), so
if you want to adapt this for your own use, you may want to throw out
some of the transformations. But if you only occasionally have need of
these kinds of letters, it may be easiest to just keep this handy, key
in what you want, and then clipboard it to whatever you want to work
with.

ChrisA



More information about the Python-list mailing list