|
|
|
|
|
|
ParagraphStyle _paragraphStyle; |
|
|
|
List<LineRange> _lineRanges = new List<LineRange>(); |
|
|
|
List<float> _lineWidths = new List<float>(); |
|
|
|
List<float> _lineBaseLines = new List<float>(); |
|
|
|
float[] _lineBaseLines; |
|
|
|
List<float> _lineHeights = new List<float>(); |
|
|
|
float[] _lineHeights; |
|
|
|
List<PaintRecord> _paintRecords = new List<PaintRecord>(); |
|
|
|
List<CodeUnitRun> _codeUnitRuns = new List<CodeUnitRun>(); |
|
|
|
bool _didExceedMaxLines; |
|
|
|
|
|
|
const float kFloatDecorationSpacing = 3.0f; |
|
|
|
|
|
|
|
public float height { |
|
|
|
get { return this._lineHeights.Count == 0 ? 0 : this._lineHeights.last(); } |
|
|
|
get { return this._lineHeights?.last() ?? 0; } |
|
|
|
} |
|
|
|
|
|
|
|
public float minIntrinsicWidth { |
|
|
|
|
|
|
this._needsLayout = false; |
|
|
|
this._width = Mathf.Floor(constraints.width); |
|
|
|
this._paintRecords.Clear(); |
|
|
|
this._lineHeights.Clear(); |
|
|
|
this._lineBaseLines.Clear(); |
|
|
|
this._lineBaseLines = new float[this._lineRanges.Count]; |
|
|
|
this._lineHeights = new float[this._lineRanges.Count]; |
|
|
|
int styleMaxLines = this._paragraphStyle.maxLines ?? int.MaxValue; |
|
|
|
this._didExceedMaxLines = this._lineRanges.Count > styleMaxLines; |
|
|
|
|
|
|
|
|
|
|
updateLineMetrics(metrics, this._paragraphStyle.lineHeight ?? TextStyle.kDefaultHeight); |
|
|
|
} |
|
|
|
|
|
|
|
this._lineHeights.Add((this._lineHeights.Count == 0 ? 0 : this._lineHeights.last()) |
|
|
|
this._lineHeights[lineNumber] = ((lineNumber == 0 ? 0 : this._lineHeights[lineNumber - 1]) |
|
|
|
this._lineBaseLines.Add(this._lineHeights.last() - maxDescent); |
|
|
|
this._lineBaseLines[lineNumber] = this._lineHeights[lineNumber] - maxDescent; |
|
|
|
yOffset += Mathf.Round(maxLineSpacing + preMaxDescent); |
|
|
|
preMaxDescent = maxDescent; |
|
|
|
float lineXOffset = this.getLineXOffset(runXOffset); |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
internal PositionWithAffinity getGlyphPositionAtCoordinate(float dx, float dy) { |
|
|
|
if (this._lineHeights.Count == 0) { |
|
|
|
if (this._lineHeights == null) { |
|
|
|
for (yIndex = 0; yIndex < this._lineHeights.Count - 1; ++yIndex) { |
|
|
|
for (yIndex = 0; yIndex < this._lineHeights.Length - 1; ++yIndex) { |
|
|
|
if (dy < this._lineHeights[yIndex]) { |
|
|
|
break; |
|
|
|
} |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public int getLineCount() { |
|
|
|
return this._lineHeights.Count; |
|
|
|
return this._lineHeights?.Length ?? 0; |
|
|
|
} |
|
|
|
|
|
|
|
void _computeLineBreak() { |
|
|
|