Text Width

0 favourites
  • 9 posts
From the Asset Store
OpenAI TTS
$9 USD
10% off
Text-to-Speech plugin.Allows your Construct 3 project to convert written text into spoken words
  • How to determine the size in pixels of a text in a particular font?

    And an "auto size" properties on the Text object would be nice!

  • Yep, that would be nice.

    And also, being able to change the size, the color, etc... of a text through Actions.

    I don't think we can right now...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yep, that would be nice.

    And also, being able to change the size, the color, etc... of a text through Actions.

    I don't think we can right now...

    Oh darn. I was planning on doing this. =\</p>

  • Use the expression len(text.text) (in case of a text object named text).

    This system expression will return the number of characters contained in the passed string.

    From there try to multiply it by your font's size +/- X (for the space between the characters).

    For formatting of text, check out jessejoh's HTML elements plugin that allow to use HTML formatting on your text.

  • Use the expression len(text.text) (in case of a text object named text).

    This system expression will return the number of characters contained in the passed string.

    From there try to multiply it by your font's size +/- X (for the space between the characters).

    I do that but its only works with fixed size fonts like "courier new".

    About use of others plugins I dont like so much because its not guaranteed to be compatible with future versions of C2, so I am asking that this feature is placed in the next release of C2.

  • : somebody can code a quick plugin using a DOM property from IE that has been implemented on other browser : offsetWidth.

    The way to use it is :

    var offsetWidth = element.offsetWidth;

    So if you have your text inside a <span>, for example, that has no border nor any frills, you can retrieve the width in pixels of your string as displayed on screen. I don't know if Ashley has the time to implement that C2's Text object, but perhaps another plugin developer can attack that problem.

    If nobody has done that yet in a week or two, I can make it myself, but not before ;).

  • Canvas has a measureText() method.

  • Friends, do not expect everyone to use the C2 can leave creating plugins. When we ask something like this is to be incorporated into the System C2 or object into another object in the standard distribution of the program. This program (C2) is designed to be simple. For most the creators are busy that we have the right to make requests even though they may not be met, that is how the program gets better and better.

    Thanks to all.

  • Added text measurement to the todo list.

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