0 Favourites

Text does not wrap properly in NON-WebGL mode

  • I'm trying to wrap text within a certain size of a text object.... and here's my issue:

    My text object must only be 200x100 pixels big.... if the text is set to wrap by character, it looks like this:

    NOTE: THIS ONLY HAPPENS IN NON-WEBGL MODE. IT WORKS AS EXPECTED IN WEBGL HOWEVER.

    ____________________________

    |This is just a test. This is j|

    |ust a test. This is just a te|

    |st. This is just a test. This |

    |is just a test.                       |

    --------------------------------------

    If I do it by word, it looks like this:

    _________________________

    |This is just a test. This is|

    |just a test. This is just a |

    |test. This is just a test.   |

    |This is just a test.           |

    -----------------------------------

    Now... that's great.... BUT... if I had this instead of the text I mentioned: "abcdefghijklmnopqrstuvwxyz0123456789", it shows up like this:

    By character:

    _________________________

    |abcdefghijklmnopqrstu|

    |vwxyz0123456789         |

    -----------------------------------

    By word:

    _________________________

    |abcdefghijklmnopqrstu|vwxyz0123456789

    |                                          |

    -----------------------------------

    Even though the text object's width is still set the same.

    Attach a Capx

    [attachment=0:2sfhsbtt][/attachment:2sfhsbtt]

    Description of Capx

    This CAPX has WebGL disabled. Try viewing it in the Debug layout - you'll notice it stretches beyond it's width.

    Operating System and Service Pack

    Windows 7 Pro 64bit with Chrome & IE

    Construct 2 Version ID

    r195

  • Closing as won't fix. This is just a quirk of canvas2d mode: it draws the text directly to the canvas, so it can end up drawing text outside the bounding box. WebGL mode by necessity uses an intermediary texture, and ends up clipping the text outside the bounding box. Fixing canvas2d mode to match WebGL mode would come with a performance penalty, and WebGL is approaching ubiquitous support now, so I'd prefer to leave it as is.

  • Construct 3

    Buy Construct 3

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

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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)