ftmm.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. /***************************************************************************/
  2. /* */
  3. /* ftmm.h */
  4. /* */
  5. /* FreeType Multiple Master font interface (specification). */
  6. /* */
  7. /* Copyright 1996-2001, 2003, 2004, 2006, 2009, 2013 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 that 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. /* */
  232. /* <Return> */
  233. /* FreeType error code. 0~means success. */
  234. /* */
  235. FT_EXPORT( FT_Error )
  236. FT_Get_MM_Var( FT_Face face,
  237. FT_MM_Var* *amaster );
  238. /*************************************************************************/
  239. /* */
  240. /* <Function> */
  241. /* FT_Set_MM_Design_Coordinates */
  242. /* */
  243. /* <Description> */
  244. /* For Multiple Masters fonts, choose an interpolated font design */
  245. /* through design coordinates. */
  246. /* */
  247. /* This function can't be used with GX fonts. */
  248. /* */
  249. /* <InOut> */
  250. /* face :: A handle to the source face. */
  251. /* */
  252. /* <Input> */
  253. /* num_coords :: The number of design coordinates (must be equal to */
  254. /* the number of axes in the font). */
  255. /* */
  256. /* coords :: An array of design coordinates. */
  257. /* */
  258. /* <Return> */
  259. /* FreeType error code. 0~means success. */
  260. /* */
  261. FT_EXPORT( FT_Error )
  262. FT_Set_MM_Design_Coordinates( FT_Face face,
  263. FT_UInt num_coords,
  264. FT_Long* coords );
  265. /*************************************************************************/
  266. /* */
  267. /* <Function> */
  268. /* FT_Set_Var_Design_Coordinates */
  269. /* */
  270. /* <Description> */
  271. /* For Multiple Master or GX Var fonts, choose an interpolated font */
  272. /* design through design coordinates. */
  273. /* */
  274. /* <InOut> */
  275. /* face :: A handle to the source face. */
  276. /* */
  277. /* <Input> */
  278. /* num_coords :: The number of design coordinates (must be equal to */
  279. /* the number of axes in the font). */
  280. /* */
  281. /* coords :: An array of design coordinates. */
  282. /* */
  283. /* <Return> */
  284. /* FreeType error code. 0~means success. */
  285. /* */
  286. FT_EXPORT( FT_Error )
  287. FT_Set_Var_Design_Coordinates( FT_Face face,
  288. FT_UInt num_coords,
  289. FT_Fixed* coords );
  290. /*************************************************************************/
  291. /* */
  292. /* <Function> */
  293. /* FT_Set_MM_Blend_Coordinates */
  294. /* */
  295. /* <Description> */
  296. /* For Multiple Masters and GX var fonts, choose an interpolated font */
  297. /* design through normalized blend coordinates. */
  298. /* */
  299. /* <InOut> */
  300. /* face :: A handle to the source face. */
  301. /* */
  302. /* <Input> */
  303. /* num_coords :: The number of design coordinates (must be equal to */
  304. /* the number of axes in the font). */
  305. /* */
  306. /* coords :: The design coordinates array (each element must be */
  307. /* between 0 and 1.0). */
  308. /* */
  309. /* <Return> */
  310. /* FreeType error code. 0~means success. */
  311. /* */
  312. FT_EXPORT( FT_Error )
  313. FT_Set_MM_Blend_Coordinates( FT_Face face,
  314. FT_UInt num_coords,
  315. FT_Fixed* coords );
  316. /*************************************************************************/
  317. /* */
  318. /* <Function> */
  319. /* FT_Set_Var_Blend_Coordinates */
  320. /* */
  321. /* <Description> */
  322. /* This is another name of @FT_Set_MM_Blend_Coordinates. */
  323. /* */
  324. FT_EXPORT( FT_Error )
  325. FT_Set_Var_Blend_Coordinates( FT_Face face,
  326. FT_UInt num_coords,
  327. FT_Fixed* coords );
  328. /* */
  329. FT_END_HEADER
  330. #endif /* __FTMM_H__ */
  331. /* END */