/src/freetype/include/freetype/ftmm.h

https://bitbucket.org/cabalistic/ogredeps/ · C++ Header · 378 lines · 63 code · 46 blank · 269 comment · 0 complexity · ff1310bbb89557c441c18eda8fa39fdd MD5 · raw file

  1. /***************************************************************************/
  2. /* */
  3. /* ftmm.h */
  4. /* */
  5. /* FreeType Multiple Master font interface (specification). */
  6. /* */
  7. /* Copyright 1996-2001, 2003, 2004, 2006, 2009 by */
  8. /* David Turner, Robert Wilhelm, and Werner Lemberg. */
  9. /* */
  10. /* This file is part of the FreeType project, and may only be used, */
  11. /* modified, and distributed under the terms of the FreeType project */
  12. /* license, LICENSE.TXT. By continuing to use, modify, or distribute */
  13. /* this file you indicate that you have read the license and */
  14. /* understand and accept it fully. */
  15. /* */
  16. /***************************************************************************/
  17. #ifndef __FTMM_H__
  18. #define __FTMM_H__
  19. #include <ft2build.h>
  20. #include FT_TYPE1_TABLES_H
  21. FT_BEGIN_HEADER
  22. /*************************************************************************/
  23. /* */
  24. /* <Section> */
  25. /* multiple_masters */
  26. /* */
  27. /* <Title> */
  28. /* Multiple Masters */
  29. /* */
  30. /* <Abstract> */
  31. /* How to manage Multiple Masters fonts. */
  32. /* */
  33. /* <Description> */
  34. /* The following types and functions are used to manage Multiple */
  35. /* Master fonts, i.e., the selection of specific design instances by */
  36. /* setting design axis coordinates. */
  37. /* */
  38. /* George Williams has extended this interface to make it work with */
  39. /* both Type~1 Multiple Masters fonts and GX distortable (var) */
  40. /* fonts. Some of these routines only work with MM fonts, others */
  41. /* will work with both types. They are similar enough that a */
  42. /* consistent interface makes sense. */
  43. /* */
  44. /*************************************************************************/
  45. /*************************************************************************/
  46. /* */
  47. /* <Struct> */
  48. /* FT_MM_Axis */
  49. /* */
  50. /* <Description> */
  51. /* A simple structure used to model a given axis in design space for */
  52. /* Multiple Masters fonts. */
  53. /* */
  54. /* This structure can't be used for GX var fonts. */
  55. /* */
  56. /* <Fields> */
  57. /* name :: The axis's name. */
  58. /* */
  59. /* minimum :: The axis's minimum design coordinate. */
  60. /* */
  61. /* maximum :: The axis's maximum design coordinate. */
  62. /* */
  63. typedef struct FT_MM_Axis_
  64. {
  65. FT_String* name;
  66. FT_Long minimum;
  67. FT_Long maximum;
  68. } FT_MM_Axis;
  69. /*************************************************************************/
  70. /* */
  71. /* <Struct> */
  72. /* FT_Multi_Master */
  73. /* */
  74. /* <Description> */
  75. /* A structure used to model the axes and space of a Multiple Masters */
  76. /* font. */
  77. /* */
  78. /* This structure can't be used for GX var fonts. */
  79. /* */
  80. /* <Fields> */
  81. /* num_axis :: Number of axes. Cannot exceed~4. */
  82. /* */
  83. /* num_designs :: Number of designs; should be normally 2^num_axis */
  84. /* even though the Type~1 specification strangely */
  85. /* allows for intermediate designs to be present. This */
  86. /* number cannot exceed~16. */
  87. /* */
  88. /* axis :: A table of axis descriptors. */
  89. /* */
  90. typedef struct FT_Multi_Master_
  91. {
  92. FT_UInt num_axis;
  93. FT_UInt num_designs;
  94. FT_MM_Axis axis[T1_MAX_MM_AXIS];
  95. } FT_Multi_Master;
  96. /*************************************************************************/
  97. /* */
  98. /* <Struct> */
  99. /* FT_Var_Axis */
  100. /* */
  101. /* <Description> */
  102. /* A simple structure used to model a given axis in design space for */
  103. /* Multiple Masters and GX var fonts. */
  104. /* */
  105. /* <Fields> */
  106. /* name :: The axis's name. */
  107. /* Not always meaningful for GX. */
  108. /* */
  109. /* minimum :: The axis's minimum design coordinate. */
  110. /* */
  111. /* def :: The axis's default design coordinate. */
  112. /* FreeType computes meaningful default values for MM; it */
  113. /* is then an integer value, not in 16.16 format. */
  114. /* */
  115. /* maximum :: The axis's maximum design coordinate. */
  116. /* */
  117. /* tag :: The axis's tag (the GX equivalent to `name'). */
  118. /* FreeType provides default values for MM if possible. */
  119. /* */
  120. /* strid :: The entry in `name' table (another GX version of */
  121. /* `name'). */
  122. /* Not meaningful for MM. */
  123. /* */
  124. typedef struct FT_Var_Axis_
  125. {
  126. FT_String* name;
  127. FT_Fixed minimum;
  128. FT_Fixed def;
  129. FT_Fixed maximum;
  130. FT_ULong tag;
  131. FT_UInt strid;
  132. } FT_Var_Axis;
  133. /*************************************************************************/
  134. /* */
  135. /* <Struct> */
  136. /* FT_Var_Named_Style */
  137. /* */
  138. /* <Description> */
  139. /* A simple structure used to model a named style in a GX var font. */
  140. /* */
  141. /* This structure can't be used for MM fonts. */
  142. /* */
  143. /* <Fields> */
  144. /* coords :: The design coordinates for this style. */
  145. /* This is an array with one entry for each axis. */
  146. /* */
  147. /* strid :: The entry in `name' table identifying this style. */
  148. /* */
  149. typedef struct FT_Var_Named_Style_
  150. {
  151. FT_Fixed* coords;
  152. FT_UInt strid;
  153. } FT_Var_Named_Style;
  154. /*************************************************************************/
  155. /* */
  156. /* <Struct> */
  157. /* FT_MM_Var */
  158. /* */
  159. /* <Description> */
  160. /* A structure used to model the axes and space of a Multiple Masters */
  161. /* or GX var distortable font. */
  162. /* */
  163. /* Some fields are specific to one format and not to the other. */
  164. /* */
  165. /* <Fields> */
  166. /* num_axis :: The number of axes. The maximum value is~4 for */
  167. /* MM; no limit in GX. */
  168. /* */
  169. /* num_designs :: The number of designs; should be normally */
  170. /* 2^num_axis for MM fonts. Not meaningful for GX */
  171. /* (where every glyph could have a different */
  172. /* number of designs). */
  173. /* */
  174. /* num_namedstyles :: The number of named styles; only meaningful for */
  175. /* GX which allows certain design coordinates to */
  176. /* have a string ID (in the `name' table) */
  177. /* associated with them. The font can tell the */
  178. /* user that, for example, Weight=1.5 is `Bold'. */
  179. /* */
  180. /* axis :: A table of axis descriptors. */
  181. /* GX fonts contain slightly more data than MM. */
  182. /* */
  183. /* namedstyles :: A table of named styles. */
  184. /* Only meaningful with GX. */
  185. /* */
  186. typedef struct FT_MM_Var_
  187. {
  188. FT_UInt num_axis;
  189. FT_UInt num_designs;
  190. FT_UInt num_namedstyles;
  191. FT_Var_Axis* axis;
  192. FT_Var_Named_Style* namedstyle;
  193. } FT_MM_Var;
  194. /* */
  195. /*************************************************************************/
  196. /* */
  197. /* <Function> */
  198. /* FT_Get_Multi_Master */
  199. /* */
  200. /* <Description> */
  201. /* Retrieve the Multiple Master descriptor of a given font. */
  202. /* */
  203. /* This function can't be used with GX fonts. */
  204. /* */
  205. /* <Input> */
  206. /* face :: A handle to the source face. */
  207. /* */
  208. /* <Output> */
  209. /* amaster :: The Multiple Masters descriptor. */
  210. /* */
  211. /* <Return> */
  212. /* FreeType error code. 0~means success. */
  213. /* */
  214. FT_EXPORT( FT_Error )
  215. FT_Get_Multi_Master( FT_Face face,
  216. FT_Multi_Master *amaster );
  217. /*************************************************************************/
  218. /* */
  219. /* <Function> */
  220. /* FT_Get_MM_Var */
  221. /* */
  222. /* <Description> */
  223. /* Retrieve the Multiple Master/GX var descriptor of a given font. */
  224. /* */
  225. /* <Input> */
  226. /* face :: A handle to the source face. */
  227. /* */
  228. /* <Output> */
  229. /* amaster :: The Multiple Masters/GX var descriptor. */
  230. /* Allocates a data structure, which the user must free */
  231. /* (a single call to FT_FREE will do it). */
  232. /* */
  233. /* <Return> */
  234. /* FreeType error code. 0~means success. */
  235. /* */
  236. FT_EXPORT( FT_Error )
  237. FT_Get_MM_Var( FT_Face face,
  238. FT_MM_Var* *amaster );
  239. /*************************************************************************/
  240. /* */
  241. /* <Function> */
  242. /* FT_Set_MM_Design_Coordinates */
  243. /* */
  244. /* <Description> */
  245. /* For Multiple Masters fonts, choose an interpolated font design */
  246. /* through design coordinates. */
  247. /* */
  248. /* This function can't be used with GX fonts. */
  249. /* */
  250. /* <InOut> */
  251. /* face :: A handle to the source face. */
  252. /* */
  253. /* <Input> */
  254. /* num_coords :: The number of design coordinates (must be equal to */
  255. /* the number of axes in the font). */
  256. /* */
  257. /* coords :: An array of design coordinates. */
  258. /* */
  259. /* <Return> */
  260. /* FreeType error code. 0~means success. */
  261. /* */
  262. FT_EXPORT( FT_Error )
  263. FT_Set_MM_Design_Coordinates( FT_Face face,
  264. FT_UInt num_coords,
  265. FT_Long* coords );
  266. /*************************************************************************/
  267. /* */
  268. /* <Function> */
  269. /* FT_Set_Var_Design_Coordinates */
  270. /* */
  271. /* <Description> */
  272. /* For Multiple Master or GX Var fonts, choose an interpolated font */
  273. /* design through design coordinates. */
  274. /* */
  275. /* <InOut> */
  276. /* face :: A handle to the source face. */
  277. /* */
  278. /* <Input> */
  279. /* num_coords :: The number of design coordinates (must be equal to */
  280. /* the number of axes in the font). */
  281. /* */
  282. /* coords :: An array of design coordinates. */
  283. /* */
  284. /* <Return> */
  285. /* FreeType error code. 0~means success. */
  286. /* */
  287. FT_EXPORT( FT_Error )
  288. FT_Set_Var_Design_Coordinates( FT_Face face,
  289. FT_UInt num_coords,
  290. FT_Fixed* coords );
  291. /*************************************************************************/
  292. /* */
  293. /* <Function> */
  294. /* FT_Set_MM_Blend_Coordinates */
  295. /* */
  296. /* <Description> */
  297. /* For Multiple Masters and GX var fonts, choose an interpolated font */
  298. /* design through normalized blend coordinates. */
  299. /* */
  300. /* <InOut> */
  301. /* face :: A handle to the source face. */
  302. /* */
  303. /* <Input> */
  304. /* num_coords :: The number of design coordinates (must be equal to */
  305. /* the number of axes in the font). */
  306. /* */
  307. /* coords :: The design coordinates array (each element must be */
  308. /* between 0 and 1.0). */
  309. /* */
  310. /* <Return> */
  311. /* FreeType error code. 0~means success. */
  312. /* */
  313. FT_EXPORT( FT_Error )
  314. FT_Set_MM_Blend_Coordinates( FT_Face face,
  315. FT_UInt num_coords,
  316. FT_Fixed* coords );
  317. /*************************************************************************/
  318. /* */
  319. /* <Function> */
  320. /* FT_Set_Var_Blend_Coordinates */
  321. /* */
  322. /* <Description> */
  323. /* This is another name of @FT_Set_MM_Blend_Coordinates. */
  324. /* */
  325. FT_EXPORT( FT_Error )
  326. FT_Set_Var_Blend_Coordinates( FT_Face face,
  327. FT_UInt num_coords,
  328. FT_Fixed* coords );
  329. /* */
  330. FT_END_HEADER
  331. #endif /* __FTMM_H__ */
  332. /* END */