|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public class CodeUnitRun { |
|
|
|
class CodeUnitRun { |
|
|
|
public readonly int lineNumber; |
|
|
|
public readonly TextDirection direction; |
|
|
|
public readonly Range<int> codeUnits; |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public class FontMetrics { |
|
|
|
class FontMetrics { |
|
|
|
public readonly float ascent; |
|
|
|
public readonly float leading = 0.0f; |
|
|
|
public readonly float descent; |
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public class LineStyleRun { |
|
|
|
class LineStyleRun { |
|
|
|
public readonly int start; |
|
|
|
public readonly int end; |
|
|
|
public readonly TextStyle style; |
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public class PositionWithAffinity { |
|
|
|
class PositionWithAffinity { |
|
|
|
public readonly int position; |
|
|
|
public readonly TextAffinity affinity; |
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public class GlyphPosition { |
|
|
|
class GlyphPosition { |
|
|
|
public readonly Range<float> xPos; |
|
|
|
public readonly Range<int> codeUnits; |
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public class Range<T> : IEquatable<Range<T>> { |
|
|
|
class Range<T> : IEquatable<Range<T>> { |
|
|
|
public Range(T start, T end) { |
|
|
|
this.start = start; |
|
|
|
this.end = end; |
|
|
|
|
|
|
public readonly T start, end; |
|
|
|
} |
|
|
|
|
|
|
|
public static class RangeUtils { |
|
|
|
static class RangeUtils { |
|
|
|
public static Range<float> shift(Range<float> value, float shift) { |
|
|
|
return new Range<float>(value.start + shift, value.end + shift); |
|
|
|
} |
|
|
|
|
|
|
public class GlyphLine { |
|
|
|
class GlyphLine { |
|
|
|
public readonly List<GlyphPosition> positions; |
|
|
|
public readonly int totalCountUnits; |
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void setText(string text, StyledRuns runs) { |
|
|
|
internal void setText(string text, StyledRuns runs) { |
|
|
|
this._text = text; |
|
|
|
this._runs = runs; |
|
|
|
this._needsLayout = true; |
|
|
|
|
|
|
return TextBox.fromLTBD(0, top, 0, bottom, TextDirection.ltr); |
|
|
|
} |
|
|
|
|
|
|
|
public PositionWithAffinity getGlyphPositionAtCoordinate(float dx, float dy) { |
|
|
|
internal PositionWithAffinity getGlyphPositionAtCoordinate(float dx, float dy) { |
|
|
|
if (this._lineHeights.Count == 0) { |
|
|
|
return new PositionWithAffinity(0, TextAffinity.downstream); |
|
|
|
} |
|
|
|
|
|
|
return Mathf.Max(lineCount - 1, 0); |
|
|
|
} |
|
|
|
|
|
|
|
public LineRange getLineRange(int lineIndex) { |
|
|
|
internal LineRange getLineRange(int lineIndex) { |
|
|
|
public Range<int> getWordBoundary(int offset) { |
|
|
|
internal Range<int> getWordBoundary(int offset) { |
|
|
|
WordSeparate s = new WordSeparate(this._text); |
|
|
|
return s.findWordRange(offset); |
|
|
|
} |
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public class SplayTree<TKey, TValue> : IDictionary<TKey, TValue> where TKey : IComparable<TKey> { |
|
|
|
class SplayTree<TKey, TValue> : IDictionary<TKey, TValue> where TKey : IComparable<TKey> { |
|
|
|
SplayTreeNode root; |
|
|
|
int count; |
|
|
|
int version = 0; |
|
|
|