浏览代码

Make Paragraph._charWidths float[]

/main
Yuncong Zhang 5 年前
当前提交
1136bbd4
共有 2 个文件被更改,包括 4 次插入4 次删除
  1. 2
      Runtime/ui/txt/layout.cs
  2. 6
      Runtime/ui/txt/linebreaker.cs

2
Runtime/ui/txt/layout.cs


this._bounds.Set(_x, _y, _maxX - _x, _maxY - _y);
}
public static void computeCharWidths(string text, int start, int count, TextStyle style, List<float> advances, int advanceOffset) {
public static void computeCharWidths(string text, int start, int count, TextStyle style, float[] advances, int advanceOffset) {
char startingChar = text[start];
if (char.IsHighSurrogate(startingChar) || EmojiUtils.isSingleCharEmoji(startingChar)) {
float advance = style.fontSize + style.letterSpacing;

6
Runtime/ui/txt/linebreaker.cs


static List<int> _newLinePositions;
TextBuff _textBuf;
List<float> _charWidths = new List<float>();
float[] _charWidths;
List<int> _breaks = new List<int>();
List<float> _widths = new List<float>();
WordBreaker _wordBreaker = new WordBreaker();

}
public void resize(int size) {
if (this._charWidths.Count < size) {
NoAllocHelpersBridge<float>.ResizeList(this._charWidths, size);
if (this._charWidths == null || this._charWidths.Length < size) {
this._charWidths = new float[size];
}
}

正在加载...
取消
保存