Change sprite text wrapping in runtime

Discussion and feedback on Construct 2

Post » Mon Mar 09, 2015 1:00 am

Hello,

Currently I'm implementing Chinese characters into my game, and I ran into this problem - when you write in Chinese (and in Japanese I think?) you don't space out the characters, so I would have to set the wrapping option of my sprite text to "character". So far so good, but my game also uses other latin languages, and it just looks plain ugly when the wrapping is set to "character".

I already though of a "hack" of sorts - I'm thinking of having a "space" character set to 0 width, and add it in between every Chinese character that's in the text. It's quite a big hack so I decided to ask first if implementing something like this in C2 would be possible before actually doing it...

Thanks!
B
115
S
38
G
40
Posts: 827
Reputation: 27,306

Post » Mon Mar 09, 2015 10:46 am

There's no support for mixed wrapping modes. You can set wrapping modes for individual text objects, but if you need to mix wrapping modes in one text object I think you'll have to roll your own system.
Scirra Founder
B
373
S
218
G
84
Posts: 23,450
Reputation: 186,140

Post » Mon Mar 09, 2015 7:12 pm

@andreyin

I've done quite a bit with Chinese in Construct.

Are you going to use a sprite font? Because that's the only text type object that supports custom widths for each character like a space with "0" width. If you do, your font is going to be HUGE unless you're implementing a very limited subset of Chinese/Japanese.
B
31
S
7
G
8
Posts: 232
Reputation: 6,214

Post » Tue Mar 10, 2015 3:49 am

cacotigon wrote:@andreyin

I've done quite a bit with Chinese in Construct.

Are you going to use a sprite font? Because that's the only text type object that supports custom widths for each character like a space with "0" width. If you do, your font is going to be HUGE unless you're implementing a very limited subset of Chinese/Japanese.


Yep! Someone helped me out translating my game to chinese, and they also made a list of all the characters used, so it's fine though. Here's a picture of what the sprite font looks like if you're curious:

Image

Thankfully my game isn't text-heavy, so it's fine. The solution I mentioned worked just fine, it was a bit annoying to space out all the characters in the game text but it's working out great!
B
115
S
38
G
40
Posts: 827
Reputation: 27,306

Post » Tue Mar 10, 2015 3:58 am

@Ashley

It seems not to mix wrapping mode, just set wrapping mode to "Word" or "Character" for different language before render string. Add an action to set wrapping mode in official sprite font might solved this problem.
B
104
S
25
G
215
Posts: 4,288
Reputation: 123,088

Post » Tue Mar 10, 2015 4:40 am

@andreyin

I extended my rex_text_properties behavior to set wrapping of official sprite font object.
Sample capx
B
104
S
25
G
215
Posts: 4,288
Reputation: 123,088

Post » Tue Mar 10, 2015 5:41 am

rexrainbow wrote:@andreyin

I extended my rex_text_properties behavior to set wrapping of official sprite font object.
Sample capx


Dang, that's awesome! I'll try it out later and post on the official thread, thanks!!
B
115
S
38
G
40
Posts: 827
Reputation: 27,306

Post » Tue Mar 10, 2015 3:32 pm

@andreyin

Oh! I gotcha, for a moment there I thought it was a multiplayer game and you were trying to support chatting in Chinese using a sprite font. Nice packing on the spritefont btw, Chinese is perfectly legible even at that small size. Reminds me of the Chinese text I would see in NES games way way back.
B
31
S
7
G
8
Posts: 232
Reputation: 6,214


Return to Construct 2 General

Who is online

Users browsing this forum: rexrainbow, Yura G and 8 guests