MMAxis.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. #region MIT License
  2. /*Copyright (c) 2012 Robert Rouhani <robert.rouhani@gmail.com>
  3. SharpFont based on Tao.FreeType, Copyright (c) 2003-2007 Tao Framework Team
  4. Permission is hereby granted, free of charge, to any person obtaining a copy of
  5. this software and associated documentation files (the "Software"), to deal in
  6. the Software without restriction, including without limitation the rights to
  7. use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
  8. of the Software, and to permit persons to whom the Software is furnished to do
  9. so, subject to the following conditions:
  10. The above copyright notice and this permission notice shall be included in all
  11. copies or substantial portions of the Software.
  12. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  13. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  14. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  15. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  16. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  17. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  18. SOFTWARE.*/
  19. #endregion
  20. using System;
  21. using System.Runtime.InteropServices;
  22. using SharpFont.MultipleMasters.Internal;
  23. namespace SharpFont.MultipleMasters
  24. {
  25. /// <summary><para>
  26. /// A simple structure used to model a given axis in design space for Multiple Masters fonts.
  27. /// </para><para>
  28. /// This structure can't be used for GX var fonts.
  29. /// </para></summary>
  30. public class MMAxis
  31. {
  32. #region Fields
  33. private IntPtr reference;
  34. private MMAxisRec rec;
  35. #endregion
  36. #region Constructors
  37. internal MMAxis(IntPtr reference)
  38. {
  39. Reference = reference;
  40. }
  41. internal MMAxis(MMAxisRec axisInternal)
  42. {
  43. this.rec = axisInternal;
  44. }
  45. #endregion
  46. #region Properties
  47. /// <summary>
  48. /// Gets the axis's name.
  49. /// </summary>
  50. public string Name
  51. {
  52. get
  53. {
  54. return rec.name;
  55. }
  56. }
  57. /// <summary>
  58. /// Gets the axis's minimum design coordinate.
  59. /// </summary>
  60. public int Minimum
  61. {
  62. get
  63. {
  64. return (int)rec.minimum;
  65. }
  66. }
  67. /// <summary>
  68. /// Gets the axis's maximum design coordinate.
  69. /// </summary>
  70. public int Maximum
  71. {
  72. get
  73. {
  74. return (int)rec.maximum;
  75. }
  76. }
  77. internal IntPtr Reference
  78. {
  79. get
  80. {
  81. return reference;
  82. }
  83. set
  84. {
  85. reference = value;
  86. rec = PInvokeHelper.PtrToStructure<MMAxisRec>(reference);
  87. }
  88. }
  89. #endregion
  90. }
  91. }