FontGlyph.cs 881 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #if MONOGAME || FNA
  2. using Microsoft.Xna.Framework;
  3. using Microsoft.Xna.Framework.Graphics;
  4. #elif STRIDE
  5. using Stride.Core.Mathematics;
  6. using Texture2D = Stride.Graphics.Texture;
  7. #else
  8. using System.Drawing;
  9. using Texture2D = Veldrid.Texture;
  10. #endif
  11. namespace FontStashSharp
  12. {
  13. public class FontGlyph
  14. {
  15. public int Codepoint;
  16. public int Id;
  17. public int XAdvance;
  18. public Texture2D Texture;
  19. public Point RenderOffset;
  20. public Point TextureOffset;
  21. public Point Size;
  22. public bool IsEmpty
  23. {
  24. get
  25. {
  26. return Size.X == 0 || Size.Y == 0;
  27. }
  28. }
  29. public Rectangle TextureRectangle => new Rectangle(TextureOffset.X, TextureOffset.Y, Size.X, Size.Y);
  30. public Rectangle RenderRectangle => new Rectangle(RenderOffset.X, RenderOffset.Y, Size.X, Size.Y);
  31. }
  32. public class DynamicFontGlyph : FontGlyph
  33. {
  34. public float FontSize;
  35. public int FontSourceIndex;
  36. }
  37. }