在PIXIJS中,對於多行文本是支持的,但是會有一些問題
Name | Type | Default | Description |
---|---|---|---|
|
boolean | false | optional
Indicates if word wrap should be used |
wordWrapWidth |
number | 100 | optional
The width at which text will wrap, it needs wordWrap to be set to true |
多行文本可以這麼設置: wordWrap: true,//開啓換行 wordWrapWidth: 900//代表換行長度
問題1:中文不支持多行文本
breakWords: true可以添加這個屬性,支持中文
但不支持中英文來回切換
問題2:首行縮進無法實現
首先pixi沒有相關首行縮進API,其次如果直接首部加2個空格會被清除,這裏可以使用空白字符來代替空格。