public static Vector2 GetCursorPosition(TextNativeSettings settings, Rect rect, int cursorIndex) { if (settings.font == null) { Debug.LogError("Cannot process a null font."); return(Vector2.zero); } return(DoGetCursorPosition(settings, rect, cursorIndex)); }
public static Vector2 GetOffset(TextNativeSettings settings, Rect screenRect) { if (settings.font == null) { Debug.LogError("Cannot process a null font."); return(new Vector2(0, 0)); } settings.text = settings.text ?? ""; return(DoGetOffset(settings, screenRect)); }
public static unsafe NativeArray <TextVertex> GetVertices(TextNativeSettings settings) { int vertexCount = 0; GetVertices(settings, IntPtr.Zero, UnsafeUtility.SizeOf <TextVertex>(), ref vertexCount); var array = new NativeArray <TextVertex>(vertexCount, Allocator.Temp, NativeArrayOptions.UninitializedMemory); if (vertexCount > 0) { GetVertices(settings, (IntPtr)array.GetUnsafePtr(), UnsafeUtility.SizeOf <TextVertex>(), ref vertexCount); Debug.Assert(vertexCount == array.Length); } return(array); }
public static float ComputeTextHeight(TextNativeSettings settings) { if (settings.font == null) { Debug.LogError("Cannot process a null font."); return(0); } if (string.IsNullOrEmpty(settings.text)) { return(0); } return(DoComputeTextHeight(settings)); }
private static extern Vector2 DoGetOffset(TextNativeSettings settings, Rect rect);
private static extern void GetVertices(TextNativeSettings settings, IntPtr buffer, int vertexSize, ref int vertexCount);
private static extern Vector2 DoGetCursorPosition(TextNativeSettings settings, Rect rect, int cursorPosition);
private static extern float DoComputeTextHeight(TextNativeSettings settings);
private static extern float DoComputeTextWidth(TextNativeSettings settings);