Roland

Swedish characters

15 posts in this topic

My code supports the game in different languages (actually English and Swedish for now, but its quite easy to add more languages). Switching language works just fine. However Ascii-characters above 0x7F are not rendered correctly or not at all. Is the any workaround or fix for this (C++)?

 

Question for Josh? Will Leadwerks be able to deal with extended character sets in the future?

0

Share this post


Link to post

I've never been able to get a straight answer from anyone on how to actually do this.

0

Share this post


Link to post

Well, you need the DrawText() command to accept the string you want to draw, so a wstring might be needed (but probably not for Swedish), and you need the font loading string to include those characters, which is currently an internal value:

if (family==Font::English)
{
familychars = "abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890-=!@#$%^&*()_+[]\\{}|;':\",./<>? `~";
}

 

It might be possible to let the user input a loading string (and change that English constant into the string above, but it still won't work with anything that requires more than 256 letters.

0

Share this post


Link to post

Of course the font also has to have those letters.

0

Share this post


Link to post

Okay. So at the moment its not possible then (my font has the Swedish åäöÅÄÖ).

 

å (0xe5)

ä (0xe4)

ö (0xf6)

Å (0xc5)

Ä (0xc4)

Ö (0xd6)

 

 

Thanks for the answer

 

 

http://www.asciitabell.se/

0

Share this post


Link to post

I've added a new Font::Load() command that will accept any string of characters as the glyphs to pull from the font. However, I do not exactly know how this will work. It's all kind of strange to me, being a native English speaker everything else seems like some weird exception. :D

0

Share this post


Link to post

Is there a reason to not simply convert all strings to wstring to allow utf8 in the fonts that allow them? Or have a global font settings that will take the restrictions off for those who know the risks? Maybe you might gain some customers using logogram based writing systems.

0

Share this post


Link to post

I've added a new Font::Load() command that will accept any string of characters as the glyphs to pull from the font. However, I do not exactly know how this will work. It's all kind of strange to me, being a native English speaker everything else seems like some weird exception. biggrin.png

Anything that can be tested?

0

Share this post


Link to post

I will be honest: I fully expected to see 3d models of Swedish people when I clicked on this topic. Really wondered how you would have captured the essence of a swedish person.

3

Share this post


Link to post

I will be honest: I fully expected to see 3d models of Swedish people when I clicked on this topic. Really wondered how you would have captured the essence of a swedish person.

Hahaha.. sorry for that biggrin.png

 

Here is a fully normal Swede ... (me?)

 

post-395-0-01641100-1487358259_thumb.jpg

5

Share this post


Link to post

We do have some characters on this board. Some are Swedish. :D

1

Share this post


Link to post

As this now has gone wild I can learn you two Swedish words that are really really easy

 

Island = ö

Small river = å

0

Share this post


Link to post

I had a similar thing where I wanted to display Cyrillic characters, and in the end I rolled my own bitmap font and used the DrawImage function to get them to the screen. Granted, it wasn't cheap (in that there was a bit of an FPS hit), but it did what it said on the tin.

1

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Create Your Account

Sign in

Already have an account? Sign in here.


Sign In Now