hb-font.h 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722
  1. /*
  2. * Copyright © 2009 Red Hat, Inc.
  3. *
  4. * This is part of HarfBuzz, a text shaping library.
  5. *
  6. * Permission is hereby granted, without written agreement and without
  7. * license or royalty fees, to use, copy, modify, and distribute this
  8. * software and its documentation for any purpose, provided that the
  9. * above copyright notice and the following two paragraphs appear in
  10. * all copies of this software.
  11. *
  12. * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
  13. * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
  14. * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
  15. * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
  16. * DAMAGE.
  17. *
  18. * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
  19. * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
  20. * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
  21. * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
  22. * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
  23. *
  24. * Red Hat Author(s): Behdad Esfahbod
  25. */
  26. #ifndef HB_H_IN
  27. #error "Include <hb.h> instead."
  28. #endif
  29. #ifndef HB_FONT_H
  30. #define HB_FONT_H
  31. #include "hb-common.h"
  32. #include "hb-face.h"
  33. HB_BEGIN_DECLS
  34. typedef struct hb_font_t hb_font_t;
  35. /*
  36. * hb_font_funcs_t
  37. */
  38. typedef struct hb_font_funcs_t hb_font_funcs_t;
  39. HB_EXTERN hb_font_funcs_t *
  40. hb_font_funcs_create (void);
  41. HB_EXTERN hb_font_funcs_t *
  42. hb_font_funcs_get_empty (void);
  43. HB_EXTERN hb_font_funcs_t *
  44. hb_font_funcs_reference (hb_font_funcs_t *ffuncs);
  45. HB_EXTERN void
  46. hb_font_funcs_destroy (hb_font_funcs_t *ffuncs);
  47. HB_EXTERN hb_bool_t
  48. hb_font_funcs_set_user_data (hb_font_funcs_t *ffuncs,
  49. hb_user_data_key_t *key,
  50. void * data,
  51. hb_destroy_func_t destroy,
  52. hb_bool_t replace);
  53. HB_EXTERN void *
  54. hb_font_funcs_get_user_data (hb_font_funcs_t *ffuncs,
  55. hb_user_data_key_t *key);
  56. HB_EXTERN void
  57. hb_font_funcs_make_immutable (hb_font_funcs_t *ffuncs);
  58. HB_EXTERN hb_bool_t
  59. hb_font_funcs_is_immutable (hb_font_funcs_t *ffuncs);
  60. /* font and glyph extents */
  61. /* Note that typically ascender is positive and descender negative in coordinate systems that grow up. */
  62. typedef struct hb_font_extents_t
  63. {
  64. hb_position_t ascender; /* typographic ascender. */
  65. hb_position_t descender; /* typographic descender. */
  66. hb_position_t line_gap; /* suggested line spacing gap. */
  67. /*< private >*/
  68. hb_position_t reserved9;
  69. hb_position_t reserved8;
  70. hb_position_t reserved7;
  71. hb_position_t reserved6;
  72. hb_position_t reserved5;
  73. hb_position_t reserved4;
  74. hb_position_t reserved3;
  75. hb_position_t reserved2;
  76. hb_position_t reserved1;
  77. } hb_font_extents_t;
  78. /* Note that height is negative in coordinate systems that grow up. */
  79. typedef struct hb_glyph_extents_t
  80. {
  81. hb_position_t x_bearing; /* left side of glyph from origin. */
  82. hb_position_t y_bearing; /* top side of glyph from origin. */
  83. hb_position_t width; /* distance from left to right side. */
  84. hb_position_t height; /* distance from top to bottom side. */
  85. } hb_glyph_extents_t;
  86. /* func types */
  87. typedef hb_bool_t (*hb_font_get_font_extents_func_t) (hb_font_t *font, void *font_data,
  88. hb_font_extents_t *extents,
  89. void *user_data);
  90. typedef hb_font_get_font_extents_func_t hb_font_get_font_h_extents_func_t;
  91. typedef hb_font_get_font_extents_func_t hb_font_get_font_v_extents_func_t;
  92. typedef hb_bool_t (*hb_font_get_nominal_glyph_func_t) (hb_font_t *font, void *font_data,
  93. hb_codepoint_t unicode,
  94. hb_codepoint_t *glyph,
  95. void *user_data);
  96. typedef hb_bool_t (*hb_font_get_variation_glyph_func_t) (hb_font_t *font, void *font_data,
  97. hb_codepoint_t unicode, hb_codepoint_t variation_selector,
  98. hb_codepoint_t *glyph,
  99. void *user_data);
  100. typedef unsigned int (*hb_font_get_nominal_glyphs_func_t) (hb_font_t *font, void *font_data,
  101. unsigned int count,
  102. const hb_codepoint_t *first_unicode,
  103. unsigned int unicode_stride,
  104. hb_codepoint_t *first_glyph,
  105. unsigned int glyph_stride,
  106. void *user_data);
  107. typedef hb_position_t (*hb_font_get_glyph_advance_func_t) (hb_font_t *font, void *font_data,
  108. hb_codepoint_t glyph,
  109. void *user_data);
  110. typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_h_advance_func_t;
  111. typedef hb_font_get_glyph_advance_func_t hb_font_get_glyph_v_advance_func_t;
  112. typedef void (*hb_font_get_glyph_advances_func_t) (hb_font_t* font, void* font_data,
  113. unsigned int count,
  114. const hb_codepoint_t *first_glyph,
  115. unsigned glyph_stride,
  116. hb_position_t *first_advance,
  117. unsigned advance_stride,
  118. void *user_data);
  119. typedef hb_font_get_glyph_advances_func_t hb_font_get_glyph_h_advances_func_t;
  120. typedef hb_font_get_glyph_advances_func_t hb_font_get_glyph_v_advances_func_t;
  121. typedef hb_bool_t (*hb_font_get_glyph_origin_func_t) (hb_font_t *font, void *font_data,
  122. hb_codepoint_t glyph,
  123. hb_position_t *x, hb_position_t *y,
  124. void *user_data);
  125. typedef hb_font_get_glyph_origin_func_t hb_font_get_glyph_h_origin_func_t;
  126. typedef hb_font_get_glyph_origin_func_t hb_font_get_glyph_v_origin_func_t;
  127. typedef hb_position_t (*hb_font_get_glyph_kerning_func_t) (hb_font_t *font, void *font_data,
  128. hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
  129. void *user_data);
  130. typedef hb_font_get_glyph_kerning_func_t hb_font_get_glyph_h_kerning_func_t;
  131. typedef hb_bool_t (*hb_font_get_glyph_extents_func_t) (hb_font_t *font, void *font_data,
  132. hb_codepoint_t glyph,
  133. hb_glyph_extents_t *extents,
  134. void *user_data);
  135. typedef hb_bool_t (*hb_font_get_glyph_contour_point_func_t) (hb_font_t *font, void *font_data,
  136. hb_codepoint_t glyph, unsigned int point_index,
  137. hb_position_t *x, hb_position_t *y,
  138. void *user_data);
  139. typedef hb_bool_t (*hb_font_get_glyph_name_func_t) (hb_font_t *font, void *font_data,
  140. hb_codepoint_t glyph,
  141. char *name, unsigned int size,
  142. void *user_data);
  143. typedef hb_bool_t (*hb_font_get_glyph_from_name_func_t) (hb_font_t *font, void *font_data,
  144. const char *name, int len, /* -1 means nul-terminated */
  145. hb_codepoint_t *glyph,
  146. void *user_data);
  147. /* func setters */
  148. /**
  149. * hb_font_funcs_set_font_h_extents_func:
  150. * @ffuncs: font functions.
  151. * @func: (closure user_data) (destroy destroy) (scope notified):
  152. * @user_data:
  153. * @destroy:
  154. *
  155. *
  156. *
  157. * Since: 1.1.2
  158. **/
  159. HB_EXTERN void
  160. hb_font_funcs_set_font_h_extents_func (hb_font_funcs_t *ffuncs,
  161. hb_font_get_font_h_extents_func_t func,
  162. void *user_data, hb_destroy_func_t destroy);
  163. /**
  164. * hb_font_funcs_set_font_v_extents_func:
  165. * @ffuncs: font functions.
  166. * @func: (closure user_data) (destroy destroy) (scope notified):
  167. * @user_data:
  168. * @destroy:
  169. *
  170. *
  171. *
  172. * Since: 1.1.2
  173. **/
  174. HB_EXTERN void
  175. hb_font_funcs_set_font_v_extents_func (hb_font_funcs_t *ffuncs,
  176. hb_font_get_font_v_extents_func_t func,
  177. void *user_data, hb_destroy_func_t destroy);
  178. /**
  179. * hb_font_funcs_set_nominal_glyph_func:
  180. * @ffuncs: font functions.
  181. * @func: (closure user_data) (destroy destroy) (scope notified):
  182. * @user_data:
  183. * @destroy:
  184. *
  185. *
  186. *
  187. * Since: 1.2.3
  188. **/
  189. HB_EXTERN void
  190. hb_font_funcs_set_nominal_glyph_func (hb_font_funcs_t *ffuncs,
  191. hb_font_get_nominal_glyph_func_t func,
  192. void *user_data, hb_destroy_func_t destroy);
  193. /**
  194. * hb_font_funcs_set_nominal_glyphs_func:
  195. * @ffuncs: font functions.
  196. * @func: (closure user_data) (destroy destroy) (scope notified):
  197. * @user_data:
  198. * @destroy:
  199. *
  200. *
  201. *
  202. * Since: 2.0.0
  203. **/
  204. HB_EXTERN void
  205. hb_font_funcs_set_nominal_glyphs_func (hb_font_funcs_t *ffuncs,
  206. hb_font_get_nominal_glyphs_func_t func,
  207. void *user_data, hb_destroy_func_t destroy);
  208. /**
  209. * hb_font_funcs_set_variation_glyph_func:
  210. * @ffuncs: font functions.
  211. * @func: (closure user_data) (destroy destroy) (scope notified):
  212. * @user_data:
  213. * @destroy:
  214. *
  215. *
  216. *
  217. * Since: 1.2.3
  218. **/
  219. HB_EXTERN void
  220. hb_font_funcs_set_variation_glyph_func (hb_font_funcs_t *ffuncs,
  221. hb_font_get_variation_glyph_func_t func,
  222. void *user_data, hb_destroy_func_t destroy);
  223. /**
  224. * hb_font_funcs_set_glyph_h_advance_func:
  225. * @ffuncs: font functions.
  226. * @func: (closure user_data) (destroy destroy) (scope notified):
  227. * @user_data:
  228. * @destroy:
  229. *
  230. *
  231. *
  232. * Since: 0.9.2
  233. **/
  234. HB_EXTERN void
  235. hb_font_funcs_set_glyph_h_advance_func (hb_font_funcs_t *ffuncs,
  236. hb_font_get_glyph_h_advance_func_t func,
  237. void *user_data, hb_destroy_func_t destroy);
  238. /**
  239. * hb_font_funcs_set_glyph_v_advance_func:
  240. * @ffuncs: font functions.
  241. * @func: (closure user_data) (destroy destroy) (scope notified):
  242. * @user_data:
  243. * @destroy:
  244. *
  245. *
  246. *
  247. * Since: 0.9.2
  248. **/
  249. HB_EXTERN void
  250. hb_font_funcs_set_glyph_v_advance_func (hb_font_funcs_t *ffuncs,
  251. hb_font_get_glyph_v_advance_func_t func,
  252. void *user_data, hb_destroy_func_t destroy);
  253. /**
  254. * hb_font_funcs_set_glyph_h_advances_func:
  255. * @ffuncs: font functions.
  256. * @func: (closure user_data) (destroy destroy) (scope notified):
  257. * @user_data:
  258. * @destroy:
  259. *
  260. *
  261. *
  262. * Since: 1.8.6
  263. **/
  264. HB_EXTERN void
  265. hb_font_funcs_set_glyph_h_advances_func (hb_font_funcs_t *ffuncs,
  266. hb_font_get_glyph_h_advances_func_t func,
  267. void *user_data, hb_destroy_func_t destroy);
  268. /**
  269. * hb_font_funcs_set_glyph_v_advances_func:
  270. * @ffuncs: font functions.
  271. * @func: (closure user_data) (destroy destroy) (scope notified):
  272. * @user_data:
  273. * @destroy:
  274. *
  275. *
  276. *
  277. * Since: 1.8.6
  278. **/
  279. HB_EXTERN void
  280. hb_font_funcs_set_glyph_v_advances_func (hb_font_funcs_t *ffuncs,
  281. hb_font_get_glyph_v_advances_func_t func,
  282. void *user_data, hb_destroy_func_t destroy);
  283. /**
  284. * hb_font_funcs_set_glyph_h_origin_func:
  285. * @ffuncs: font functions.
  286. * @func: (closure user_data) (destroy destroy) (scope notified):
  287. * @user_data:
  288. * @destroy:
  289. *
  290. *
  291. *
  292. * Since: 0.9.2
  293. **/
  294. HB_EXTERN void
  295. hb_font_funcs_set_glyph_h_origin_func (hb_font_funcs_t *ffuncs,
  296. hb_font_get_glyph_h_origin_func_t func,
  297. void *user_data, hb_destroy_func_t destroy);
  298. /**
  299. * hb_font_funcs_set_glyph_v_origin_func:
  300. * @ffuncs: font functions.
  301. * @func: (closure user_data) (destroy destroy) (scope notified):
  302. * @user_data:
  303. * @destroy:
  304. *
  305. *
  306. *
  307. * Since: 0.9.2
  308. **/
  309. HB_EXTERN void
  310. hb_font_funcs_set_glyph_v_origin_func (hb_font_funcs_t *ffuncs,
  311. hb_font_get_glyph_v_origin_func_t func,
  312. void *user_data, hb_destroy_func_t destroy);
  313. /**
  314. * hb_font_funcs_set_glyph_h_kerning_func:
  315. * @ffuncs: font functions.
  316. * @func: (closure user_data) (destroy destroy) (scope notified):
  317. * @user_data:
  318. * @destroy:
  319. *
  320. *
  321. *
  322. * Since: 0.9.2
  323. **/
  324. HB_EXTERN void
  325. hb_font_funcs_set_glyph_h_kerning_func (hb_font_funcs_t *ffuncs,
  326. hb_font_get_glyph_h_kerning_func_t func,
  327. void *user_data, hb_destroy_func_t destroy);
  328. /**
  329. * hb_font_funcs_set_glyph_extents_func:
  330. * @ffuncs: font functions.
  331. * @func: (closure user_data) (destroy destroy) (scope notified):
  332. * @user_data:
  333. * @destroy:
  334. *
  335. *
  336. *
  337. * Since: 0.9.2
  338. **/
  339. HB_EXTERN void
  340. hb_font_funcs_set_glyph_extents_func (hb_font_funcs_t *ffuncs,
  341. hb_font_get_glyph_extents_func_t func,
  342. void *user_data, hb_destroy_func_t destroy);
  343. /**
  344. * hb_font_funcs_set_glyph_contour_point_func:
  345. * @ffuncs: font functions.
  346. * @func: (closure user_data) (destroy destroy) (scope notified):
  347. * @user_data:
  348. * @destroy:
  349. *
  350. *
  351. *
  352. * Since: 0.9.2
  353. **/
  354. HB_EXTERN void
  355. hb_font_funcs_set_glyph_contour_point_func (hb_font_funcs_t *ffuncs,
  356. hb_font_get_glyph_contour_point_func_t func,
  357. void *user_data, hb_destroy_func_t destroy);
  358. /**
  359. * hb_font_funcs_set_glyph_name_func:
  360. * @ffuncs: font functions.
  361. * @func: (closure user_data) (destroy destroy) (scope notified):
  362. * @user_data:
  363. * @destroy:
  364. *
  365. *
  366. *
  367. * Since: 0.9.2
  368. **/
  369. HB_EXTERN void
  370. hb_font_funcs_set_glyph_name_func (hb_font_funcs_t *ffuncs,
  371. hb_font_get_glyph_name_func_t func,
  372. void *user_data, hb_destroy_func_t destroy);
  373. /**
  374. * hb_font_funcs_set_glyph_from_name_func:
  375. * @ffuncs: font functions.
  376. * @func: (closure user_data) (destroy destroy) (scope notified):
  377. * @user_data:
  378. * @destroy:
  379. *
  380. *
  381. *
  382. * Since: 0.9.2
  383. **/
  384. HB_EXTERN void
  385. hb_font_funcs_set_glyph_from_name_func (hb_font_funcs_t *ffuncs,
  386. hb_font_get_glyph_from_name_func_t func,
  387. void *user_data, hb_destroy_func_t destroy);
  388. /* func dispatch */
  389. HB_EXTERN hb_bool_t
  390. hb_font_get_h_extents (hb_font_t *font,
  391. hb_font_extents_t *extents);
  392. HB_EXTERN hb_bool_t
  393. hb_font_get_v_extents (hb_font_t *font,
  394. hb_font_extents_t *extents);
  395. HB_EXTERN hb_bool_t
  396. hb_font_get_nominal_glyph (hb_font_t *font,
  397. hb_codepoint_t unicode,
  398. hb_codepoint_t *glyph);
  399. HB_EXTERN hb_bool_t
  400. hb_font_get_variation_glyph (hb_font_t *font,
  401. hb_codepoint_t unicode, hb_codepoint_t variation_selector,
  402. hb_codepoint_t *glyph);
  403. HB_EXTERN unsigned int
  404. hb_font_get_nominal_glyphs (hb_font_t *font,
  405. unsigned int count,
  406. const hb_codepoint_t *first_unicode,
  407. unsigned int unicode_stride,
  408. hb_codepoint_t *first_glyph,
  409. unsigned int glyph_stride);
  410. HB_EXTERN hb_position_t
  411. hb_font_get_glyph_h_advance (hb_font_t *font,
  412. hb_codepoint_t glyph);
  413. HB_EXTERN hb_position_t
  414. hb_font_get_glyph_v_advance (hb_font_t *font,
  415. hb_codepoint_t glyph);
  416. HB_EXTERN void
  417. hb_font_get_glyph_h_advances (hb_font_t* font,
  418. unsigned int count,
  419. const hb_codepoint_t *first_glyph,
  420. unsigned glyph_stride,
  421. hb_position_t *first_advance,
  422. unsigned advance_stride);
  423. HB_EXTERN void
  424. hb_font_get_glyph_v_advances (hb_font_t* font,
  425. unsigned int count,
  426. const hb_codepoint_t *first_glyph,
  427. unsigned glyph_stride,
  428. hb_position_t *first_advance,
  429. unsigned advance_stride);
  430. HB_EXTERN hb_bool_t
  431. hb_font_get_glyph_h_origin (hb_font_t *font,
  432. hb_codepoint_t glyph,
  433. hb_position_t *x, hb_position_t *y);
  434. HB_EXTERN hb_bool_t
  435. hb_font_get_glyph_v_origin (hb_font_t *font,
  436. hb_codepoint_t glyph,
  437. hb_position_t *x, hb_position_t *y);
  438. HB_EXTERN hb_position_t
  439. hb_font_get_glyph_h_kerning (hb_font_t *font,
  440. hb_codepoint_t left_glyph, hb_codepoint_t right_glyph);
  441. HB_EXTERN hb_bool_t
  442. hb_font_get_glyph_extents (hb_font_t *font,
  443. hb_codepoint_t glyph,
  444. hb_glyph_extents_t *extents);
  445. HB_EXTERN hb_bool_t
  446. hb_font_get_glyph_contour_point (hb_font_t *font,
  447. hb_codepoint_t glyph, unsigned int point_index,
  448. hb_position_t *x, hb_position_t *y);
  449. HB_EXTERN hb_bool_t
  450. hb_font_get_glyph_name (hb_font_t *font,
  451. hb_codepoint_t glyph,
  452. char *name, unsigned int size);
  453. HB_EXTERN hb_bool_t
  454. hb_font_get_glyph_from_name (hb_font_t *font,
  455. const char *name, int len, /* -1 means nul-terminated */
  456. hb_codepoint_t *glyph);
  457. /* high-level funcs, with fallback */
  458. /* Calls either hb_font_get_nominal_glyph() if variation_selector is 0,
  459. * otherwise calls hb_font_get_variation_glyph(). */
  460. HB_EXTERN hb_bool_t
  461. hb_font_get_glyph (hb_font_t *font,
  462. hb_codepoint_t unicode, hb_codepoint_t variation_selector,
  463. hb_codepoint_t *glyph);
  464. HB_EXTERN void
  465. hb_font_get_extents_for_direction (hb_font_t *font,
  466. hb_direction_t direction,
  467. hb_font_extents_t *extents);
  468. HB_EXTERN void
  469. hb_font_get_glyph_advance_for_direction (hb_font_t *font,
  470. hb_codepoint_t glyph,
  471. hb_direction_t direction,
  472. hb_position_t *x, hb_position_t *y);
  473. HB_EXTERN void
  474. hb_font_get_glyph_advances_for_direction (hb_font_t* font,
  475. hb_direction_t direction,
  476. unsigned int count,
  477. const hb_codepoint_t *first_glyph,
  478. unsigned glyph_stride,
  479. hb_position_t *first_advance,
  480. unsigned advance_stride);
  481. HB_EXTERN void
  482. hb_font_get_glyph_origin_for_direction (hb_font_t *font,
  483. hb_codepoint_t glyph,
  484. hb_direction_t direction,
  485. hb_position_t *x, hb_position_t *y);
  486. HB_EXTERN void
  487. hb_font_add_glyph_origin_for_direction (hb_font_t *font,
  488. hb_codepoint_t glyph,
  489. hb_direction_t direction,
  490. hb_position_t *x, hb_position_t *y);
  491. HB_EXTERN void
  492. hb_font_subtract_glyph_origin_for_direction (hb_font_t *font,
  493. hb_codepoint_t glyph,
  494. hb_direction_t direction,
  495. hb_position_t *x, hb_position_t *y);
  496. HB_EXTERN void
  497. hb_font_get_glyph_kerning_for_direction (hb_font_t *font,
  498. hb_codepoint_t first_glyph, hb_codepoint_t second_glyph,
  499. hb_direction_t direction,
  500. hb_position_t *x, hb_position_t *y);
  501. HB_EXTERN hb_bool_t
  502. hb_font_get_glyph_extents_for_origin (hb_font_t *font,
  503. hb_codepoint_t glyph,
  504. hb_direction_t direction,
  505. hb_glyph_extents_t *extents);
  506. HB_EXTERN hb_bool_t
  507. hb_font_get_glyph_contour_point_for_origin (hb_font_t *font,
  508. hb_codepoint_t glyph, unsigned int point_index,
  509. hb_direction_t direction,
  510. hb_position_t *x, hb_position_t *y);
  511. /* Generates gidDDD if glyph has no name. */
  512. HB_EXTERN void
  513. hb_font_glyph_to_string (hb_font_t *font,
  514. hb_codepoint_t glyph,
  515. char *s, unsigned int size);
  516. /* Parses gidDDD and uniUUUU strings automatically. */
  517. HB_EXTERN hb_bool_t
  518. hb_font_glyph_from_string (hb_font_t *font,
  519. const char *s, int len, /* -1 means nul-terminated */
  520. hb_codepoint_t *glyph);
  521. /*
  522. * hb_font_t
  523. */
  524. /* Fonts are very light-weight objects */
  525. HB_EXTERN hb_font_t *
  526. hb_font_create (hb_face_t *face);
  527. HB_EXTERN hb_font_t *
  528. hb_font_create_sub_font (hb_font_t *parent);
  529. HB_EXTERN hb_font_t *
  530. hb_font_get_empty (void);
  531. HB_EXTERN hb_font_t *
  532. hb_font_reference (hb_font_t *font);
  533. HB_EXTERN void
  534. hb_font_destroy (hb_font_t *font);
  535. HB_EXTERN hb_bool_t
  536. hb_font_set_user_data (hb_font_t *font,
  537. hb_user_data_key_t *key,
  538. void * data,
  539. hb_destroy_func_t destroy,
  540. hb_bool_t replace);
  541. HB_EXTERN void *
  542. hb_font_get_user_data (hb_font_t *font,
  543. hb_user_data_key_t *key);
  544. HB_EXTERN void
  545. hb_font_make_immutable (hb_font_t *font);
  546. HB_EXTERN hb_bool_t
  547. hb_font_is_immutable (hb_font_t *font);
  548. HB_EXTERN void
  549. hb_font_set_parent (hb_font_t *font,
  550. hb_font_t *parent);
  551. HB_EXTERN hb_font_t *
  552. hb_font_get_parent (hb_font_t *font);
  553. HB_EXTERN void
  554. hb_font_set_face (hb_font_t *font,
  555. hb_face_t *face);
  556. HB_EXTERN hb_face_t *
  557. hb_font_get_face (hb_font_t *font);
  558. HB_EXTERN void
  559. hb_font_set_funcs (hb_font_t *font,
  560. hb_font_funcs_t *klass,
  561. void *font_data,
  562. hb_destroy_func_t destroy);
  563. /* Be *very* careful with this function! */
  564. HB_EXTERN void
  565. hb_font_set_funcs_data (hb_font_t *font,
  566. void *font_data,
  567. hb_destroy_func_t destroy);
  568. HB_EXTERN void
  569. hb_font_set_scale (hb_font_t *font,
  570. int x_scale,
  571. int y_scale);
  572. HB_EXTERN void
  573. hb_font_get_scale (hb_font_t *font,
  574. int *x_scale,
  575. int *y_scale);
  576. /*
  577. * A zero value means "no hinting in that direction"
  578. */
  579. HB_EXTERN void
  580. hb_font_set_ppem (hb_font_t *font,
  581. unsigned int x_ppem,
  582. unsigned int y_ppem);
  583. HB_EXTERN void
  584. hb_font_get_ppem (hb_font_t *font,
  585. unsigned int *x_ppem,
  586. unsigned int *y_ppem);
  587. /*
  588. * Point size per EM. Used for optical-sizing in CoreText.
  589. * A value of zero means "not set".
  590. */
  591. HB_EXTERN void
  592. hb_font_set_ptem (hb_font_t *font, float ptem);
  593. HB_EXTERN float
  594. hb_font_get_ptem (hb_font_t *font);
  595. HB_EXTERN void
  596. hb_font_set_variations (hb_font_t *font,
  597. const hb_variation_t *variations,
  598. unsigned int variations_length);
  599. HB_EXTERN void
  600. hb_font_set_var_coords_design (hb_font_t *font,
  601. const float *coords,
  602. unsigned int coords_length);
  603. HB_EXTERN void
  604. hb_font_set_var_coords_normalized (hb_font_t *font,
  605. const int *coords, /* 2.14 normalized */
  606. unsigned int coords_length);
  607. HB_EXTERN const int *
  608. hb_font_get_var_coords_normalized (hb_font_t *font,
  609. unsigned int *length);
  610. HB_EXTERN void
  611. hb_font_set_var_named_instance (hb_font_t *font,
  612. unsigned instance_index);
  613. HB_END_DECLS
  614. #endif /* HB_FONT_H */