How do I highlight string text?

  • Hello fellow Construct 2 users, I've recently run into a couple of problems with an app I'm trying to make. I have s tring of text that I need to modify a bit. I need one word in the string to be bold, highlighted, or italicized. Then I need to be able to replace the modified word with the X values of an array.

    Something like this maybe:

    "We went to the store on monday"

    replace(String.Text, (red words),Array.At(x))

    Any idea if this is possible?

    Help would be much appreciated

    ~TylerNormal

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ashley, R0J0hound, newt, korbaach is this possible in the current textbox or text object?

    I am also working on a similar scenario where i have to modify one word in a text string which is loaded from an xml.

    Thank you in advanced for your assistance.

  • This is not supported right now.

  • What if you use two textboxes, one for the normal text and then another one for the bold text. You just have to align them correctly with events?

    It could be a temporarly workaround?

  • This plugin does it:

  • or...you can bild your own system...

    Word2Bold_Italic.capx

  • Just make a sprite font:

    Make it at least 2 times the size of the character that you want, and then use 0.5 in the "scale" sprite font Construct 2 setting. This will insure you get crisp edges on tiny font scale.

    If you make an outline make sure it is at least 2 Pixels (2px) wide in the sprite font generator, so when you scale it down you will get an exact 1 pixel outline.

    If you dont want to put a background behind the text, I highly recommend doing White with a Black outline, This way it will stand out. If you add a shadow, this will also help.

    The Sprite font generator is really awesome, if you use it be sure to pop into the thread again to thank BlackHornet.

    Sprite font will let you choose a custom font really easy, and distribute it across all platforms, without supplying a font file, or downloading one from Google font.

    Not to mention it is really easy to add tweak to the font in GIMP. I really have a thing about my "o"'s and "0"'s. I always add a Dot to the center of the Zero, or a slash so it is REALLY OBVIOUS! Modern computer fonts suck for programming. In the old days we always had slashed "0"'s so Typos where really easy to spot. We did not have things like "Syntax hi-lighting" on Apple, Atari or Commodore computers.

    You also get the ability to reduce the file-size by compressing your .PNG file. I think C2 has an option to automatically compress them on export.

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