Private.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274
  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 model a Type 1 or Type 2 private dictionary. Note that for Multiple Master fonts, each
  27. /// instance has its own Private dictionary.
  28. /// </summary>
  29. public class Private
  30. {
  31. #region Fields
  32. private IntPtr reference;
  33. private PrivateRec rec;
  34. #endregion
  35. #region Constructors
  36. internal Private(IntPtr reference)
  37. {
  38. Reference = reference;
  39. }
  40. #endregion
  41. #region Properties
  42. public int UniqueId
  43. {
  44. get
  45. {
  46. return rec.unique_id;
  47. }
  48. }
  49. public int LenIV
  50. {
  51. get
  52. {
  53. return rec.lenIV;
  54. }
  55. }
  56. public byte BlueValuesCount
  57. {
  58. get
  59. {
  60. return rec.num_blue_values;
  61. }
  62. }
  63. public byte OtherBluesCount
  64. {
  65. get
  66. {
  67. return rec.num_other_blues;
  68. }
  69. }
  70. public byte FamilyBluesCount
  71. {
  72. get
  73. {
  74. return rec.num_family_blues;
  75. }
  76. }
  77. public byte FamilyOtherBluesCount
  78. {
  79. get
  80. {
  81. return rec.num_family_other_blues;
  82. }
  83. }
  84. public short[] BlueValues
  85. {
  86. get
  87. {
  88. return rec.blue_values;
  89. }
  90. }
  91. public short[] OtherBlues
  92. {
  93. get
  94. {
  95. return rec.other_blues;
  96. }
  97. }
  98. public short[] FamilyBlues
  99. {
  100. get
  101. {
  102. return rec.family_blues;
  103. }
  104. }
  105. public short[] FamilyOtherBlues
  106. {
  107. get
  108. {
  109. return rec.family_other_blues;
  110. }
  111. }
  112. public int BlueScale
  113. {
  114. get
  115. {
  116. return (int)rec.blue_scale;
  117. }
  118. }
  119. public int BlueShift
  120. {
  121. get
  122. {
  123. return rec.blue_shift;
  124. }
  125. }
  126. public int BlueFuzz
  127. {
  128. get
  129. {
  130. return rec.blue_fuzz;
  131. }
  132. }
  133. [CLSCompliant(false)]
  134. public ushort StandardWidth
  135. {
  136. get
  137. {
  138. return rec.standard_width;
  139. }
  140. }
  141. [CLSCompliant(false)]
  142. public ushort StandardHeight
  143. {
  144. get
  145. {
  146. return rec.standard_height;
  147. }
  148. }
  149. public byte SnapWidthsCount
  150. {
  151. get
  152. {
  153. return rec.num_snap_widths;
  154. }
  155. }
  156. public byte SnapHeightsCount
  157. {
  158. get
  159. {
  160. return rec.num_snap_heights;
  161. }
  162. }
  163. public bool ForceBold
  164. {
  165. get
  166. {
  167. return rec.force_bold == 1;
  168. }
  169. }
  170. public bool RoundStemUp
  171. {
  172. get
  173. {
  174. return rec.round_stem_up == 1;
  175. }
  176. }
  177. public short[] SnapWidths
  178. {
  179. get
  180. {
  181. return rec.snap_widths;
  182. }
  183. }
  184. public short[] SnapHeights
  185. {
  186. get
  187. {
  188. return rec.snap_heights;
  189. }
  190. }
  191. public int ExpansionFactor
  192. {
  193. get
  194. {
  195. return (int)rec.expansion_factor;
  196. }
  197. }
  198. public int LanguageGroup
  199. {
  200. get
  201. {
  202. return (int)rec.language_group;
  203. }
  204. }
  205. public int Password
  206. {
  207. get
  208. {
  209. return (int)rec.password;
  210. }
  211. }
  212. public short[] MinFeature
  213. {
  214. get
  215. {
  216. return rec.min_feature;
  217. }
  218. }
  219. internal IntPtr Reference
  220. {
  221. get
  222. {
  223. return reference;
  224. }
  225. set
  226. {
  227. reference = value;
  228. rec = PInvokeHelper.PtrToStructure<PrivateRec>(reference);
  229. }
  230. }
  231. #endregion
  232. }
  233. }