sunyuping / networkpx

Automatically exported from code.google.com/p/networkpx
0 stars 0 forks source link

Combining characters #29

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The Greek alphabet has a total of 24 characters. However, some of those 
characters can get 
diacritical marks. In modern Greek, the diacritical marks that are still in use 
are: “oxia”, “dialytika” 
and “dialytika tonos”. 
(http://en.wikipedia.org/wiki/Greek_alphabet#Combining_and_letter-
free_diacritics)

Would it be possible for someone to create an iKeyEx keyboard with the 
capability to insert 
combined characters? (http://en.wikipedia.org/wiki/Combining_diacritical_mark). 
This capability is 
already offered with the official Korean keyboard, some of those characters can 
be combined.

Original issue reported on code.google.com by ppericle...@gmail.com on 25 Jan 2009 at 9:04

GoogleCodeExporter commented 8 years ago
Yes. Just use \U03xx for the diacritics.

In the current version the position shown will be moved a bit, however. 

Original comment by kennytm@gmail.com on 26 Jan 2009 at 6:37

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I’m sorry to bother you with silly questions but I didn’t understand how I 
am supposed to do that! In order to 
use \U03xx, should I create/program an iKeyEx keyboard that recognizes which 
characters should be 
combined when typed consecutively? If that is the case, then unfortunately I 
cannot do that, I don’t know how.

I read on issue 32 that you are planning to add support that would allow 
combining characters to be typed. 
Does this mean that I would then be able to do that just by making some changes 
to layout.plist?

My idea of an ergonomic, complete and efficient Greek keyboard is displayed in 
the following two pictures. 
Diacritical marks displayed in the variants pop up are the ones that need to be 
combined with some of the 
vowels. Moreover, it would be great if there was a way to make the artwork 
display the special character "ς" 
instead of only the capital "Σ". Would something like that be possible using 
iKeyEx?

http://img91.imageshack.us/img91/8083/picture4234ni5.png
http://img220.imageshack.us/img220/1922/picture3mb4.png

Original comment by ppericle...@gmail.com on 27 Jan 2009 at 12:28

GoogleCodeExporter commented 8 years ago
@3:

Yes. You can look at the variants.plist of MathTyper by the way. The "V" key 
contains
a lot of combining characters.

Whether to combine is not a job of iKeyEx, it's the job of the iPhoneOS, and it
handles that nicely.

Original comment by kennytm@gmail.com on 27 Jan 2009 at 8:28

GoogleCodeExporter commented 8 years ago
I'm sorry, I think I didn't make myself clear. I don't want to insert combined 
characters by holding down a key 
and selecting them from the popup. I want to press two different keys and have 
a combined character as a 
result of my action.

For example, I want to be able to press the "΄" key and then press the "α" 
key in order to input "ά". I know that 
I can have "ά" in variants.plist but this way of typing in Greek is time 
consuming. I would have to press and 
hold a key for every word I type. 

The keyboard I am using at the moment (not provided by apple) is displayed in 
the following picture. Even 
though it supports 32 different characters (based on Russian keyboard), it 
still lacks some which can only be 
typed by holding down other keys. The number and size of keys makes it 
difficult to type properly. I was just 
wondering whether iKeyEx would allow me to simplify things.

http://img183.imageshack.us/img183/9761/keyboardap5.png

The reason I am asking, is because the action of combining characters seems to 
be supported by Apple in 
their Korean keyboard. As you can see in the following picture, using the 
Korean keyboard, when you type the 
first two characters consecutively, you get the third one as a result.

http://img141.imageshack.us/img141/2540/picture1il7.png

Original comment by ppericle...@gmail.com on 27 Jan 2009 at 11:57

GoogleCodeExporter commented 8 years ago
What ppericleous is asking is if we can detect two consecutive keypresses and 
replace 
them with one 'combined' character. Am I correct to assume that an input 
manager 
would be able to do that?

I'll have a look at the l33t input manager and see if I can come up with a 
proof of 
concept.

Original comment by orestis on 29 Jan 2009 at 2:02

GoogleCodeExporter commented 8 years ago
I also realised that the space bar shortcut does the same thing without any 
pop-ups ( 
replace two spaces with dot space). Perhaps there is a way of hijacking that 
code? It 
would be cleaner from an UI point of view.

Original comment by orestis on 29 Jan 2009 at 2:04

GoogleCodeExporter commented 8 years ago
You should understand how does the Unicode Combining Characters work -- they are
designed to avoid having an input manager. Take Latin characters as example.

Suppose "E" is the last character you've entered. Now the character \U0301, the
"COMBINING ACUTE ACCENT", is entered (so it is "E\U0301" now). iPhoneOS will
recognize that it is a combining character and *automatically* combine it with 
E and
form É.

Therefore, what you need to do is to assign \U0301 to the text of a key, and the
combining acute is done, although you have to press it after the character 
instead of
before it.

The double space shortcut is hard-coded in the iPhoneOS and you can't utilize 
it.

Original comment by kennytm@gmail.com on 29 Jan 2009 at 5:49

GoogleCodeExporter commented 8 years ago
Sadly it seams that iPhoneOS does not handle \U0301 combining character with 
greek
correctly... It allows us to put the ACUTE ACCENT even on non-vowel chars.
Additionally it is glitched and generates non standard characters (for example 
the
acute appears on top of the other character merging with it and producing bad
characters). As long as it is an iPhone OS bug there is no way to overcome it I
pressume?? Maybe by providing a good wiki for us to a create an entirely new 
Keyboard
Bundle that merges two characters as one as specified by the bundle's unique 
input
manager... 

Original comment by parr...@gmail.com on 29 Jan 2009 at 8:11

GoogleCodeExporter commented 8 years ago
Here's a pic of what it looks like: 
http://img514.imageshack.us/img514/9189/img0001xq1.png

On top are the combined characters, on the bottom the correct unicode chars. 
I'll try implementing an input 
manager that will do the right thing and post back.

Original comment by orestis on 29 Jan 2009 at 8:46

GoogleCodeExporter commented 8 years ago
By browsing the UIKit2 headers, another approach comes to mind:

Have two 'modes', normal and accented. These modes will be implemented by 
changing the actions of the 
candidate keys in the layout. Pressing the accent button will enable the 
accented mode (perhaps changing the 
labels as well), pressing any other button after it will restore the normal 
mode.

This sounds like a good approach, and can also give feedback. The only thing I 
can't tell by browsing the 
headers is how can you access the instance of UIKeyboardLayout to call 
setTarget:forKey: on. Is there any 
example of custom key actions/targets that I can peruse to see how it works?

Thanks,
Orestis

Original comment by orestis on 29 Jan 2009 at 9:18

GoogleCodeExporter commented 8 years ago
OK, after closer inspection, it seems that I can do

[UIKeybordImpl activeInstance] to grab an instance which has an m_layout which 
is a UIKeyboardLayout. I may 
have to add a category to expose that, though. I'll start actually trying 
things once the SDK downloads (I only had 
2.1 and things don't compile under that).

Original comment by orestis on 29 Jan 2009 at 9:37

GoogleCodeExporter commented 8 years ago
@9: I've tested it thoroughly and looks like Apple forgotten to implement
normalization for Unicode Greeks (E + ` -> È), in both Mac and iPhoneOS. Looks 
like
we'll need to file a bug report. :|

@11: For this you actually have you write your own layout class 
(UIKeybaordLayout,
which is a UIView) to insert a UIButton. But still it is much harder than
layout.plist. You can't use a custom layout together with layout.plist, yet.

Original comment by kennytm@gmail.com on 29 Jan 2009 at 9:52

GoogleCodeExporter commented 8 years ago
@13 I tested the Unicode normalisation on my Mac (10.5.6) and it seems to be 
working fine (at least visually). Do 
you have an example of something that doesn't work?

Can't I just call setTarget/Action:forKey: on the active keyboard layout to set 
the action?

Original comment by orestis on 29 Jan 2009 at 10:00

GoogleCodeExporter commented 8 years ago
@14:

(1) My fault again. I've used \U0341 instead of \U0301. Now it works on Mac 
when I
used \U0301 instead.

(2) I haven't tried, but you may try. The target/action is just the things you 
would
expect, and the key is a UIKeyDefinition, which you can check the "value" 
member for
what's the key entered... Of course, if you do so, the problem will be where to 
hook
your code.

Original comment by kennytm@gmail.com on 29 Jan 2009 at 10:10

GoogleCodeExporter commented 8 years ago
OK, going back to n00b levels. How do I make this thing to compile in the first 
place? 

It seems that I need mobile substrate which I got from 
http://svn.saurik.com/repos/menes/trunk/mobilesubstrate/ , that complained 
about ldid missing, so I found 
this http://svn.telesphoreo.org/trunk/data/ldid/ , but it seems that this is 
meant to go in the iPhone's /usr/bin/. 
Is there any tutorial on how to set a development environment up?

Original comment by orestis on 29 Jan 2009 at 11:01

GoogleCodeExporter commented 8 years ago
Further investigation: I managed to compile (but not sign with ldid) 
libsubstrate.dylib. Now where should I put it 
so that it gets picked up by gcc? gcc complains about not being able to find 
-lsubstrate.

Original comment by orestis on 29 Jan 2009 at 11:15

GoogleCodeExporter commented 8 years ago
Sorry for the comment spam, but I finally made it. Turns out that mobile 
substrate was needed only to build the 
preferences hook up, iKeyEx was building fine.

So I just modified the make file to point to the correct location for the 
includes, and build. I still got ldid 
complaints, so I signed on the phone (it would be good to find ldid for Mac OS 
X).

Is there an automated way to reload the keyboard bundles (I have to go to the 
settings, disable and enable them). 
Also, is there any other way of testing the keyboard without copying to the 
phone?

Original comment by orestis on 29 Jan 2009 at 11:52

GoogleCodeExporter commented 8 years ago
@18:

(1) There's an ldid on Mac hosted on this site, check the Downloads page.
(2) The keyboard bundle will be automatically reloaded when you quit (actually
terminating it) and restart the application. Use sth. like Notes to test would 
be
better than Texts (SMS).

Original comment by kennytm@gmail.com on 30 Jan 2009 at 6:35

GoogleCodeExporter commented 8 years ago
(Just to clarify, @15 the key is the text you enter instead of the 
UIKeyDefinition*)

Original comment by kennytm@gmail.com on 30 Jan 2009 at 5:02

GoogleCodeExporter commented 8 years ago
I'm making some slow progress - how can I get a UIKeyDefinition in the first 
place?

Example:

UIKeyboardLayout* layout = [[UIKeyboardImpl activeInstance] activeLayout]; 
//from a category, not sure if it 
actually works.
[layout setTarget:self forKey:@" "];
[layout setAction:@selector(flipUpper) forKey:@" "];

what kind of key should I put in there? The headers mention _keyid_space_ but 
it doesn't seem to be doing 
anything. Of course, it might be that I don't get the active layout in the 
first place. Here's how I grab it:

@interface UIKeyboardImpl (OMHACK)
- (UIKeyboardLayout*) activeLayout;
@end

@implementation UIKeyboardImpl (OMHACK)
- (UIKeyboardLayout*) activeLayout {
    return m_layout;
}
@end

Original comment by orestis on 31 Jan 2009 at 10:34

GoogleCodeExporter commented 8 years ago
@21:

You have to use an export statement like this in your header:

  export NSString* UIKeyboardKeySpace;

then hook the target/action by

  [layout setTarget:self forKey:UIKeyboardKeySpace];
  [layout setAction:@selector(flipUpper) forKey:UIKeyboardKeySpace];

This is because internally iPhoneOS checks equally of the keys not by -[NSString
isEqualToString:], but just simple pointer comparison.

Other usable keys are UIKeyboardKeyReturn and UIKeyboardKeyDelete, and it seems
iPhoneOS only responds to these 3 keys (unless you redefine the setXXX:forKey: 
methods).

Original comment by kennytm@gmail.com on 1 Feb 2009 at 8:59

GoogleCodeExporter commented 8 years ago
Thanks, I tried it but it still doesn't work. I suspect that I'm not getting 
the correct layout or that changing the 
targets like that isn't working (and given that only these three keys work, it 
wouldn't matter for plan anyway).

It seems like creating a new layout will be the most straightforward solution. 
I will investigate doing that - is 
MultiTap a good place to start? I don't see any other custom layout in your 
code.

Also, many thanks for creating iKeyEx and for helping me through this!

Original comment by orestis on 1 Feb 2009 at 12:51

GoogleCodeExporter commented 8 years ago
@23:

MultiTap only reuses the standard layout (the Phone Pad layout is provided 
already, I
just redirect all 4 relevant layouts building messages to Phone Pad).

hClipboard also uses a custom layout, but it is completely written from scratch 
(i.e.
almost no UIKeyboardLayoutRoman-related methods are used).

You can also look into UIKBStandardKeyboardLayout.m & UIKBStandardKeyboard.m to 
see
how I create the layout from layout.plist.

Original comment by kennytm@gmail.com on 1 Feb 2009 at 1:40

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
In 3.0, apple has added a greek keyboard and it fixes that issue (by using AAT 
tables
again). But it would be great if someone can find out how to specify an input 
manager
to read these tables from a particular font.

Original comment by varun4c...@gmail.com on 22 Aug 2009 at 7:29

GoogleCodeExporter commented 8 years ago

Original comment by kennytm@gmail.com on 25 Dec 2009 at 8:59