Using national characters in MAUI::Font

14 posts / 0 new
Last post
Vasily Zakharov
Jolaf's picture
Offline
Mobile Conjurer
Joined: 6 Apr 2010
Posts:
Using national characters in MAUI::Font

I've created a bitmap font per this instruction: http://www.mosync.com/documentation/manualpage/font-tools
But I used Charset: OEM RUSSIAN instead of ANSI, as I need to write in Russian on the screen.
I've checked the generated PNG, the Russian Cyrillic letters are fine there.

The program runs well, but when I try to print some Russian, I see just spaces instead of Russian letters. Latin letters etc. are printed ok.

So the question is: how should I generate the font and provide Russian text to the program so that Russian letters are visible on the screen?

Thank you!

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Vasily Zakharov
Jolaf's picture
Offline
Mobile Conjurer
Joined: 6 Apr 2010
Posts:

Moreover, even if I specify ANSI when generating font, I anyway can't see any characters beyond \x80 on the screen, though those characters certainly do exist in the font PNG.

Is MoSync at all capable of displaying characters beyond 0x80 ?

Fredrik Eldh
Fredrik's picture
Offline
Mobile Sorcerer
Joined: 16 Feb 2009
Posts:
Quote:

Is MoSync at all capable of displaying characters beyond 0x80?

It should be. I tested the EditBox in MAUIex just now and it displayed Swedish diacritics (å, ä, ö) properly.

Vasily Zakharov
Jolaf's picture
Offline
Mobile Conjurer
Joined: 6 Apr 2010
Posts:
"Fredrik" wrote:
Quote:

Is MoSync at all capable of displaying characters beyond 0x80?

It should be. I tested the EditBox in MAUIex just now and it displayed Swedish diacritics (å, ä, ö) properly.

Sounds encouraging, thank you very much. Smile

What version of MoSync do you use? 2.3br767?

Does it work with MAUI::Font::drawString() ?

How do you provide text to the program? Just typing in Swedish in the source, like this:
font.drawString("åäö", 2, 2);
or
font.drawString("\x81\x82\x83", 2, 2);
or loading text from resources?

Should Unicode/UTF-8 be used somewhere in the process?

Fredrik Eldh
Fredrik's picture
Offline
Mobile Sorcerer
Joined: 16 Feb 2009
Posts:

We've tested both r767 and the latest nightly. We didn't provide text directly; instead we used the example's EditBox to type in the text as the program was running.

Unicode is not supported in r767. There is some support in the nightlies, but it doesn't extend to MAUI::Font.

Vasily Zakharov
Jolaf's picture
Offline
Mobile Conjurer
Joined: 6 Apr 2010
Posts:
"Fredrik" wrote:

We've tested both r767 and the latest nightly. We didn't provide text directly; instead we used the example's EditBox to type in the text as the program was running.

Hmm, I see.

But is there a way to provide "static" national text from resources or something like that?

I need UI "talking" in Russian, so typing text into the program is clearly not an option. Smile

Fredrik Eldh
Fredrik's picture
Offline
Mobile Sorcerer
Joined: 16 Feb 2009
Posts:
Quote:

But is there a way to provide "static" national text from resources or something like that?

Certainly. Font::drawString() should work. If it doesn't, there's a bug. If you would post a sample program that exhibits the bug, we could analyze it to see what's going wrong.

Vasily Zakharov
Jolaf's picture
Offline
Mobile Conjurer
Joined: 6 Apr 2010
Posts:

drawString() works fine.

I've finally found out what was the problem. It seems the build process doesn't check that the font file is changed and doesn't recompile the resource, so changes in .mof file are not reflected in the running program unless a clean build is made. That made me confused about some characters being invisible.

Sorry for the mess. Smile

Further thoughts:

- Maybe generation of .mof files from .fnt/png files may be included to the build process as a dependency, so that .mof files are generated from .fnt/png files automatically at build if .fnt/png file is changed?

- Maybe resource compilation can be set dependent of the files it includes? So that resource is recompiled automatically if any included file is changed?

Fredrik Eldh
Fredrik's picture
Offline
Mobile Sorcerer
Joined: 16 Feb 2009
Posts:
Quote:

- Maybe generation of .mof files from .fnt/png files may be included to the build process as a dependency, so that .mof files are generated from .fnt/png files automatically at build if .fnt/png file is changed?

Sounds like a good idea. We should have custom build steps, which would allow you to do this, among other things.

Quote:

- Maybe resource compilation can be set dependent of the files it includes? So that resource is recompiled automatically if any included file is changed?

Already done.

Vasily Zakharov
Jolaf's picture
Offline
Mobile Conjurer
Joined: 6 Apr 2010
Posts:
"Fredrik" wrote:
Quote:

- Maybe generation of .mof files from .fnt/png files may be included to the build process as a dependency, so that .mof files are generated from .fnt/png files automatically at build if .fnt/png file is changed?

Sounds like a good idea. We should have custom build steps, which would allow you to do this, among other things.

Should I file it somewhere?

"Fredrik" wrote:
Quote:

- Maybe resource compilation can be set dependent of the files it includes? So that resource is recompiled automatically if any included file is changed?

Already done.

You mean, it's not in r767, but already done in nightlies?

Fredrik Eldh
Fredrik's picture
Offline
Mobile Sorcerer
Joined: 16 Feb 2009
Posts:
Quote:

You mean, it's not in r767, but already done in nightlies?

Sorry, I was mistaken. It's not done at all. A part of it was done a long time ago, but IDE support was not finished. I've opened an issue to make sure it gets done.

Vasily Zakharov
Jolaf's picture
Offline
Mobile Conjurer
Joined: 6 Apr 2010
Posts:
"Fredrik" wrote:

Sorry, I was mistaken. It's not done at all. A part of it was done a long time ago, but IDE support was not finished. I've opened an issue to make sure it gets done.

Great, thank you!

Should I also file somewhere the idea of automatic .mof (re-)generation from .fnt/png at build?

Fredrik Eldh
Fredrik's picture
Offline
Mobile Sorcerer
Joined: 16 Feb 2009
Posts:

Sure, you could open an issue if you like.

Vasily Zakharov
Jolaf's picture
Offline
Mobile Conjurer
Joined: 6 Apr 2010
Posts:
"Fredrik" wrote:

Sure, you could open an issue if you like.

Done: https://github.com/MoSync/MoSync

Thanks!