fzhangtj 6 年前
当前提交
052787fb
共有 1 个文件被更改,包括 15 次插入15 次删除
  1. 30
      Runtime/ui/painting/txt/mesh_generator.cs

30
Runtime/ui/painting/txt/mesh_generator.cs


static readonly Dictionary<MeshKey, MeshInfo> _meshes = new Dictionary<MeshKey, MeshInfo>();
static long _frameCount = 0;
readonly TextBlob textBlob;
readonly float scale;
readonly TextBlob _textBlob;
readonly float _scale;
this.textBlob = textBlob;
this.scale = scale;
this._textBlob = textBlob;
this._scale = scale;
this._transform = transform;
}

this._resolved = true;
var style = this.textBlob.style;
var style = this._textBlob.style;
var key = new MeshKey(this.textBlob.instanceId, this.scale);
var key = new MeshKey(this._textBlob.instanceId, this._scale);
_meshes.TryGetValue(key, out var meshInfo);
if (meshInfo != null && meshInfo.textureVersion == fontInfo.textureVersion) {

}
var font = fontInfo.font;
var length = this.textBlob.textSize;
var text = this.textBlob.text;
var fontSizeToLoad = Mathf.CeilToInt(style.UnityFontSize * this.scale);
var length = this._textBlob.textSize;
var text = this._textBlob.text;
var fontSizeToLoad = Mathf.CeilToInt(style.UnityFontSize * this._scale);
var ch = text[charIndex + this.textBlob.textOffset];
var ch = text[charIndex + this._textBlob.textOffset];
var position = this.textBlob.positions[charIndex];
var position = this._textBlob.positions[charIndex];
if (LayoutUtils.isWordSpace(ch) || LayoutUtils.isLineEndSpace(ch) || ch == '\t') {
continue;
}

var minX = charInfo.minX / this.scale;
var maxX = charInfo.maxX / this.scale;
var minY = charInfo.minY / this.scale;
var maxY = charInfo.maxY / this.scale;
var minX = charInfo.minX / this._scale;
var maxX = charInfo.maxX / this._scale;
var minY = charInfo.minY / this._scale;
var maxY = charInfo.maxY / this._scale;
var baseIndex = vertices.Count;

正在加载...
取消
保存