Page 1 of 1

Suggestion: Let typewriter effect work with all richtext tags

Posted: Tue Apr 05, 2022 9:44 am
by bleese
Currently the typewriter effect breaks when using richtext tags other than <b><i><u> and <color> because the regex in Tools.StripRichTextCodes doesn't strip them (so the subtitle panel skips characters cause it thinks there's more visible characters then there are). There is a wealth of other rich text tags here http://digitalnativestudios.com/textmes ... /rich-text that the regex could be expanded to strip.

I dunno if there's enough people using non standard richtext tags to warrant the fix, I am dynamically setting the margin to create a crude "chat effect" in rich text, but I thought it's worth suggesting.

Re: Suggestion: Let typewriter effect work with all richtext tags

Posted: Tue Apr 05, 2022 11:01 am
by Tony Li
Hi,

What rich text codes does the typewriter miss? If you're using the TextMeshProTypewriterEffect,, it should work with these codes, too:

<[Bb]>|</[Bb]>|<[Ii]>|</[Ii]>|<color=[#]?\w+>|<color=""\w+"">|</color>|
<align=\w+>|</align>|<font=[^>]+>|</font>|<indent=\w+\%>|<indent=\w+>|</indent>|
<line-height=\w+%>|<line-height=\w+>|</line-height>|<line-indent=\w+\%>|<line-ident=\w+>|</line-ident>|
<link=""[^""]+"">|</link>|<lowercase>|</lowercase>|<uppercase>|</uppercase>|"
<smallcaps>|</smallcaps>|<margin=.+>|</margin>|<mark=#\w+>|</mark>|
<nobr>|</nobr>|<size=\w+\%>|<size=\w+>|</size>|<sprite=.+>|<[Ss]>|</[Ss]>|<[Uu]>|</[Uu]>|
<sup>|</sup>|<sub>|</sub>

Re: Suggestion: Let typewriter effect work with all richtext tags

Posted: Tue Apr 05, 2022 9:39 pm
by bleese
Huh, mine only blocks <b>, <i>, <u> and <color>, maybe I have an outdated version then.

Actually even the current Regex there still misses a few (and would miss it in my case)

Replace <margin=.+> with <margin-?\w+=.+> to include margin-left, margin-right, etc.

Re: Suggestion: Let typewriter effect work with all richtext tags

Posted: Tue Apr 05, 2022 10:27 pm
by Tony Li
Hi,

Please try this patch:

DS_TMProPatch_2022-04-05.unitypackage

It includes the latest TextMeshProTypewriterEffect and Tools script that uses an updated regex to support extra <margin-...> syntaxes.

Back up your project first to be safe. It should work with any relatively recent version of the Dialogue System, though.

Re: Suggestion: Let typewriter effect work with all richtext tags

Posted: Wed Apr 06, 2022 6:13 am
by bleese
Thank you!

Re: Suggestion: Let typewriter effect work with all richtext tags

Posted: Wed Apr 06, 2022 9:19 am
by Tony Li
Glad to help! Thanks for letting me know about the missing regex for that tag.