英文:
How to force symbols to break line in textbox
问题
我在运行时生成文本,我需要我的文本框不要分隔符号,如"+"或"/"。它会很好地断开单词,但像"+3/+3"这样的文本并不被视为一个完整的单词,所以它会分开。
示例
有没有一种方法可以强制文本框将这些符号视为一个完整的单词?
我在Unity中使用TMPro文本。
谢谢!
英文:
I generate text on runtime and I need my textbox NOT to break symbols such as "+" or "/". It will break the line just fine with words, but text such as "+3/+3" isn't considered a whole word so it breaks.
Example
Any way of forcing the textbox to treat those symbols as a whole word?
I'm using TMPro text in Unity.
Thanks!
答案1
得分: 0
尝试这个。 TMPro支持富文本,而且他们有一个用于此类事情的标签。链接中的示例显示了一个单词,其字母之间有空格,但它没有被分开。这不会成为一般规则,但您可以根据需要控制什么被视为“完整单词”。
富文本有时非常方便。
英文:
Try this. TMPro supports rich text and they have a tag for such a thing. The example in the link shows a word with whitespace between its letters yet it's not broken up. This won't be a general rule, but you can control what is considered a "whole word" on demand.
Rich text is very convenient sometimes.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论