WmfFont.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. namespace WMFConverter.Wmf
  7. {
  8. /// <summary>
  9. /// Windows Metafile - Represents WMF Font object.
  10. /// </summary>
  11. public class WmfFont : WmfObject, Gdi.IGdiFont
  12. {
  13. #region Local Variables
  14. private int _height;
  15. private int _width;
  16. private int _escapement;
  17. private int _orientation;
  18. private int _weight;
  19. private bool _italic;
  20. private bool _underline;
  21. private bool _strikeout;
  22. private int _charset;
  23. private int _outPrecision;
  24. private int _clipPrecision;
  25. private int _quality;
  26. private int _pitchAndFamily;
  27. private string _faceName;
  28. #endregion
  29. #region Properties
  30. /// <summary>
  31. /// Object Height.
  32. /// </summary>
  33. public int Height
  34. {
  35. get
  36. {
  37. return _height;
  38. }
  39. }
  40. /// <summary>
  41. /// Object Width.
  42. /// </summary>
  43. public int Width
  44. {
  45. get
  46. {
  47. return _width;
  48. }
  49. }
  50. /// <summary>
  51. /// Object Escapement.
  52. /// </summary>
  53. public int Escapement
  54. {
  55. get
  56. {
  57. return _escapement;
  58. }
  59. }
  60. /// <summary>
  61. /// Object Orientation.
  62. /// </summary>
  63. public int Orientation
  64. {
  65. get
  66. {
  67. return _orientation;
  68. }
  69. }
  70. /// <summary>
  71. /// Object Weight.
  72. /// </summary>
  73. public int Weight
  74. {
  75. get
  76. {
  77. return _weight;
  78. }
  79. }
  80. /// <summary>
  81. /// Defines whether the font is italic.
  82. /// </summary>
  83. public bool IsItalic
  84. {
  85. get
  86. {
  87. return _italic;
  88. }
  89. }
  90. /// <summary>
  91. /// Defines whether the font is underlined.
  92. /// </summary>
  93. public bool IsUnderlined
  94. {
  95. get
  96. {
  97. return _underline;
  98. }
  99. }
  100. /// <summary>
  101. /// Defines whether the font is striked.
  102. /// </summary>
  103. public bool IsStrikedOut
  104. {
  105. get
  106. {
  107. return _strikeout;
  108. }
  109. }
  110. /// <summary>
  111. /// Defines the font charset.
  112. /// </summary>
  113. public int Charset
  114. {
  115. get
  116. {
  117. return _charset;
  118. }
  119. }
  120. /// <summary>
  121. /// Defines the font out precision.
  122. /// </summary>
  123. public int OutPrecision
  124. {
  125. get
  126. {
  127. return _outPrecision;
  128. }
  129. }
  130. /// <summary>
  131. /// Defines the clip precision.
  132. /// </summary>
  133. public int ClipPrecision
  134. {
  135. get
  136. {
  137. return _clipPrecision;
  138. }
  139. }
  140. /// <summary>
  141. /// Object quality.
  142. /// </summary>
  143. public int Quality
  144. {
  145. get
  146. {
  147. return _quality;
  148. }
  149. }
  150. /// <summary>
  151. /// Defines pitch and famility font.
  152. /// </summary>
  153. public int PitchAndFamily
  154. {
  155. get
  156. {
  157. return _pitchAndFamily;
  158. }
  159. }
  160. /// <summary>
  161. /// Defines face name rules.
  162. /// </summary>
  163. public string FaceName
  164. {
  165. get
  166. {
  167. return _faceName;
  168. }
  169. }
  170. #endregion
  171. #region Constructors
  172. /// <summary>
  173. /// Default Constructor.
  174. /// </summary>
  175. /// <param name="id"></param>
  176. /// <param name="height"></param>
  177. /// <param name="width"></param>
  178. /// <param name="escapement"></param>
  179. /// <param name="orientation"></param>
  180. /// <param name="weight"></param>
  181. /// <param name="italic"></param>
  182. /// <param name="underline"></param>
  183. /// <param name="strikeout"></param>
  184. /// <param name="charset"></param>
  185. /// <param name="outPrecision"></param>
  186. /// <param name="clipPrecision"></param>
  187. /// <param name="quality"></param>
  188. /// <param name="pitchAndFamily"></param>
  189. /// <param name="faceName"></param>
  190. public WmfFont(int id,
  191. int height,
  192. int width,
  193. int escapement,
  194. int orientation,
  195. int weight,
  196. bool italic,
  197. bool underline,
  198. bool strikeout,
  199. int charset,
  200. int outPrecision,
  201. int clipPrecision,
  202. int quality,
  203. int pitchAndFamily,
  204. byte[] faceName)
  205. : base (id)
  206. {
  207. _height = height;
  208. _width = width;
  209. _escapement = escapement;
  210. _orientation = orientation;
  211. _weight = weight;
  212. _italic = italic;
  213. _underline = underline;
  214. _strikeout = strikeout;
  215. _charset = charset;
  216. _outPrecision = outPrecision;
  217. _clipPrecision = clipPrecision;
  218. _quality = quality;
  219. _pitchAndFamily = pitchAndFamily;
  220. _faceName = WMFConverter.Gdi.GdiUtils.ConvertString(faceName, charset);
  221. }
  222. #endregion
  223. }
  224. }