浏览代码

Merge branch 'dpi' into 'master'

fix text layout issue

See merge request upm-packages/ui-widgets/com.unity.uiwidgets!75
/main
Shenhua Gu 6 年前
当前提交
0fdf3bc9
共有 1 个文件被更改,包括 18 次插入16 次删除
  1. 34
      Runtime/ui/txt/linebreaker.cs

34
Runtime/ui/txt/linebreaker.cs


void _addWordBreak(int offset, float preBreak, float postBreak, int preSpaceCount, int postSpaceCount,
float penalty) {
Candidate cand = new Candidate();
float width = this._candidates[this._candidates.Count - 1].preBreak;
if (postBreak - width > this._lineWidth) {
int i = this._candidates[this._candidates.Count - 1].offset;

if (w > 0) {
cand.offset = i;
cand.preBreak = width;
cand.postBreak = width;
cand.preSpaceCount = postSpaceCount;
cand.preSpaceCount = postSpaceCount;
cand.penalty = ScoreDesperate;
this._addCandidate(cand);
this._addCandidate(new Candidate {
offset = i,
preBreak = width,
postBreak = width,
preSpaceCount = postSpaceCount,
postSpaceCount = postSpaceCount,
penalty = ScoreDesperate,
});
cand.offset = offset;
cand.preBreak = preBreak;
cand.postBreak = postBreak;
cand.penalty = penalty;
cand.preSpaceCount = preSpaceCount;
cand.preSpaceCount = postSpaceCount;
this._addCandidate(cand);
this._addCandidate(new Candidate {
offset = offset,
preBreak = preBreak,
postBreak = postBreak,
preSpaceCount = preSpaceCount,
postSpaceCount = postSpaceCount,
penalty = penalty
});
}

正在加载...
取消
保存