How do I highlight string text?

Get help using Construct 2

Post » Thu Aug 21, 2014 7:43 pm

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
B
3
Posts: 7
Reputation: 189

Post » Fri Sep 11, 2015 4:56 am

@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.
B
107
S
20
G
8
Posts: 155
Reputation: 11,741

Post » Fri Sep 11, 2015 8:27 am

This is not supported right now.
Scirra Founder
B
400
S
236
G
89
Posts: 24,549
Reputation: 195,475

Post » Fri Sep 11, 2015 8:40 am

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?
B
14
S
5
G
1
Posts: 32
Reputation: 1,038

Post » Fri Sep 11, 2015 8:55 am

This plugin does it:
plugin-tag-text_t92363
B
125
S
43
G
41
Posts: 849
Reputation: 28,260

Post » Fri Sep 11, 2015 1:16 pm

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

Word2Bold_Italic.capx


Image
B
67
S
24
G
7
Posts: 1,518
Reputation: 11,072

Post » Sat Oct 03, 2015 4:24 pm

Just make a sprite font:

sprite-font-generator-v2_t86546

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.
B
29
S
8
G
4
Posts: 767
Reputation: 5,985


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 28 guests