Wed 17 Dec 2008 09:07:11 PM UTC, comment #5:
Turns out the reason I gave for the change was wrong, Win32FontInfo also overrides glyphIsEncoded:, so the change, though it is correct wont help here. Still I hope the fix might make your problem go away, by affectign the font replacement is NSAttributedString.
|
Wed 17 Dec 2008 08:31:25 PM UTC, comment #4:
Now that os great, so it isn't a problem with events, it is jsut the drawing code that is not working for certain characters.
My first idea, what may be causing this is the way we generate glyphs for a font. The default code here looks like this:
- (BOOL) glyphIsEncoded: (NSGlyph)aGlyph;
{
// FIXME: This is a hack for aGlyph == theChar fonts.
if (coveredCharacterSet == nil)
{
[self coveredCharacterSet];
}
return [coveredCharacterSet characterIsMember: (unichar)aGlyph];
}
That is, we only generate our "glyph" when we know the font supports the character. This could be the problem for you.
Looking at the code that tries to find the covered character set for a windows font I see an issue that might stop that code from working, the cbThis part of the GLYPHSET isn't set and Windows is rather paticular about those values.
I will change this and you could give it a try.
|
Tue 16 Dec 2008 11:22:17 PM UTC, comment #3:
when running GSTest, Keyboard Input Test it tells me, for @
keycode: 192
characters: @
charactersIgnoringModifiers: @
modifiers: control+alternate
which looks about correct.
very similar for #, [, ]
for {, }, shift is added
|
Tue 09 Dec 2008 09:08:53 PM UTC, comment #1:
The problem here is that we don't use TranslateMessage() in the message loop, that way we only get the raw key up and down events, not that translated char events. But if we change to that we have no way of handling non-character key events correctly. What we need is some sort of TranslateMessage() replacement that would just result in the characters for the key event, sadly I don't know if anything like this exists at all and would also not know how to write it.
I had a deeper look into what Windows offers here and the function ToUnicode() that we are using is almost the best to do the key down message to string conversion. The only better solution would be ToUnicodeEx() which allows to hand in a keyboard layout as well. Could you please test if this makes any difference for you, if it does I will update the code.
You will need to change the line
result = ToUnicode(wParam, scan, keyState, unicode, 5, 0);
inot something like
result = ToUnicodeEx(wParam, scan, keyState, unicode, 5, 0, GetKeyboardLayout(0));
But I expect this not to change anything.
|