Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help,
read this .
Ekamu
Party member
Posts: 178 Joined: Fri Sep 20, 2013 11:06 am
Post
by Ekamu » Sun Dec 29, 2013 1:55 pm
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 ','
bartbes
Sex machine
Posts: 4946 Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:
Post
by bartbes » Sun Dec 29, 2013 2:55 pm
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.
Ekamu
Party member
Posts: 178 Joined: Fri Sep 20, 2013 11:06 am
Post
by Ekamu » Tue Dec 31, 2013 1:21 pm
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).
bartbes
Sex machine
Posts: 4946 Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:
Post
by bartbes » Tue Dec 31, 2013 1:27 pm
That error usually means an unfinished codepoint somewhere, are you sure it's valid utf-8?
Ekamu
Party member
Posts: 178 Joined: Fri Sep 20, 2013 11:06 am
Post
by Ekamu » Tue Dec 31, 2013 1:42 pm
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。、「」!?"),
}
bekey
Party member
Posts: 255 Joined: Tue Sep 03, 2013 6:27 pm
Post
by bekey » Tue Dec 31, 2013 2:12 pm
-snip-
Last edited by
bekey on Fri Jan 24, 2014 1:35 am, edited 2 times in total.
Ekamu
Party member
Posts: 178 Joined: Fri Sep 20, 2013 11:06 am
Post
by Ekamu » Tue Dec 31, 2013 2:40 pm
I still get the same error:
Decoding error there is not enough space in function "print"
So the actual image font is configured correctly...
Last edited by
Ekamu on Tue Dec 31, 2013 9:52 pm, edited 2 times in total.
Ekamu
Party member
Posts: 178 Joined: Fri Sep 20, 2013 11:06 am
Post
by Ekamu » Tue Dec 31, 2013 9:51 pm
Attached is the love file.
Barbarosso
Prole
Posts: 1 Joined: Thu Jan 02, 2014 4:30 am
Post
by Barbarosso » Sat Jan 04, 2014 2:33 am
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.
slime
Solid Snayke
Posts: 3162 Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:
Post
by slime » Sat Jan 04, 2014 3:01 am
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.
Users browsing this forum: Bing [Bot] , Google [Bot] and 8 guests