FaceDict.cs 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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.PostScript.Internal;
  23. namespace SharpFont.PostScript
  24. {
  25. /// <summary>
  26. /// A structure used to represent data in a CID top-level dictionary.
  27. /// </summary>
  28. public class FaceDict
  29. {
  30. #region Fields
  31. private IntPtr reference;
  32. private FaceDictRec rec;
  33. #endregion
  34. #region Constructors
  35. internal FaceDict(IntPtr reference)
  36. {
  37. Reference = reference;
  38. }
  39. #endregion
  40. #region Properties
  41. public Private PrivateDictionary
  42. {
  43. get
  44. {
  45. return new Private(reference);
  46. }
  47. }
  48. [CLSCompliant(false)]
  49. public uint BuildCharLength
  50. {
  51. get
  52. {
  53. return rec.len_buildchar;
  54. }
  55. }
  56. public int ForceBoldThreshold
  57. {
  58. get
  59. {
  60. return (int)rec.forcebold_threshold;
  61. }
  62. }
  63. public int StrokeWidth
  64. {
  65. get
  66. {
  67. return (int)rec.stroke_width;
  68. }
  69. }
  70. public int ExpansionFactor
  71. {
  72. get
  73. {
  74. return (int)rec.expansion_factor;
  75. }
  76. }
  77. public byte PaintType
  78. {
  79. get
  80. {
  81. return rec.paint_type;
  82. }
  83. }
  84. public byte FontType
  85. {
  86. get
  87. {
  88. return rec.font_type;
  89. }
  90. }
  91. public FTMatrix FontMatrix
  92. {
  93. get
  94. {
  95. return new FTMatrix(new IntPtr(reference.ToInt64() + Marshal.OffsetOf(typeof(FaceDictRec), "font_matrix").ToInt64()));
  96. }
  97. }
  98. public FTVector FontOffset
  99. {
  100. get
  101. {
  102. return new FTVector(new IntPtr(reference.ToInt64() + Marshal.OffsetOf(typeof(FaceDictRec), "font_offset").ToInt64()));
  103. }
  104. }
  105. [CLSCompliant(false)]
  106. public uint SubrsCount
  107. {
  108. get
  109. {
  110. return rec.num_subrs;
  111. }
  112. }
  113. [CLSCompliant(false)]
  114. public uint SubrmapOffset
  115. {
  116. get
  117. {
  118. return (uint)rec.subrmap_offset;
  119. }
  120. }
  121. public int SDBytes
  122. {
  123. get
  124. {
  125. return rec.sd_bytes;
  126. }
  127. }
  128. internal IntPtr Reference
  129. {
  130. get
  131. {
  132. return reference;
  133. }
  134. set
  135. {
  136. reference = value;
  137. rec = PInvokeHelper.PtrToStructure<FaceDictRec>(reference);
  138. }
  139. }
  140. #endregion
  141. }
  142. }