/// <summary>
        /// Transforms a glyph vector by a specified 3x2 matrix.
        /// </summary>
        /// <param name="src">The glyph vector to transform.</param>
        /// <param name="matrix">The transformation matrix.</param>
        /// <returns>The new <see cref="GlyphVector"/>.</returns>
        public static GlyphTableEntry Transform(GlyphTableEntry src, Matrix3x2 matrix)
        {
            Vector2[] controlPoints = src.ControlPoints;
            for (int i = 0; i < controlPoints.Length; i++)
            {
                controlPoints[i] = Vector2.Transform(src.ControlPoints[i], matrix);
            }

            return(new GlyphTableEntry(controlPoints, src.OnCurves, src.EndPoints, Bounds.Transform(src.Bounds, matrix), src.Instructions));
        }
        /// <summary>
        /// Creates a new glyph table entry that is a deep copy of the specified instance.
        /// </summary>
        /// <param name="src">The source glyph table entry to copy.</param>
        /// <returns>The cloned <see cref="GlyphTableEntry"/>.</returns>
        public static GlyphTableEntry DeepClone(GlyphTableEntry src)
        {
            // Deep clone the arrays
            var controlPoints = new Vector2[src.ControlPoints.Length];

            src.ControlPoints.CopyTo(controlPoints.AsSpan());

            bool[] onCurves = new bool[src.OnCurves.Length];
            src.OnCurves.CopyTo(onCurves.AsSpan());

            ushort[] endPoints = new ushort[src.EndPoints.Length];
            src.EndPoints.CopyTo(endPoints.AsSpan());

            // Clone bounds
            Bounds sourceBounds = src.Bounds;
            var    newBounds    = new Bounds(sourceBounds.Min.X, sourceBounds.Min.Y, sourceBounds.Max.X, sourceBounds.Max.Y);

            // Instructions remain untouched.
            return(new GlyphTableEntry(controlPoints, onCurves, endPoints, newBounds, src.Instructions));
        }
 /// <summary>
 /// Translates a glyph vector by a specified x and y coordinates.
 /// </summary>
 /// <param name="src">The glyph vector to translate.</param>
 /// <param name="dx">The x-offset.</param>
 /// <param name="dy">The y-offset.</param>
 /// <returns>The new <see cref="GlyphTableEntry"/>.</returns>
 public static GlyphTableEntry Translate(GlyphTableEntry src, float dx, float dy)
 => Transform(src, Matrix3x2.CreateTranslation(dx, dy));
 /// <summary>
 /// Scales a glyph vector uniformly by a specified scale.
 /// </summary>
 /// <param name="src">The glyph vector to translate.</param>
 /// <param name="scale">The uniform scale to use.</param>
 /// <returns>The new <see cref="GlyphTableEntry"/>.</returns>
 public static GlyphTableEntry Scale(GlyphTableEntry src, float scale)
 => Transform(src, Matrix3x2.CreateScale(scale));