0 Favourites

Change sprite text wrapping in runtime

  • 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!

  • 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.

  • 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.

  • 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:

    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!

  • 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.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • andreyin

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

    Sample capx

  • 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!!

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
0 Favourites
Sprite Font Generator - v3
368 112,350
RetroDaddy's avatar
RetroDaddy
Unread hot topic Locked topic
195 16,198
Ashley's avatar
Ashley Construct Team Founder
Unread hot topic
0 Favourites
[Plugin] tag text
188 25,449
RBuster's avatar
RBuster