浏览代码

move mesh generate logic into canvas

/main
fzhangtj 6 年前
当前提交
8e442b7e
共有 21 个文件被更改,包括 263 次插入314 次删除
  1. 2
      Assets/UIWidgets/Tests/Paragraph.cs
  2. 2
      Assets/UIWidgets/rendering/proxy_box.cs
  3. 14
      Assets/UIWidgets/ui/painting/canvas.cs
  4. 24
      Assets/UIWidgets/ui/painting/canvas_impl.cs
  5. 16
      Assets/UIWidgets/ui/painting/draw_cmd.cs
  6. 10
      Assets/UIWidgets/ui/painting/picture.cs
  7. 2
      Assets/UIWidgets/ui/txt/linebreaker.cs
  8. 110
      Assets/UIWidgets/ui/txt/paragraph.cs
  9. 3
      Assets/UIWidgets/ui/painting/txt.meta
  10. 42
      Assets/UIWidgets/ui/txt/paint_record.cs
  11. 3
      Assets/UIWidgets/ui/txt/paint_record.cs.meta
  12. 37
      Assets/UIWidgets/ui/painting/txt/font_manager.cs
  13. 80
      Assets/UIWidgets/ui/painting/txt/mesh_generator.cs
  14. 3
      Assets/UIWidgets/ui/painting/txt/mesh_generator.cs.meta
  15. 31
      Assets/UIWidgets/ui/painting/txt/text_blob.cs
  16. 3
      Assets/UIWidgets/ui/painting/txt/text_blob.cs.meta
  17. 73
      Assets/UIWidgets/ui/txt/font_manager.cs
  18. 119
      Assets/UIWidgets/ui/txt/mesh.cs
  19. 3
      Assets/UIWidgets/ui/txt/mesh.cs.meta
  20. 0
      /Assets/UIWidgets/ui/painting/txt/font_manager.cs.meta

2
Assets/UIWidgets/Tests/Paragraph.cs


new List<TextSpan>()
{
new TextSpan("Real-time 3D revolutionizes:\n the animation pipeline.\n\n\nrevolutionizesn\n\nReal-time 3D revolutionizes the animation pipeline ", null),
})), 200, 80);
}), maxLines: 3), 200, 80);
}
RenderBox textHeight()

2
Assets/UIWidgets/rendering/proxy_box.cs


return hitTarget;
}
public override bool hitTestSelf(Offset position) {
protected override bool hitTestSelf(Offset position) {
return this.behavior == HitTestBehavior.opaque;
}
}

14
Assets/UIWidgets/ui/painting/canvas.cs


using UIWidgets.painting;
using UIWidgets.ui.txt;
using UnityEngine;
namespace UIWidgets.ui {

void clipRRect(RRect rrect);
void drawMesh(IMesh mesh, Material material);
void drawTextBlob(TextBlob textBlob, double x, double y);
}
public class RecorderCanvas : Canvas {

});
}
public void drawMesh(IMesh mesh, Material material)
public void drawTextBlob(TextBlob textBlob, double x, double y)
this._recorder.addDrawCmd(new DrawMesh() {
mesh = mesh,
material = material,
this._recorder.addDrawCmd(new DrawTextBlob() {
textBlob = textBlob,
x = x,
y = y,
}
}

24
Assets/UIWidgets/ui/painting/canvas_impl.cs


using System;
using System.Collections.Generic;
using UIWidgets.painting;
using UIWidgets.ui.painting.txt;
using UIWidgets.ui.txt;
using UnityEditor;
using UnityEngine;

else if (drawCmd is DrawClipRRect) {
var drawClipRRect = (DrawClipRRect) drawCmd;
this.clipRRect(drawClipRRect.rrect);
} else if (drawCmd is DrawMesh) {
var drawMesh = (DrawMesh) drawCmd;
this.drawMesh(drawMesh.mesh, drawMesh.material);
} else if (drawCmd is DrawTextBlob) {
var drawTextBlob = (DrawTextBlob) drawCmd;
this.drawTextBlob(drawTextBlob.textBlob, drawTextBlob.x, drawTextBlob.y);
} else {
throw new Exception("unknown drawCmd: " + drawCmd);
}

this.pushClipRRect(rect, this._transform);
}
public void drawMesh(IMesh mesh, Material material)
public void drawTextBlob(TextBlob textBlob, double x, double y)
prepareGL(material);
material.SetPass(0);
mesh.syncTextureUV();
Graphics.DrawMeshNow(mesh.mesh, Matrix4x4.identity);
var mesh = MeshGenrator.generateMesh(textBlob, x, y);
var font = FontManager.instance.getOrCreate(textBlob.style.safeFontFamily, textBlob.style.UnityFontSize);
prepareGL(font.material);
font.material.SetPass(0);
Graphics.DrawMeshNow(mesh, Matrix4x4.identity);
}
private void pushClipRect(Rect clipRect, Matrix4x4 transform) {

GL.MultMatrix(this._transform);
}
//
// private double PixelRound(double v)
// {
// return Math.Floor(v * EditorGUIUtility.pixelsPerPoint) EditorGUIUtility.pixelsPerPoint;
// }
private class ClipRec {
public ClipRec(Matrix4x4 transform, Rect rect = null, RRect rrect = null) {

16
Assets/UIWidgets/ui/painting/draw_cmd.cs


using UIWidgets.painting;
using UIWidgets.ui.txt;
using UnityEngine.UI;
namespace UIWidgets.ui {
public interface DrawCmd {

public RRect rrect;
}
public class DrawMesh : DrawCmd {
public IMesh mesh;
public Material material;
}
public interface IMesh
public class DrawTextBlob : DrawCmd
void syncTextureUV();
public TextBlob textBlob;
public double x;
public double y;
}
Mesh mesh { get; }
}
}

