Jump to content

#1
Roland

Roland
  • Members
  • 1,374 posts
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?
English is not my native language

#2
Josh Klint

Josh Klint
  • Staff
  • 11,081 posts
I've never been able to get a straight answer from anyone on how to actually do this.

#3
martyj

martyj
  • Members
  • 320 posts
@Josh, how are you rendering strings in Opengl?

#4
Josh Klint

Josh Klint
  • Staff
  • 11,081 posts
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.

#5
Josh Klint

Josh Klint
  • Staff
  • 11,081 posts
Of course the font also has to have those letters.

#6
Roland

Roland
  • Members
  • 1,374 posts
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/
English is not my native language

#7
Josh Klint

Josh Klint
  • Staff
  • 11,081 posts
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

#8
Einlander

Einlander
  • Members
  • 515 posts
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.

#9
Roland

Roland
  • Members
  • 1,374 posts

View PostJosh Klint, on 17 February 2017 - 03:44 PM, said:

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. Posted Image
Anything that can be tested?
English is not my native language

#10
AggrorJorn

AggrorJorn
  • Members
  • 3,653 posts
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.

#11
Roland

Roland
  • Members
  • 1,374 posts

View PostAggrorJorn, on 17 February 2017 - 06:57 PM, said:

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 Posted Image

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

IMG_20170217_103454.jpg
English is not my native language

#12
Josh Klint

Josh Klint
  • Staff
  • 11,081 posts
We do have some characters on this board.  Some are Swedish. :D

#13
shadmar

shadmar
  • Members
  • 1,843 posts
I know several swedish jokes :)
Asus G750JX - 16GB - i7 - Nvidia GTX 770M 4GB - Leadwerks2 and Leadwerks3
Community Wiki : http://leadwerks.wikidot.com/

#14
Roland

Roland
  • Members
  • 1,374 posts
As this now has gone wild I can learn you two Swedish words that are really really easy

Island =  ö
Small river = å
English is not my native language

#15
sjg

sjg
  • Members
  • 16 posts
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.