Suggestion: Let typewriter effect work with all richtext tags

Announcements, support questions, and discussion for the Dialogue System.
Post Reply
bleese
Posts: 7
Joined: Tue Apr 05, 2022 9:29 am

Suggestion: Let typewriter effect work with all richtext tags

Post 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.
User avatar
Tony Li
Posts: 21972
Joined: Thu Jul 18, 2013 1:27 pm

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

Post 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>
bleese
Posts: 7
Joined: Tue Apr 05, 2022 9:29 am

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

Post 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.
User avatar
Tony Li
Posts: 21972
Joined: Thu Jul 18, 2013 1:27 pm

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

Post 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.
bleese
Posts: 7
Joined: Tue Apr 05, 2022 9:29 am

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

Post by bleese »

Thank you!
User avatar
Tony Li
Posts: 21972
Joined: Thu Jul 18, 2013 1:27 pm

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

Post by Tony Li »

Glad to help! Thanks for letting me know about the missing regex for that tag.
Post Reply