Page 1 of 1
Love 9.0 UTF Image Font Help!
Posted: Sun Dec 29, 2013 1:55 pm
by Ekamu
LÖVE expects ISO 8859-1 encoding for the glyphs string.
Does this mean their is no support for Japanese Kana. ISO 8859-1 has support for the Latin alphabet only.
I assumed that was an old message. UTF-8 has support for Kana but my image font does not work still.
Here is my code-arrangement.
Code: Select all
love.graphics.newImageFont("resources/jfont1.png"," アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンガギグゲゴザジズゼゾダヂヅデドバビブベボパピプペポ"
.."あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわをんがぎぐげござじずぜぞだぢづでどばびぶべぼぱぴぷぺぽ".."0123456789。、「」!?"),
}
But I get an error saying syntax error unexpected symbol near ','
Re: Love 9.0 UTF Image Font Help!
Posted: Sun Dec 29, 2013 2:55 pm
by bartbes
I think that was for 0.8.0 only, and 0.9.0 should support utf-8 in the glyphs string. That said, the error you're getting is a syntax error, this means your code has not been formatted correctly, this has nothing to do with whether newImageFont supports utf-8 or not.
Re: Love 9.0 UTF Image Font Help!
Posted: Tue Dec 31, 2013 1:21 pm
by Ekamu
yes your right, the syntax error it was a } misplaced somewhere...
now I get a decoding error not enough space.
I am using UTF-8 encoding without a Bomb lol. (UTF-8 without BOM).
Re: Love 9.0 UTF Image Font Help!
Posted: Tue Dec 31, 2013 1:27 pm
by bartbes
That error usually means an unfinished codepoint somewhere, are you sure it's valid utf-8?
Re: Love 9.0 UTF Image Font Help!
Posted: Tue Dec 31, 2013 1:42 pm
by Ekamu
hmm how do I check if its valid utf-8?
here is my font table
Code: Select all
font = {
--Japanese Font Furagana-Katakana
love.graphics.newImageFont("resources/jfont1.png"," アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンガギグゲゴザジズゼゾダヂヅデドバビブベボパピプペポ"
.."あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわをんがぎぐげござじずぜぞだぢづでどばびぶべぼぱぴぷぺぽ".."0123456789。、「」!?"),
love.graphics.newImageFont("resources/jfont2.png"," アイウエオカキクケコサシスセソタチツテトナニヌネノハヒフヘホマミムメモヤユヨラリルレロワヲンガギグゲゴザジズゼゾダヂヅデドバビブベボパピプペポ"
.."あいうえおかきくけこさしすせそたちつてとなにぬねのはひふへほまみむめもやゆよらりるれろわをんがぎぐげござじずぜぞだぢづでどばびぶべぼぱぴぷぺぽ".."0123456789。、「」!?"),
}
[]
Posted: Tue Dec 31, 2013 2:12 pm
by bekey
-snip-
Re: Love 9.0 UTF Image Font Help!
Posted: Tue Dec 31, 2013 2:40 pm
by Ekamu
I still get the same error:
Decoding error there is not enough space in function "print"
So the actual image font is configured correctly...
Re: Love 9.0 UTF Image Font Help!
Posted: Tue Dec 31, 2013 9:51 pm
by Ekamu
Attached is the love file.
Re: Love 9.0 UTF Image Font Help!
Posted: Sat Jan 04, 2014 2:33 am
by Barbarosso
JTEXT = "にほんご"
Its length is not 4 but 12.
Because UTF-8 Japanese character size is 3 bytes.
And, lua has poor support multi byte language.
In lua, UTF-8 string is more like byte array than string.
I suppose this program failed to generate text.cat's content at text_loop function.
Re: Love 9.0 UTF Image Font Help!
Posted: Sat Jan 04, 2014 3:01 am
by slime
Your function text_loop updates text byte-by-byte (string.sub, string.len, etc. work with bytes), but your UTF-8 text uses multiple bytes per character, so the encoding of the string becomes broken when you do that. I'm not positive this is the (only) problem, but it seems very likely.
You can use a library such as
this to do UTF-8 unicode aware operations on strings.
EDIT: yeah, what Barbarosso said.