[Bf-committers] UTF8 text input status (on OS X)

Campbell Barton ideasman42 at gmail.com
Wed Nov 2 02:34:37 CET 2011

Hi Brecht,

I cant really give comprehensive answers here since I just got this
working on a basic ghost-x11/python/event level,
and made sure switching to foreign keyboard layouts resulted in
foreign looking keys.

On Wed, Nov 2, 2011 at 10:58 AM, Brecht Van Lommel
<brechtvanlommel at pandora.be> wrote:
> Hi all,
> I was asked to look at the remaining unicode text issues remaining on
> OS X. It seems there are some issues specific to this operating
> system, and some general:
> a) Uppercases character umlaut (e.g. Ü) are not rendered correctly in
> the user interface, they do show in 3D text and the text editor.
> Appears to be a text rendering problem that would happen on all
> platforms?

The same issue shows up on X11, though I think its todo with the font,
at least if you use the mono-space font it works

Run this in the console and render to see.

  bpy.context.scene.render.stamp_note_text = '\u00DC'
  bpy.context.scene.render.use_stamp_note = True
  bpy.context.scene.render.use_stamp = True

On a related note, to render latin1 characters I had to add an
exceptions to glib's utf8 function, since it would have otherwise
returned an invalid char.
  I did this mainly because paths can have non utf8 characters and the
code we had in BLF from ImLib also happened to work this way though it
didnt make a special exception.

Guessing this is a freetype/font issue (or some setting we miss) since
we pass the unicode chars to freetype without any changes.

> b) The text editor does not use the new event->utf8 at all yet, still
> only event->ascii. It seems the text editor may need major rewriting
> to support utf8, so this is not intended to work yet?

There has been no attempt to get this working, we have the python
console too, I was hoping to have text button input first.
for basic text entry and line editing its not too hard, but fore line
wrapping, tab spacing etc... this could be quite a bit more work
(could be worth looking into a blf/scintilla port instead)

> Two OS X issues:
> c) Typing with dead keys (e.g. ¨ + o => ö) didn't work for me. I
> managed to get it working using NSTextInput, patch here if people want
> to test, I'm not very confident that this doesn't break something, so
> some testing would be great: http://www.pasteall.org/25983/diff
> d) Typing e.g. ` + o to get ò seems to break various shortcut keys
> (same issue exists in 2.59). For example pressing ctrl+q does nothing
> after this, changing window focus or typing other characters makes it
> work again.
> Brecht.

More information about the Bf-committers mailing list