Unicode IPA Extensions Problem, Need Help with GUI SetFont
Unicode IPA Extensions Problem, Need Help with GUI SetFont
| Dizasta |
Dec 17 2006, 09:04 PM
Post
#1
|
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 35 Joined: 20-October 06 Member No.: 472 |
Hi guys,
I am stumped at this point because I have been unable to get my GUI to display text in menu items correctly: to be precise, characters in the IPA extension show up as squares. Characters from the Phonetic Extensions show up though. It is most likely because the DefaultMenuItem object resorts to using the default Windows GUI font for menu items. I know this because when I go to the control panel -> appearance and edit the menu items to use Arial Unicode MS, the characters are correctly displayed. For anyone who wants to check, here'e one character in the IPA Extension that shows up as squares is: U+025B (The Latin Small Letter Open E) and U+0254 (Latin Small Letter Open O). Any ideas/code examples about how to proceed will be greatly appreciated. Thanks. D. |
![]() ![]() ![]() |
| Dizasta |
Dec 24 2006, 07:47 PM
Post
#2
|
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 35 Joined: 20-October 06 Member No.: 472 |
Thanks for the tip. I tried to subclass the DefaultMenuItem but for some reason, my overrides canPaint() and paint() are not being called.
|
| vortic |
Dec 30 2006, 07:11 PM
Post
#3
|
|
Advanced Member ![]() ![]() ![]() Group: Members Posts: 1026 Joined: 13-April 04 Member No.: 42 |
QUOTE(Dizasta @ Dec 24 2006, 02:47 PM) Thanks for the tip. I tried to subclass the DefaultMenuItem but for some reason, my overrides canPaint() and paint() are not being called. Dizasta, Sorry for taking so long to get back to you. Hmmm. I just tried something real quick in the dev svn, and it seems to work. Are you using 0.9.0 release or current svn checkout? Using the FrameStyles example as a test to modify it, I put this in FrameStyles.cpp: CODE class MyCustomMenuItem : public DefaultMenuItem { public: MyCustomMenuItem() { } MyCustomMenuItem(const String& caption, MenuItem* parent=NULL, Menu* menuOwner=NULL) : DefaultMenuItem(caption, parent, menuOwner) { } virtual ~MyCustomMenuItem(){} virtual void paint( GraphicsContext* ctx, Rect* paintRect ) { //DefaultMenuItem::paint(ctx, paintRect);//not needed bounds_ = *paintRect; int gcs = ctx->saveState(); BasicFill fill; fill.setColor( Color::getColor("orange") ); ctx->setCurrentFill( &fill ); Rect bounds = *paintRect; BezierCurve rect; rect.rectangle( bounds ); ctx->draw( &rect ); bounds.inflate(-12,0,0,0); //set your custom font here Font myFont; myFont.setName("Arial Unicode MS");//maker sure this font is available. myFont.setBold(true); myFont.setColor( Color::getColor("blue") ); ctx->setCurrentFont(&myFont); ctx->textBoundedBy( &bounds, caption_, GraphicsContext::tdoCenterVertAlign ); ctx->setCurrentFill( NULL ); ctx->restoreState(gcs); } }; Then, in FrameStyles.cpp where the menu is being constructed, I changed this: CODE MenuItem* frameStyle = new DefaultMenuItem( "Set Frame Style to", main, menu ); to this: CODE MenuItem* frameStyle = new MyCustomMenuItem( "Set Frame Style to", main, menu ); frameStyle->setCanPaint( true ); And this works ok. Does it work for you? |
Dizasta Unicode IPA Extensions Problem Dec 17 2006, 09:04 PM
Dizasta 34 views and no replies? I feel like yelling for h... Dec 23 2006, 07:38 PM
vortic
Hi Dizasta,
Sounds like you do not want to use ... Dec 23 2006, 10:29 PM
Fraggle Is it just me or is Unicode generally a minefield? Dec 23 2006, 10:40 PM
vortic
Dizasta,
Sorry for taking so long to get back t... Dec 31 2006, 06:09 AM
Dizasta Hi Vortic,
Thanks for the heads up. I'll pull... Jan 1 2007, 04:05 AM
vortic
Ok, cool. I should clarify by what is fixed in ... Jan 1 2007, 04:14 AM
Dizasta Sadly neither of the version pulled with:
svn co ... Jan 1 2007, 05:31 AM
vortic
You want the vcf out of trunk, currently at revis... Jan 1 2007, 06:28 AM
Dizasta Ultimately, I never got this to work programmatica... Apr 8 2007, 10:51 AM
ddiego You can change the fonts for various control's... Jun 13 2007, 08:06 PM
Dizasta
Still no luck but judging from Vortic's mess... Jun 20 2007, 06:27 PM![]() ![]() ![]() |
| Lo-fi Version | : 18th May 2013 - 01:31 PM |