浏览代码

Fix bug.

/main
Yuncong Zhang 5 年前
当前提交
58a55809
共有 2 个文件被更改,包括 11 次插入5 次删除
  1. 6
      Runtime/painting/text_painter.cs
  2. 10
      Runtime/ui/txt/paragraph.cs

6
Runtime/painting/text_painter.cs


using System.Collections.Generic;
using System;
using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.service;
using Unity.UIWidgets.ui;

var builder = new ParagraphBuilder(this._createParagraphStyle());
this._text.build(builder, this.textScaleFactor);
this._paragraph = builder.build();
}
else {
Debug.Log($"Use Old Paragraph [{DateTime.Now.Millisecond}]");
}
this._lastMinWidth = minWidth;

10
Runtime/ui/txt/paragraph.cs


}
public void layout(ParagraphConstraints constraints) {
if ((!this._needsLayout && this._width == constraints.width) ||
this._text == null || this._text.isEmpty()) {
if (!this._needsLayout && this._width == constraints.width) {
return;
}

int textCount = textEnd - textStart;
// Keep track of the pointer to _glyphPositions in the start of this run
int glyphPositionStyleRunStart = pGlyphPositions;
Font font = FontManager.instance.getOrCreate(
style.fontFamily,
style.fontWeight,
style.fontStyle).font;
// Ellipsize the text if ellipsis string is set, and this is the last lineStyleRun of
// the current line, and this is the last line or max line is not set

font.RequestCharactersInTextureSafe(ellipsis, style.UnityFontSize, style.UnityFontStyle);
float ellipsisWidth = Layout.measureText(ellipsis, style);
// Find the minimum number of characters to truncate, so that the truncated text

}
// Create paint record
var font = FontManager.instance.getOrCreate(style.fontFamily,
style.fontWeight, style.fontStyle).font;
var metrics = FontMetrics.fromFont(font, style.UnityFontSize);
PaintRecord paintRecord = new PaintRecord(style, runXOffset, 0, builder.make(),
metrics, advance);

正在加载...
取消
保存