unicode text input for 3d text.

This commit is contained in:
Campbell Barton
2011-10-20 10:47:38 +00:00
parent 70ba7d02db
commit 3d501ca70f
2 changed files with 15 additions and 3 deletions

View File

@@ -25,7 +25,7 @@
#ifndef BLI_STRING_UTF8_H #ifndef BLI_STRING_UTF8_H
#define BLI_STRING_UTF8_H #define BLI_STRING_UTF8_H
/** \file BLI_string.h /** \file BLI_string_utf8.h
* \ingroup bli * \ingroup bli
*/ */

View File

@@ -1291,8 +1291,20 @@ static int insert_text_invoke(bContext *C, wmOperator *op, wmEvent *evt)
if(val && ascii) { if(val && ascii) {
/* handle case like TAB (== 9) */ /* handle case like TAB (== 9) */
if((ascii > 31 && ascii < 254 && ascii != 127) || (ascii==13) || (ascii==10) || (ascii==8)) { if( (ascii > 31 && ascii < 254 && ascii != 127) ||
if(accentcode) { (ascii==13) ||
(ascii==10) ||
(ascii==8) ||
(evt->utf8_buf[0]))
{
if (evt->utf8_buf[0]) {
BLI_strncpy_wchar_from_utf8(inserted_text, evt->utf8_buf, 1);
ascii= inserted_text[0];
insert_into_textbuf(obedit, ascii);
accentcode= 0;
}
else if(accentcode) {
if(cu->pos>0) { if(cu->pos>0) {
inserted_text[0]= findaccent(ef->textbuf[cu->pos-1], ascii); inserted_text[0]= findaccent(ef->textbuf[cu->pos-1], ascii);
ef->textbuf[cu->pos-1]= inserted_text[0]; ef->textbuf[cu->pos-1]= inserted_text[0];