How to include accents to the texts?

Blitz3D Forums/Blitz3D Beginners Area/How to include accents to the texts?

Tonim(Posted 2014) [#1]
Hello, I'm new to this and I'm really cracking my head trying to find a way to include accents and unusual characters to the texts that are printed (such as "ç, á, é, ã etc), because whenever I try to write them, they simply won't show up. I've been looking for tutorials everywhere and so far the only solution that I've found was for the C+ language, which doesn't bring much help. If someone could give me a hand with this I'll be very thankful.

Tonim


RemiD(Posted 2014) [#2]
On my computer, these letters with accents/special letters are displayed :

It probably means that you need to load a font which has the letters with accents/special letters that you want.


Yasha(Posted 2014) [#3]
There is no built-in way to do this.

Blitz3D is ASCII-only; its strings are sequences of single bytes with a well-defined value range of 0-127. This is only enough to represent the basic US English character set.

Since bytes as handled by Blitz3D have an actual range of 0-255, there's some more space, but what it gets used for is not well-defined by the text system and can vary. You shouldn't rely on it being consistent (at least not according to the language's original design).

The simplest way to represent such characters in a small range (e.g. accented, Greek, Cyrillic - any character set that is small enough to also completely fit into the byte range) is to ignore the actual ASCII values of characters, and instead use them as byte values indexing into a bitmap font atlas with your own value mapping, using a bitmap font system to draw your text.

For character sets that have a larger range (Chinese and the like), you'll need an extension library that can add UTF-8 support. The only existing one I know of is FastText by MikhailV, although this could potentially be a simple thing for an expert to write for you (don't know how it was done, sorry).


Tonim(Posted 2014) [#4]
RemiD: You've got it, the situation is now solved, thanks a lot!

Yasha: Thanks a lot for providing me such a detailed explanation, I'm glad that the situation isn't that complex, otherwise I'd certainly follow your advice concerning the FastText that you've mentioned.

Wish you two a lot of success in your works/projects!


Tonim


RemiD(Posted 2014) [#5]
There is also another way to display letters with accents/special letters but you can't use Text() or Print() :
http://en.wikipedia.org/wiki/Computer_font#Bitmap_fonts
If you search the forum you can find tools to create your own bitmap fonts.
http://www.google.fr/?gws_rd=ssl#q=bitmap+fonts+site:blitzbasic.com