这个功能是不是还没有集成进来?
目前还不支持字间距设置
什么时候可以有这个功能。
我写了个polyfill,可以用<-letter-spacing=20>fff</-letter-spacing>
const {ccclass, property} = cc._decorator
@ccclass
export default class RichTextPolyfill extends cc.Component {
private _richtext = null
private _string = null
// LIFE-CYCLE CALLBACKS:
public onLoad() {
this._richtext = this.getComponent(cc.RichText)
}
public update() {
const {
_richtext,
_string,
} = this
if (_richtext.string && _richtext.string !== _string) {
this._string = _richtext.string = _richtext.string.replace(/<-letter-spacing=([^>]*)>[^<]*<\/-letter-spacing>/g, (str, space) => {
let s = ''
for (const c of str.slice('<-letter-spacing=>'.length + space.length, str.length - '</-letter-spacing>'.length)) {
if (s) s += `<size=${space}> </size>`
s += c
}
return s
})
}
}
}
2021年了,到底什么时候支持啊