SvgFont.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. #pragma warning disable
  6. namespace Svg
  7. {
  8. [SvgElement("font")]
  9. public class SvgFont : SvgElement
  10. {
  11. [SvgAttribute("horiz-adv-x")]
  12. public float HorizAdvX
  13. {
  14. get { return (this.Attributes["horiz-adv-x"] == null ? 0 : (float)this.Attributes["horiz-adv-x"]); }
  15. set { this.Attributes["horiz-adv-x"] = value; }
  16. }
  17. [SvgAttribute("horiz-origin-x")]
  18. public float HorizOriginX
  19. {
  20. get { return (this.Attributes["horiz-origin-x"] == null ? 0 : (float)this.Attributes["horiz-origin-x"]); }
  21. set { this.Attributes["horiz-origin-x"] = value; }
  22. }
  23. [SvgAttribute("horiz-origin-y")]
  24. public float HorizOriginY
  25. {
  26. get { return (this.Attributes["horiz-origin-y"] == null ? 0 : (float)this.Attributes["horiz-origin-y"]); }
  27. set { this.Attributes["horiz-origin-y"] = value; }
  28. }
  29. [SvgAttribute("vert-adv-y")]
  30. public float VertAdvY
  31. {
  32. get { return (this.Attributes["vert-adv-y"] == null ? this.Children.OfType<SvgFontFace>().First().UnitsPerEm : (float)this.Attributes["vert-adv-y"]); }
  33. set { this.Attributes["vert-adv-y"] = value; }
  34. }
  35. [SvgAttribute("vert-origin-x")]
  36. public float VertOriginX
  37. {
  38. get { return (this.Attributes["vert-origin-x"] == null ? this.HorizAdvX / 2 : (float)this.Attributes["vert-origin-x"]); }
  39. set { this.Attributes["vert-origin-x"] = value; }
  40. }
  41. [SvgAttribute("vert-origin-y")]
  42. public float VertOriginY
  43. {
  44. get
  45. {
  46. return (this.Attributes["vert-origin-y"] == null ?
  47. (this.Children.OfType<SvgFontFace>().First().Attributes["ascent"] == null ? 0 : this.Children.OfType<SvgFontFace>().First().Ascent) :
  48. (float)this.Attributes["vert-origin-y"]);
  49. }
  50. set { this.Attributes["vert-origin-y"] = value; }
  51. }
  52. public override SvgElement DeepCopy()
  53. {
  54. return base.DeepCopy<SvgFont>();
  55. }
  56. }
  57. }
  58. #pragma warning restore