Is there an equivalent to GraphicsPath.AddString in .NET Maui?

172 views Asked by At

Rendering text in 3D requires the geometry (lines, arcs, curves) making up the paths of a text string in a given font. .NET System.Drawing.Drawing2D has the GraphicsPath.AddString method for that purpose, but that's platform dependent.

I've discovered the PathF class in Maui, but find no similar string functionality there. Any way to get this font geometry data for a string would be helpful, even if through a 3rd party package.

1

There are 1 answers

4
Jessie Zhang -MSFT On

If I understand correctly, what you need should be Geometries in maui.

The .NET Multi-platform App UI (.NET MAUI) Geometry class, and the classes that derive from it, enable you to describe the geometry of a 2D shape. Geometry objects can be simple, such as rectangles and circles, or composite, created from two or more geometry objects. In addition, more complex geometries can be created that include arcs and curves.

The Geometry class is the parent class for several classes that define different categories of geometries:

  • EllipseGeometry, which represents the geometry of an ellipse or circle.
  • GeometryGroup, which represents a container that can combine multiple geometry objects into a single object.
  • LineGeometry, which represents the geometry of a line.
  • PathGeometry, which represents the geometry of a complex shape that can be composed of arcs, curves, ellipses, lines, and rectangles.
  • RectangleGeometry, which represents the geometry of a rectangle or square.

For more information, you can check document: Geometries