How to use "accents" in TexCandy

Hi,

I am trying to use portuquese accents (ã, â, á, à, é, è, ê, ì, í, î, õ, ô, ç ) with vector fonts in TextCandy and it's not working!

TextCandy.AddVectorFont ("Comic Sans", "0123456789aãâáàbcçdeéèfghiíìjklmnoõôpqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'*@():,$.!-%+?;#/_")

Do I need to use CharSet, in wich I previous draw the accented character, only?

Thanks
NRA

If the accents are included in the vector charset, it should work.

However, we experienced a problem in the LUA sting library included with Corona when working with German Umlauts AND only if the font files are placed in a sub folder -then, each Umlaut is automatically converted into double byte characters, which then breaks the code. I don't know if this is also the case with accents, but then there isn't much we can do here because it seems to be strange behaviour of the LUA string library.

Could you send us a small, stripped down sample code to demonstrate your problem?

Sure.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
-- LOAD THE LIBRARY
TextCandy = require("lib_text_candy")
 
        TextCandy.AddVectorFont ("Comic Sans MS", "0123456789aãâáàbcçdeéèfghiíìjklmnoõôpqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'*@():,$.!-%+?;#/_")
 
        -- CREATE A TEXT OBJECT USING THIS CHARSET
        MyText = TextCandy.CreateText({
                fontName        = "Comic Sans MS",
                fontSize = 32,                                          
                x                       = screenW*.5,                                           
                y                       = screenH*.5,                                           
                text            = "Cachaça|Feijão|Separação",       
                originX         = "CENTER",                                                     
                originY         = "CENTER",                                                     
                textFlow        = "CENTER",     
                charSpacing = 5,
                lineSpacing = 4,
                showOrigin      = false,                                                                
                })

I see. The problem is that the string library included with Corona doesn't handle multibyte characters, so those chars are internally converted to 8-bit values.

The workaround is to use a bitmap charset that contains the accented chars and also make sure that the charOrder string passed to AddVectorFont or AddCharset does not contain any multibyte characters. Instead, you can replace each accented char in the charOrder string with a char that is not used in your charset (replace "ã" there with "#", for example) and then use the letter "#" each time you want to print out an "ã".

Ok, thanks I will try this.

views:1459 update:2011/10/14 9:11:21
corona forums © 2003-2011