10
Assets/UIWidgets/ui/painting/picture.cs


} else if (drawCmd is DrawClipRRect) {
var drawClipRRect = (DrawClipRRect) drawCmd;
this.addClipRect(drawClipRRect.rrect.outerRect);
} else if (drawCmd is DrawMesh) {
var bounds = ((DrawMesh)drawCmd).mesh.mesh.bounds;
var rect = Rect.fromLTRB(bounds.min.x, bounds.min.y, bounds.max.x, bounds.max.y);
this.addPaintBounds(rect);
} else if (drawCmd is DrawTextBlob)
{
var drawTextBlob = (DrawTextBlob) drawCmd;
var bounds = drawTextBlob.textBlob.boundsInText.shift(new Offset(drawTextBlob.x, drawTextBlob.y));
this.addPaintBounds(bounds);
} else
{
throw new Exception("unknown drawCmd: " + drawCmd);

2
Assets/UIWidgets/ui/txt/linebreaker.cs


{
runIterator.nextTo(charIndex);
var run = runIterator.run;
var font = FontManager.instance.getOrCreate(run.style.safeFontFamily, run.style.UnityFontSize).font;
var font = FontManager.instance.getOrCreate(run.style.safeFontFamily, run.style.UnityFontSize);
var style = run.style;
var charInfo = new CharacterInfo();

110
Assets/UIWidgets/ui/txt/paragraph.cs


using System;
using System.Collections.Generic;
using UIWidgets.ui.txt;
using UnityEngine;
namespace UIWidgets.ui

private double _ideographicBaseline;
private double[] _characterWidths;
private List<double> _lineHeights = new List<double>();
private List<PaintRecord> _paintRecords = new List<PaintRecord>();
private bool _didExceedMaxLines;
// private double _characterWidth;

public void paint(Canvas canvas, double x, double y)
{
for (int runIndex = 0; runIndex < _runs.size; ++runIndex)
foreach (var paintRecord in _paintRecords)
var run = _runs.getRun(runIndex);
if (run.start < run.end)
{
var fontEntry = FontManager.instance.getOrCreate(run.style.safeFontFamily, run.style.UnityFontSize);
var mesh = new TextMesh(new Vector2d(x, y), _text, _characterPositions, fontEntry, run);
canvas.drawMesh(mesh, fontEntry.font.material);
}
canvas.drawTextBlob(paintRecord.text, x, y);
}
}

computeLineBreak();
var maxLines = _paragraphStyle.maxLines ?? 0;
_didExceedMaxLines = maxLines == 0 || _lineRanges.Count <= maxLines;
_didExceedMaxLines = !(maxLines == 0 || _lineRanges.Count <= maxLines);
var lineLimits = maxLines == 0 ? _lineRanges.Count : Math.Min(maxLines, _lineRanges.Count);
layoutLines(lineLimits);

_lineHeights.Clear();
_lineRanges.Clear();
_lineWidths.Clear();
_paintRecords.Clear();
_characterWidths = new double[_text.Length];
for (int i = 0; i < _runs.size; ++i)
{

var font = FontManager.instance.getOrCreate(run.style.safeFontFamily, run.style.UnityFontSize).font;
var font = FontManager.instance.getOrCreate(run.style.safeFontFamily, run.style.UnityFontSize);
font.RequestCharactersInTexture(_text.Substring(run.start, run.end - run.start), 0,
run.style.UnityFontStyle);
}

var run = _runs.getRun(runIndex);
if (run.start < run.end && run.start < line.end && run.end > line.start)
{
var font = FontManager.instance.getOrCreate(run.style.safeFontFamily, run.style.UnityFontSize).font;
var font = FontManager.instance.getOrCreate(run.style.safeFontFamily, run.style.UnityFontSize);
var ascent = font.ascent * (run.style.height??1.0);
var descent = (font.lineHeight - font.ascent) * (run.style.height??1.0);
if (ascent > maxAscent)

{
maxDescent = descent;
}
int start = Math.Max(run.start, line.start);
int end = Math.Min(run.end, line.end);
var width = _characterPositions[end - 1].x + _characterWidths[end - 1] -
_characterPositions[start].x;
if (end > start)
{
var bounds = Rect.fromLTWH(0, -ascent,
_characterPositions[end - 1].x + _characterWidths[end - 1] -
_characterPositions[start].x,
descent);
_paintRecords.Add(new PaintRecord(run.style, new TextBlob(
_text, start, end, _characterPositions, run.style, bounds),
lineNumber, width));
}
}
if (runIndex + 1 >= _runs.size)

return;
}
private Mesh generateMesh(double x, double y, Font font, StyledRuns.Run run)
{
var vertices = new Vector3[_text.Length * 4];
var triangles = new int[_text.Length * 6];
var uv = new Vector2[_text.Length * 4];
Vector3 offset = new Vector3((float)Utils.PixelCorrectRound(x), (float)Utils.PixelCorrectRound(y), 0);
font.RequestCharactersInTexture(_text.Substring(run.start, run.end - run.start),
run.style.UnityFontSize, run.style.UnityFontStyle);
for (int charIndex = run.start; charIndex < run.end; ++charIndex)
{
CharacterInfo charInfo = new CharacterInfo();
if (_text[charIndex] != '\n' && _text[charIndex] != '\t')
{
font.GetCharacterInfo(_text[charIndex], out charInfo, run.style.UnityFontSize, run.style.UnityFontStyle);
var position = _characterPositions[charIndex];
vertices[4 * charIndex + 0] = offset + new Vector3((float)(position.x + charInfo.minX),
(float)(position.y - charInfo.maxY), 0);
vertices[4 * charIndex + 1] = offset + new Vector3((float)(position.x + charInfo.maxX),
(float)(position.y - charInfo.maxY), 0);
vertices[4 * charIndex + 2] = offset + new Vector3(
(float)(position.x + charInfo.maxX), (float)(position.y - charInfo.minY), 0);
vertices[4 * charIndex + 3] = offset + new Vector3(
(float)(position.x + charInfo.minX), (float)(position.y - charInfo.minY), 0);
}
else
{
vertices[4 * charIndex + 0] = vertices[4 * charIndex + 1] =
vertices[4 * charIndex + 2] = vertices[4 * charIndex + 3] = offset;
}
if (isWordSpace(_text[charIndex]) || isLineEndSpace(_text[charIndex]) || _text[charIndex] == '\t')
{
uv[4 * charIndex + 0] = Vector2.zero;
uv[4 * charIndex + 1] = Vector2.zero;
uv[4 * charIndex + 2] = Vector2.zero;
uv[4 * charIndex + 3] = Vector2.zero;
} else
{
uv[4 * charIndex + 0] = charInfo.uvTopLeft;
uv[4 * charIndex + 1] = charInfo.uvTopRight;
uv[4 * charIndex + 2] = charInfo.uvBottomRight;
uv[4 * charIndex + 3] = charInfo.uvBottomLeft;
}
triangles[6 * charIndex + 0] = 4 * charIndex + 0;
triangles[6 * charIndex + 1] = 4 * charIndex + 1;
triangles[6 * charIndex + 2] = 4 * charIndex + 2;
triangles[6 * charIndex + 3] = 4 * charIndex + 0;
triangles[6 * charIndex + 4] = 4 * charIndex + 2;
triangles[6 * charIndex + 5] = 4 * charIndex + 3;
}
// for (var i = 0; i < vertices.Length; i++)
// {
// vertices[i].x = (float)Math.Round(vertices[i].x);
// vertices[i].y = (float)Math.Round(vertices[i].y);
// }
var mesh = new Mesh()
{
vertices = vertices,
triangles = triangles,
uv = uv
};
var colors = new UnityEngine.Color[vertices.Length];
for (var i = 0; i < colors.Length; i++)
{
colors[i] = run.style.UnityColor;
}
mesh.colors = colors;
return mesh;
}
private double getLineXOffset(double lineTotalAdvance) {

3
Assets/UIWidgets/ui/painting/txt.meta


fileFormatVersion: 2
guid: 9438a28ff5974aac92d56928b06692ad
timeCreated: 1536299863

42
Assets/UIWidgets/ui/txt/paint_record.cs


using UIWidgets.ui.txt;
namespace UIWidgets.ui
{
public class PaintRecord
{
public PaintRecord(TextStyle style, TextBlob _text,
int line, double runWidth)
{
this._style = style;
this._text = _text;
this._line = line;
this._runWidth = runWidth;
}
public TextBlob text
{
get { return _text; }
}
public TextStyle style
{
get { return _style; }
}
public int line
{
get { return _line; }
}
public double runWidth
{
get { return _runWidth; }
}
private TextStyle _style;
private TextBlob _text;
private int _line;
private double _runWidth;
}
}

3
Assets/UIWidgets/ui/txt/paint_record.cs.meta


fileFormatVersion: 2
guid: 2695fb8e8f284b95ad9a175da41a9101
timeCreated: 1536300023

37
Assets/UIWidgets/ui/painting/txt/font_manager.cs


using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace UIWidgets.ui
{
public class FontManager
{
private List<Font> _fonts = new List<Font>();
public static readonly FontManager instance = new FontManager();
public Font getOrCreate(string[] names, int fontSize)
{
var founded = _fonts.Find((font) =>
(
font.fontSize == fontSize &&
(names == font.fontNames || (names != null && names.SequenceEqual(font.fontNames)))));
if (founded != null)
{
return founded;
}
Debug.Log(string.Format("Create new Font names={0}, size={1}", names, fontSize));
var newFont = Font.CreateDynamicFontFromOSFont(names,
fontSize);
_fonts.Add(newFont);
return newFont;
}
public Font getOrCreate(string name, int fontSize)
{
return getOrCreate(new []{name}, fontSize);
}
}
}

80
Assets/UIWidgets/ui/painting/txt/mesh_generator.cs


using UIWidgets.ui.txt;
using UnityEngine;
namespace UIWidgets.ui.painting.txt
{
public static class MeshGenrator
{
public static Mesh generateMesh(TextBlob textBlob, double x, double y)
{
var style = textBlob.style;
var font = FontManager.instance.getOrCreate(style.safeFontFamily, style.UnityFontSize);
var length = textBlob.end - textBlob.start;
var vertices = new Vector3[length * 4];
var triangles = new int[length * 6];
var uv = new Vector2[length * 4];
var text = textBlob.text;
var offset = new Vector3((float)Utils.PixelCorrectRound(x), (float)Utils.PixelCorrectRound(y), 0);
font.RequestCharactersInTexture(textBlob.text.Substring(textBlob.start, textBlob.end - textBlob.start),
style.UnityFontSize, style.UnityFontStyle);
for (int charIndex = 0; charIndex < length; ++charIndex)
{
var ch = text[charIndex + textBlob.start];
var position = textBlob.positions[charIndex + textBlob.start];
CharacterInfo charInfo = new CharacterInfo();
if (Paragraph.isWordSpace(ch) || Paragraph.isLineEndSpace(ch) || ch== '\t')
{
vertices[4 * charIndex + 0] = vertices[4 * charIndex + 1] =
vertices[4 * charIndex + 2] = vertices[4 * charIndex + 3] = offset;
uv[4 * charIndex + 0] = Vector2.zero;
uv[4 * charIndex + 1] = Vector2.zero;
uv[4 * charIndex + 2] = Vector2.zero;
uv[4 * charIndex + 3] = Vector2.zero;
}
else
{
font.GetCharacterInfo(ch, out charInfo, style.UnityFontSize, style.UnityFontStyle);
vertices[4 * charIndex + 0] = offset + new Vector3((float)(position.x + charInfo.minX),
(float)(position.y - charInfo.maxY), 0);
vertices[4 * charIndex + 1] = offset + new Vector3((float)(position.x + charInfo.maxX),
(float)(position.y - charInfo.maxY), 0);
vertices[4 * charIndex + 2] = offset + new Vector3(
(float)(position.x + charInfo.maxX), (float)(position.y - charInfo.minY), 0);
vertices[4 * charIndex + 3] = offset + new Vector3(
(float)(position.x + charInfo.minX), (float)(position.y - charInfo.minY), 0);
uv[4 * charIndex + 0] = charInfo.uvTopLeft;
uv[4 * charIndex + 1] = charInfo.uvTopRight;
uv[4 * charIndex + 2] = charInfo.uvBottomRight;
uv[4 * charIndex + 3] = charInfo.uvBottomLeft;
}
triangles[6 * charIndex + 0] = 4 * charIndex + 0;
triangles[6 * charIndex + 1] = 4 * charIndex + 1;
triangles[6 * charIndex + 2] = 4 * charIndex + 2;
triangles[6 * charIndex + 3] = 4 * charIndex + 0;
triangles[6 * charIndex + 4] = 4 * charIndex + 2;
triangles[6 * charIndex + 5] = 4 * charIndex + 3;
}
var mesh = new Mesh()
{
vertices = vertices,
triangles = triangles,
uv = uv
};
var colors = new UnityEngine.Color[vertices.Length];
for (var i = 0; i < colors.Length; i++)
{
colors[i] = style.UnityColor;
}
mesh.colors = colors;
return mesh;
}
}
}

3
Assets/UIWidgets/ui/painting/txt/mesh_generator.cs.meta


fileFormatVersion: 2
guid: 79c7ef33071e4ec9b28b196b3e265bfa
timeCreated: 1536301684

31
Assets/UIWidgets/ui/painting/txt/text_blob.cs


using System;
using UnityEngine;
namespace UIWidgets.ui.txt
{
public class TextBlob
{
public TextBlob(string text, int start, int end, Vector2d[] positions, TextStyle style, Rect bounds)
{
Debug.Assert(start < end);
this.text = text;
this.start = start;
this.end = end;
this.positions = positions;
this.style = style;
this.bounds = bounds;
}
public Rect boundsInText
{
get { return bounds.shift(new Offset(positions[start].x, positions[start].y)); }
}
public readonly string text;
public readonly int start;
public readonly int end;
public readonly Vector2d[] positions;
public readonly TextStyle style;
public readonly Rect bounds; // bounds with positions[start] as origin
}
}

3
Assets/UIWidgets/ui/painting/txt/text_blob.cs.meta


fileFormatVersion: 2
guid: 8fc95fa5caea426a80f19b2d0f99955f
timeCreated: 1536299888

73
Assets/UIWidgets/ui/txt/font_manager.cs


using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
namespace UIWidgets.ui
{
public class FontEntry
{
public readonly Font font;
private int _textureBuildVersion = 0;
public FontEntry(Font font)
{
this.font = font;
}
public int textureBuildVersion
{
get { return _textureBuildVersion; }
}
internal void onFontTextureRebuild()
{
_textureBuildVersion++;
}
}
public class FontManager
{
private List<FontEntry> _fonts = new List<FontEntry>();
public static readonly FontManager instance = new FontManager();
private FontManager()
{
Font.textureRebuilt += this.onFontTextureRebuilt;
}
public FontEntry getOrCreate(string[] names, int fontSize)
{
var founded = _fonts.Find((font) =>
(
font.font.fontSize == fontSize &&
(names == font.font.fontNames || (names != null && names.SequenceEqual(font.font.fontNames)))));
if (founded != null)
{
return founded;
}
Debug.Log(string.Format("Create new Font names={0}, size={1}", names, fontSize));
var newFont = new FontEntry(Font.CreateDynamicFontFromOSFont(names,
fontSize));
_fonts.Add(newFont);
return newFont;
}
public FontEntry getOrCreate(string name, int fontSize)
{
return getOrCreate(new []{name}, fontSize);
}
private void onFontTextureRebuilt(Font font)
{
var entry = _fonts.Find((f) => f.font == font);
if (entry != null)
{
entry.onFontTextureRebuild();
}
}
}
}

119
Assets/UIWidgets/ui/txt/mesh.cs


using UnityEngine;
namespace UIWidgets.ui
{
public class TextMesh: IMesh
{
private Mesh _mesh;
private FontEntry _fontEntry;
private string _text;
private StyledRuns.Run _run;
private int _textureVersion;
public TextMesh(Vector2d pos, string text, Vector2d[] _characterPositions, FontEntry fontEntry, StyledRuns.Run run)
{
_fontEntry = fontEntry;
_text = text;
this._run = run;
var vertices = new Vector3[_text.Length * 4];
var triangles = new int[_text.Length * 6];
var font = fontEntry.font;
var offset = new Vector3((float)Utils.PixelCorrectRound(pos.x), (float)Utils.PixelCorrectRound(pos.y), 0);
font.RequestCharactersInTexture(_text.Substring(_run.start, _run.end - _run.start),
_run.style.UnityFontSize, _run.style.UnityFontStyle);
for (int charIndex = _run.start; charIndex < _run.end; ++charIndex)
{
CharacterInfo charInfo = new CharacterInfo();
if (_text[charIndex] != '\n' && _text[charIndex] != '\t')
{
Debug.Assert(font.GetCharacterInfo(_text[charIndex], out charInfo, _run.style.UnityFontSize, _run.style.UnityFontStyle));
var position = _characterPositions[charIndex];
vertices[4 * charIndex + 0] = offset + new Vector3((float)(position.x + charInfo.minX),
(float)(position.y - charInfo.maxY), 0);
vertices[4 * charIndex + 1] = offset + new Vector3((float)(position.x + charInfo.maxX),
(float)(position.y - charInfo.maxY), 0);
vertices[4 * charIndex + 2] = offset + new Vector3(
(float)(position.x + charInfo.maxX), (float)(position.y - charInfo.minY), 0);
vertices[4 * charIndex + 3] = offset + new Vector3(
(float)(position.x + charInfo.minX), (float)(position.y - charInfo.minY), 0);
}
else
{
vertices[4 * charIndex + 0] = vertices[4 * charIndex + 1] =
vertices[4 * charIndex + 2] = vertices[4 * charIndex + 3] = offset;
}
triangles[6 * charIndex + 0] = 4 * charIndex + 0;
triangles[6 * charIndex + 1] = 4 * charIndex + 1;
triangles[6 * charIndex + 2] = 4 * charIndex + 2;
triangles[6 * charIndex + 3] = 4 * charIndex + 0;
triangles[6 * charIndex + 4] = 4 * charIndex + 2;
triangles[6 * charIndex + 5] = 4 * charIndex + 3;
}
var uv = getTextureUV();
var mesh = new Mesh()
{
vertices = vertices,
triangles = triangles,
uv = uv
};
var colors = new UnityEngine.Color[vertices.Length];
for (var i = 0; i < colors.Length; i++)
{
colors[i] = _run.style.UnityColor;
}
mesh.colors = colors;
_textureVersion = _fontEntry.textureBuildVersion;
_mesh = mesh;
}
public void syncTextureUV()
{
if (_fontEntry.textureBuildVersion != _textureVersion) // texture has been rebuilt, update the texture uv
{
_mesh.uv = getTextureUV();
}
}
public Mesh mesh
{
get { return _mesh; }
}
private Vector2[] getTextureUV()
{
var font = _fontEntry.font;
var uv = _mesh == null ? new Vector2[_text.Length * 4] : _mesh.uv;
for (int charIndex = _run.start; charIndex < _run.end; ++charIndex)
{
CharacterInfo charInfo = new CharacterInfo();
if (_text[charIndex] != '\n' && _text[charIndex] != '\t')
{
font.GetCharacterInfo(_text[charIndex], out charInfo, _run.style.UnityFontSize,
_run.style.UnityFontStyle);
}
if (Paragraph.isWordSpace(_text[charIndex]) || Paragraph.isLineEndSpace(_text[charIndex]) || _text[charIndex] == '\t')
{
uv[4 * charIndex + 0] = Vector2.zero;
uv[4 * charIndex + 1] = Vector2.zero;
uv[4 * charIndex + 2] = Vector2.zero;
uv[4 * charIndex + 3] = Vector2.zero;
} else
{
uv[4 * charIndex + 0] = charInfo.uvTopLeft;
uv[4 * charIndex + 1] = charInfo.uvTopRight;
uv[4 * charIndex + 2] = charInfo.uvBottomRight;
uv[4 * charIndex + 3] = charInfo.uvBottomLeft;
}
}
return uv;
}
}
}

3
Assets/UIWidgets/ui/txt/mesh.cs.meta


fileFormatVersion: 2
guid: 96ec1d4b2b7d4bf59d4b2db221323ae9
timeCreated: 1536283931

/Assets/UIWidgets/ui/txt/font_manager.cs.meta → /Assets/UIWidgets/ui/painting/txt/font_manager.cs.meta

正在加载...
取消
保存