I try to let EditBox or MultiEditBox support to indicate Unicode character. But I don't handle MS-IME Messages
like WM_IME_COMPOSITION,WM_IME_ENDCOMPOSITION etc.
If someone interests it , you can do it like directx9.0c IME-EditBox, it's very cool.
Currently It's working to to indicate Unicode character,but Some Source code and data files have to be modified.
For Chinese character example.
1. Copy Tradition Chinese Font(I use 細明體(mingliu.ttc)) for ./datafiles/fonts/
2.Construct mingliu.font in ./datafiles/fonts/
and define its GlyphRange;
because I use Tradition Chinese Sub CodePoint (19968~40868 )
its' content:
<?xml version="1.0" ?>
<Font Name="mingliu" Filename="../datafiles/fonts/mingliu.ttc" Type="Dynamic" Size="12" NativeHorzRes="800" NativeVertRes="600" AutoScaled="true">
<GlyphRange StartCodepoint="19968" EndCodepoint="40868" />
</Font>
3. Add mingliu.font Setting into ./datafiles/fonts/schemes/TaharezLook.scheme
<?xml version="1.0" ?>
<GUIScheme Name="TaharezLook">
<Imageset Name="TaharezLook" Filename="../datafiles/imagesets/TaharezLook.imageset" />
<Font Name="mingliu" Filename="../datafiles/fonts/mingliu.font" />
<WindowSet Filename="CEGUITaharezLook" />
</GUIScheme>
4.Modified Sample_Demo7.cpp::initialiseSample()
System::getSingleton().setDefaultFont((CEGUI::utf8*)"mingliu" );
CEGUI::Font* font = CEGUI::FontManager::getSingleton().getFont((CEGUI::utf8*)"mingliu" );
font->setAutoScalingEnabled(true);
font->setNativeResolution(Size(800, 600));
font->defineFontGlyphs(font->getAvailableGlyphs());
5.Modified Win32AppHelper.cpp
(a)add this include and inline funciotn
#include <ctype.h>
inline int __cdecl isLeadByte(int _C)
{return ((unsigned char)(_C) & 0x80); }
(b)Modified wndProc()::case WM_CHAR to deal with Multi-Bye into Unicode then injectChar() is working well;
case WM_CHAR: {
static char MultiByte[2]={0};
static bool isHaveMultiByte = false;
if (isHaveMultiByte) {
isHaveMultiByte = false;
MultiByte[1] = (unsigned char) wParam;
int iLengthUnicode = 0;
wchar_t szUnicode;
MultiByteToWideChar(CP_ACP, 0, (char*)MultiByte, 2, &szUnicode, 1);
CEGUI::System::getSingleton().injectChar((CEGUI::utf32)szUnicode);
break;
}
else
{
if(isLeadByte(wParam))
{
isHaveMultiByte = true;
MultiByte[0] = (unsigned char)wParam;
}else
{
CEGUI::System::getSingleton().injectChar((CEGUI::utf32)wParam);
break;
}
}
}
[size=large]Screen Shot:[/size]
[img align=left]http://webhd.yam.com/jingjie//cegui1.JPG[/img]
How to deal input with EditBox or MultiLineEditBox that indi
Moderators: CEGUI MVP, CEGUI Team
Re: How to deal input with EditBox or MultiLineEditBox that
hi, I have tried this way,but when loadScheme,something gone wrong,I trace that error occurs when loading font resource ,can you give me some advice?
Exception
To jingjie:
I do as you write,the Exception occur:
Font::defineFontGlyphs_impl - operation requires a texture larger than the supported maximum.
I do as you write,the Exception occur:
Font::defineFontGlyphs_impl - operation requires a texture larger than the supported maximum.
Re: How to deal input with EditBox or MultiLineEditBox that
jingjie wrote:4.Modified Sample_Demo7.cpp::initialiseSample()
5.Modified Win32AppHelper.cpp
(a)add this include and inline funciotn
#include <ctype.h>
inline int __cdecl isLeadByte(int _C)
{return ((unsigned char)(_C) & 0x80); }
(b)Modified wndProc()::case WM_CHAR to deal with Multi-Bye into Unicode then injectChar() is working well;
Where would I find these files??? or something equivalent to these...
Can't figure out where to put those code. I am using OGRE 1.2.2 SDK for Visual C++ .Net 2005 (8.0)
Thank you
Return to “Offtopic Discussion”
Who is online
Users browsing this forum: No registered users and 2 guests