pango-font.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699
  1. /* Pango
  2. * pango-font.h: Font handling
  3. *
  4. * Copyright (C) 2000 Red Hat Software
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Library General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Library General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Library General Public
  17. * License along with this library; if not, write to the
  18. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. * Boston, MA 02111-1307, USA.
  20. */
  21. #ifndef __PANGO_FONT_H__
  22. #define __PANGO_FONT_H__
  23. #include <pango/pango-coverage.h>
  24. #include <pango/pango-types.h>
  25. #include <glib-object.h>
  26. #include <hb.h>
  27. G_BEGIN_DECLS
  28. /**
  29. * PangoFontDescription:
  30. *
  31. * A `PangoFontDescription` describes a font in an implementation-independent
  32. * manner.
  33. *
  34. * `PangoFontDescription` structures are used both to list what fonts are
  35. * available on the system and also for specifying the characteristics of
  36. * a font to load.
  37. */
  38. typedef struct _PangoFontDescription PangoFontDescription;
  39. /**
  40. * PangoFontMetrics:
  41. *
  42. * A `PangoFontMetrics` structure holds the overall metric information
  43. * for a font.
  44. *
  45. * The information in a `PangoFontMetrics` structure may be restricted
  46. * to a script. The fields of this structure are private to implementations
  47. * of a font backend. See the documentation of the corresponding getters
  48. * for documentation of their meaning.
  49. *
  50. * For an overview of the most important metrics, see:
  51. *
  52. * <picture>
  53. * <source srcset="fontmetrics-dark.png" media="(prefers-color-scheme: dark)">
  54. * <img alt="Font metrics" src="fontmetrics-light.png">
  55. * </picture>
  56. */
  57. typedef struct _PangoFontMetrics PangoFontMetrics;
  58. /**
  59. * PangoStyle:
  60. * @PANGO_STYLE_NORMAL: the font is upright.
  61. * @PANGO_STYLE_OBLIQUE: the font is slanted, but in a roman style.
  62. * @PANGO_STYLE_ITALIC: the font is slanted in an italic style.
  63. *
  64. * An enumeration specifying the various slant styles possible for a font.
  65. **/
  66. typedef enum {
  67. PANGO_STYLE_NORMAL,
  68. PANGO_STYLE_OBLIQUE,
  69. PANGO_STYLE_ITALIC
  70. } PangoStyle;
  71. /**
  72. * PangoVariant:
  73. * @PANGO_VARIANT_NORMAL: A normal font.
  74. * @PANGO_VARIANT_SMALL_CAPS: A font with the lower case characters
  75. * replaced by smaller variants of the capital characters.
  76. * @PANGO_VARIANT_ALL_SMALL_CAPS: A font with all characters
  77. * replaced by smaller variants of the capital characters. Since: 1.50
  78. * @PANGO_VARIANT_PETITE_CAPS: A font with the lower case characters
  79. * replaced by smaller variants of the capital characters.
  80. * Petite Caps can be even smaller than Small Caps. Since: 1.50
  81. * @PANGO_VARIANT_ALL_PETITE_CAPS: A font with all characters
  82. * replaced by smaller variants of the capital characters.
  83. * Petite Caps can be even smaller than Small Caps. Since: 1.50
  84. * @PANGO_VARIANT_UNICASE: A font with the upper case characters
  85. * replaced by smaller variants of the capital letters. Since: 1.50
  86. * @PANGO_VARIANT_TITLE_CAPS: A font with capital letters that
  87. * are more suitable for all-uppercase titles. Since: 1.50
  88. *
  89. * An enumeration specifying capitalization variant of the font.
  90. */
  91. typedef enum {
  92. PANGO_VARIANT_NORMAL,
  93. PANGO_VARIANT_SMALL_CAPS,
  94. PANGO_VARIANT_ALL_SMALL_CAPS,
  95. PANGO_VARIANT_PETITE_CAPS,
  96. PANGO_VARIANT_ALL_PETITE_CAPS,
  97. PANGO_VARIANT_UNICASE,
  98. PANGO_VARIANT_TITLE_CAPS
  99. } PangoVariant;
  100. /**
  101. * PangoWeight:
  102. * @PANGO_WEIGHT_THIN: the thin weight (= 100) Since: 1.24
  103. * @PANGO_WEIGHT_ULTRALIGHT: the ultralight weight (= 200)
  104. * @PANGO_WEIGHT_LIGHT: the light weight (= 300)
  105. * @PANGO_WEIGHT_SEMILIGHT: the semilight weight (= 350) Since: 1.36.7
  106. * @PANGO_WEIGHT_BOOK: the book weight (= 380) Since: 1.24)
  107. * @PANGO_WEIGHT_NORMAL: the default weight (= 400)
  108. * @PANGO_WEIGHT_MEDIUM: the medium weight (= 500) Since: 1.24
  109. * @PANGO_WEIGHT_SEMIBOLD: the semibold weight (= 600)
  110. * @PANGO_WEIGHT_BOLD: the bold weight (= 700)
  111. * @PANGO_WEIGHT_ULTRABOLD: the ultrabold weight (= 800)
  112. * @PANGO_WEIGHT_HEAVY: the heavy weight (= 900)
  113. * @PANGO_WEIGHT_ULTRAHEAVY: the ultraheavy weight (= 1000) Since: 1.24
  114. *
  115. * An enumeration specifying the weight (boldness) of a font.
  116. *
  117. * Weight is specified as a numeric value ranging from 100 to 1000.
  118. * This enumeration simply provides some common, predefined values.
  119. */
  120. typedef enum {
  121. PANGO_WEIGHT_THIN = 100,
  122. PANGO_WEIGHT_ULTRALIGHT = 200,
  123. PANGO_WEIGHT_LIGHT = 300,
  124. PANGO_WEIGHT_SEMILIGHT = 350,
  125. PANGO_WEIGHT_BOOK = 380,
  126. PANGO_WEIGHT_NORMAL = 400,
  127. PANGO_WEIGHT_MEDIUM = 500,
  128. PANGO_WEIGHT_SEMIBOLD = 600,
  129. PANGO_WEIGHT_BOLD = 700,
  130. PANGO_WEIGHT_ULTRABOLD = 800,
  131. PANGO_WEIGHT_HEAVY = 900,
  132. PANGO_WEIGHT_ULTRAHEAVY = 1000
  133. } PangoWeight;
  134. /**
  135. * PangoStretch:
  136. * @PANGO_STRETCH_ULTRA_CONDENSED: ultra condensed width
  137. * @PANGO_STRETCH_EXTRA_CONDENSED: extra condensed width
  138. * @PANGO_STRETCH_CONDENSED: condensed width
  139. * @PANGO_STRETCH_SEMI_CONDENSED: semi condensed width
  140. * @PANGO_STRETCH_NORMAL: the normal width
  141. * @PANGO_STRETCH_SEMI_EXPANDED: semi expanded width
  142. * @PANGO_STRETCH_EXPANDED: expanded width
  143. * @PANGO_STRETCH_EXTRA_EXPANDED: extra expanded width
  144. * @PANGO_STRETCH_ULTRA_EXPANDED: ultra expanded width
  145. *
  146. * An enumeration specifying the width of the font relative to other designs
  147. * within a family.
  148. */
  149. typedef enum {
  150. PANGO_STRETCH_ULTRA_CONDENSED,
  151. PANGO_STRETCH_EXTRA_CONDENSED,
  152. PANGO_STRETCH_CONDENSED,
  153. PANGO_STRETCH_SEMI_CONDENSED,
  154. PANGO_STRETCH_NORMAL,
  155. PANGO_STRETCH_SEMI_EXPANDED,
  156. PANGO_STRETCH_EXPANDED,
  157. PANGO_STRETCH_EXTRA_EXPANDED,
  158. PANGO_STRETCH_ULTRA_EXPANDED
  159. } PangoStretch;
  160. /**
  161. * PangoFontMask:
  162. * @PANGO_FONT_MASK_FAMILY: the font family is specified.
  163. * @PANGO_FONT_MASK_STYLE: the font style is specified.
  164. * @PANGO_FONT_MASK_VARIANT: the font variant is specified.
  165. * @PANGO_FONT_MASK_WEIGHT: the font weight is specified.
  166. * @PANGO_FONT_MASK_STRETCH: the font stretch is specified.
  167. * @PANGO_FONT_MASK_SIZE: the font size is specified.
  168. * @PANGO_FONT_MASK_GRAVITY: the font gravity is specified (Since: 1.16.)
  169. * @PANGO_FONT_MASK_VARIATIONS: OpenType font variations are specified (Since: 1.42)
  170. *
  171. * The bits in a `PangoFontMask` correspond to the set fields in a
  172. * `PangoFontDescription`.
  173. */
  174. typedef enum {
  175. PANGO_FONT_MASK_FAMILY = 1 << 0,
  176. PANGO_FONT_MASK_STYLE = 1 << 1,
  177. PANGO_FONT_MASK_VARIANT = 1 << 2,
  178. PANGO_FONT_MASK_WEIGHT = 1 << 3,
  179. PANGO_FONT_MASK_STRETCH = 1 << 4,
  180. PANGO_FONT_MASK_SIZE = 1 << 5,
  181. PANGO_FONT_MASK_GRAVITY = 1 << 6,
  182. PANGO_FONT_MASK_VARIATIONS = 1 << 7,
  183. } PangoFontMask;
  184. /* CSS scale factors (1.2 factor between each size) */
  185. /**
  186. * PANGO_SCALE_XX_SMALL:
  187. *
  188. * The scale factor for three shrinking steps (1 / (1.2 * 1.2 * 1.2)).
  189. */
  190. /**
  191. * PANGO_SCALE_X_SMALL:
  192. *
  193. * The scale factor for two shrinking steps (1 / (1.2 * 1.2)).
  194. */
  195. /**
  196. * PANGO_SCALE_SMALL:
  197. *
  198. * The scale factor for one shrinking step (1 / 1.2).
  199. */
  200. /**
  201. * PANGO_SCALE_MEDIUM:
  202. *
  203. * The scale factor for normal size (1.0).
  204. */
  205. /**
  206. * PANGO_SCALE_LARGE:
  207. *
  208. * The scale factor for one magnification step (1.2).
  209. */
  210. /**
  211. * PANGO_SCALE_X_LARGE:
  212. *
  213. * The scale factor for two magnification steps (1.2 * 1.2).
  214. */
  215. /**
  216. * PANGO_SCALE_XX_LARGE:
  217. *
  218. * The scale factor for three magnification steps (1.2 * 1.2 * 1.2).
  219. */
  220. #define PANGO_SCALE_XX_SMALL ((double)0.5787037037037)
  221. #define PANGO_SCALE_X_SMALL ((double)0.6944444444444)
  222. #define PANGO_SCALE_SMALL ((double)0.8333333333333)
  223. #define PANGO_SCALE_MEDIUM ((double)1.0)
  224. #define PANGO_SCALE_LARGE ((double)1.2)
  225. #define PANGO_SCALE_X_LARGE ((double)1.44)
  226. #define PANGO_SCALE_XX_LARGE ((double)1.728)
  227. /*
  228. * PangoFontDescription
  229. */
  230. #define PANGO_TYPE_FONT_DESCRIPTION (pango_font_description_get_type ())
  231. PANGO_AVAILABLE_IN_ALL
  232. GType pango_font_description_get_type (void) G_GNUC_CONST;
  233. PANGO_AVAILABLE_IN_ALL
  234. PangoFontDescription *pango_font_description_new (void);
  235. PANGO_AVAILABLE_IN_ALL
  236. PangoFontDescription *pango_font_description_copy (const PangoFontDescription *desc);
  237. PANGO_AVAILABLE_IN_ALL
  238. PangoFontDescription *pango_font_description_copy_static (const PangoFontDescription *desc);
  239. PANGO_AVAILABLE_IN_ALL
  240. guint pango_font_description_hash (const PangoFontDescription *desc) G_GNUC_PURE;
  241. PANGO_AVAILABLE_IN_ALL
  242. gboolean pango_font_description_equal (const PangoFontDescription *desc1,
  243. const PangoFontDescription *desc2) G_GNUC_PURE;
  244. PANGO_AVAILABLE_IN_ALL
  245. void pango_font_description_free (PangoFontDescription *desc);
  246. PANGO_AVAILABLE_IN_ALL
  247. void pango_font_descriptions_free (PangoFontDescription **descs,
  248. int n_descs);
  249. PANGO_AVAILABLE_IN_ALL
  250. void pango_font_description_set_family (PangoFontDescription *desc,
  251. const char *family);
  252. PANGO_AVAILABLE_IN_ALL
  253. void pango_font_description_set_family_static (PangoFontDescription *desc,
  254. const char *family);
  255. PANGO_AVAILABLE_IN_ALL
  256. const char *pango_font_description_get_family (const PangoFontDescription *desc) G_GNUC_PURE;
  257. PANGO_AVAILABLE_IN_ALL
  258. void pango_font_description_set_style (PangoFontDescription *desc,
  259. PangoStyle style);
  260. PANGO_AVAILABLE_IN_ALL
  261. PangoStyle pango_font_description_get_style (const PangoFontDescription *desc) G_GNUC_PURE;
  262. PANGO_AVAILABLE_IN_ALL
  263. void pango_font_description_set_variant (PangoFontDescription *desc,
  264. PangoVariant variant);
  265. PANGO_AVAILABLE_IN_ALL
  266. PangoVariant pango_font_description_get_variant (const PangoFontDescription *desc) G_GNUC_PURE;
  267. PANGO_AVAILABLE_IN_ALL
  268. void pango_font_description_set_weight (PangoFontDescription *desc,
  269. PangoWeight weight);
  270. PANGO_AVAILABLE_IN_ALL
  271. PangoWeight pango_font_description_get_weight (const PangoFontDescription *desc) G_GNUC_PURE;
  272. PANGO_AVAILABLE_IN_ALL
  273. void pango_font_description_set_stretch (PangoFontDescription *desc,
  274. PangoStretch stretch);
  275. PANGO_AVAILABLE_IN_ALL
  276. PangoStretch pango_font_description_get_stretch (const PangoFontDescription *desc) G_GNUC_PURE;
  277. PANGO_AVAILABLE_IN_ALL
  278. void pango_font_description_set_size (PangoFontDescription *desc,
  279. gint size);
  280. PANGO_AVAILABLE_IN_ALL
  281. gint pango_font_description_get_size (const PangoFontDescription *desc) G_GNUC_PURE;
  282. PANGO_AVAILABLE_IN_1_8
  283. void pango_font_description_set_absolute_size (PangoFontDescription *desc,
  284. double size);
  285. PANGO_AVAILABLE_IN_1_8
  286. gboolean pango_font_description_get_size_is_absolute (const PangoFontDescription *desc) G_GNUC_PURE;
  287. PANGO_AVAILABLE_IN_1_16
  288. void pango_font_description_set_gravity (PangoFontDescription *desc,
  289. PangoGravity gravity);
  290. PANGO_AVAILABLE_IN_1_16
  291. PangoGravity pango_font_description_get_gravity (const PangoFontDescription *desc) G_GNUC_PURE;
  292. PANGO_AVAILABLE_IN_1_42
  293. void pango_font_description_set_variations_static (PangoFontDescription *desc,
  294. const char *variations);
  295. PANGO_AVAILABLE_IN_1_42
  296. void pango_font_description_set_variations (PangoFontDescription *desc,
  297. const char *variations);
  298. PANGO_AVAILABLE_IN_1_42
  299. const char *pango_font_description_get_variations (const PangoFontDescription *desc) G_GNUC_PURE;
  300. PANGO_AVAILABLE_IN_ALL
  301. PangoFontMask pango_font_description_get_set_fields (const PangoFontDescription *desc) G_GNUC_PURE;
  302. PANGO_AVAILABLE_IN_ALL
  303. void pango_font_description_unset_fields (PangoFontDescription *desc,
  304. PangoFontMask to_unset);
  305. PANGO_AVAILABLE_IN_ALL
  306. void pango_font_description_merge (PangoFontDescription *desc,
  307. const PangoFontDescription *desc_to_merge,
  308. gboolean replace_existing);
  309. PANGO_AVAILABLE_IN_ALL
  310. void pango_font_description_merge_static (PangoFontDescription *desc,
  311. const PangoFontDescription *desc_to_merge,
  312. gboolean replace_existing);
  313. PANGO_AVAILABLE_IN_ALL
  314. gboolean pango_font_description_better_match (const PangoFontDescription *desc,
  315. const PangoFontDescription *old_match,
  316. const PangoFontDescription *new_match) G_GNUC_PURE;
  317. PANGO_AVAILABLE_IN_ALL
  318. PangoFontDescription *pango_font_description_from_string (const char *str);
  319. PANGO_AVAILABLE_IN_ALL
  320. char * pango_font_description_to_string (const PangoFontDescription *desc);
  321. PANGO_AVAILABLE_IN_ALL
  322. char * pango_font_description_to_filename (const PangoFontDescription *desc);
  323. /*
  324. * PangoFontMetrics
  325. */
  326. #define PANGO_TYPE_FONT_METRICS (pango_font_metrics_get_type ())
  327. struct _PangoFontMetrics
  328. {
  329. /* <private> */
  330. guint ref_count;
  331. int ascent;
  332. int descent;
  333. int height;
  334. int approximate_char_width;
  335. int approximate_digit_width;
  336. int underline_position;
  337. int underline_thickness;
  338. int strikethrough_position;
  339. int strikethrough_thickness;
  340. };
  341. PANGO_AVAILABLE_IN_ALL
  342. GType pango_font_metrics_get_type (void) G_GNUC_CONST;
  343. PANGO_AVAILABLE_IN_ALL
  344. PangoFontMetrics *pango_font_metrics_ref (PangoFontMetrics *metrics);
  345. PANGO_AVAILABLE_IN_ALL
  346. void pango_font_metrics_unref (PangoFontMetrics *metrics);
  347. PANGO_AVAILABLE_IN_ALL
  348. int pango_font_metrics_get_ascent (PangoFontMetrics *metrics) G_GNUC_PURE;
  349. PANGO_AVAILABLE_IN_ALL
  350. int pango_font_metrics_get_descent (PangoFontMetrics *metrics) G_GNUC_PURE;
  351. PANGO_AVAILABLE_IN_1_44
  352. int pango_font_metrics_get_height (PangoFontMetrics *metrics) G_GNUC_PURE;
  353. PANGO_AVAILABLE_IN_ALL
  354. int pango_font_metrics_get_approximate_char_width (PangoFontMetrics *metrics) G_GNUC_PURE;
  355. PANGO_AVAILABLE_IN_ALL
  356. int pango_font_metrics_get_approximate_digit_width (PangoFontMetrics *metrics) G_GNUC_PURE;
  357. PANGO_AVAILABLE_IN_1_6
  358. int pango_font_metrics_get_underline_position (PangoFontMetrics *metrics) G_GNUC_PURE;
  359. PANGO_AVAILABLE_IN_1_6
  360. int pango_font_metrics_get_underline_thickness (PangoFontMetrics *metrics) G_GNUC_PURE;
  361. PANGO_AVAILABLE_IN_1_6
  362. int pango_font_metrics_get_strikethrough_position (PangoFontMetrics *metrics) G_GNUC_PURE;
  363. PANGO_AVAILABLE_IN_1_6
  364. int pango_font_metrics_get_strikethrough_thickness (PangoFontMetrics *metrics) G_GNUC_PURE;
  365. /*
  366. * PangoFontFamily
  367. */
  368. #define PANGO_TYPE_FONT_FAMILY (pango_font_family_get_type ())
  369. #define PANGO_FONT_FAMILY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONT_FAMILY, PangoFontFamily))
  370. #define PANGO_IS_FONT_FAMILY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONT_FAMILY))
  371. #define PANGO_FONT_FAMILY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT_FAMILY, PangoFontFamilyClass))
  372. #define PANGO_IS_FONT_FAMILY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT_FAMILY))
  373. #define PANGO_FONT_FAMILY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT_FAMILY, PangoFontFamilyClass))
  374. typedef struct _PangoFontFace PangoFontFace;
  375. typedef struct _PangoFontFamily PangoFontFamily;
  376. typedef struct _PangoFontFamilyClass PangoFontFamilyClass;
  377. #ifndef PANGO_DISABLE_DEPRECATED
  378. /**
  379. * PangoFontFamily:
  380. *
  381. * A `PangoFontFamily` is used to represent a family of related
  382. * font faces.
  383. *
  384. * The font faces in a family share a common design, but differ in
  385. * slant, weight, width or other aspects.
  386. */
  387. struct _PangoFontFamily
  388. {
  389. GObject parent_instance;
  390. };
  391. struct _PangoFontFamilyClass
  392. {
  393. GObjectClass parent_class;
  394. /*< public >*/
  395. void (*list_faces) (PangoFontFamily *family,
  396. PangoFontFace ***faces,
  397. int *n_faces);
  398. const char * (*get_name) (PangoFontFamily *family);
  399. gboolean (*is_monospace) (PangoFontFamily *family);
  400. gboolean (*is_variable) (PangoFontFamily *family);
  401. PangoFontFace * (*get_face) (PangoFontFamily *family,
  402. const char *name);
  403. /*< private >*/
  404. /* Padding for future expansion */
  405. void (*_pango_reserved2) (void);
  406. };
  407. #endif /* PANGO_DISABLE_DEPRECATED */
  408. PANGO_AVAILABLE_IN_ALL
  409. GType pango_font_family_get_type (void) G_GNUC_CONST;
  410. PANGO_AVAILABLE_IN_ALL
  411. void pango_font_family_list_faces (PangoFontFamily *family,
  412. PangoFontFace ***faces,
  413. int *n_faces);
  414. PANGO_AVAILABLE_IN_ALL
  415. const char *pango_font_family_get_name (PangoFontFamily *family) G_GNUC_PURE;
  416. PANGO_AVAILABLE_IN_1_4
  417. gboolean pango_font_family_is_monospace (PangoFontFamily *family) G_GNUC_PURE;
  418. PANGO_AVAILABLE_IN_1_44
  419. gboolean pango_font_family_is_variable (PangoFontFamily *family) G_GNUC_PURE;
  420. PANGO_AVAILABLE_IN_1_46
  421. PangoFontFace *pango_font_family_get_face (PangoFontFamily *family,
  422. const char *name);
  423. /*
  424. * PangoFontFace
  425. */
  426. #define PANGO_TYPE_FONT_FACE (pango_font_face_get_type ())
  427. #define PANGO_FONT_FACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONT_FACE, PangoFontFace))
  428. #define PANGO_IS_FONT_FACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONT_FACE))
  429. #define PANGO_FONT_FACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT_FACE, PangoFontFaceClass))
  430. #define PANGO_IS_FONT_FACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT_FACE))
  431. #define PANGO_FONT_FACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT_FACE, PangoFontFaceClass))
  432. typedef struct _PangoFontFaceClass PangoFontFaceClass;
  433. #ifndef PANGO_DISABLE_DEPRECATED
  434. /**
  435. * PangoFontFace:
  436. *
  437. * A `PangoFontFace` is used to represent a group of fonts with
  438. * the same family, slant, weight, and width, but varying sizes.
  439. */
  440. struct _PangoFontFace
  441. {
  442. GObject parent_instance;
  443. };
  444. struct _PangoFontFaceClass
  445. {
  446. GObjectClass parent_class;
  447. /*< public >*/
  448. const char * (*get_face_name) (PangoFontFace *face);
  449. PangoFontDescription * (*describe) (PangoFontFace *face);
  450. void (*list_sizes) (PangoFontFace *face,
  451. int **sizes,
  452. int *n_sizes);
  453. gboolean (*is_synthesized) (PangoFontFace *face);
  454. PangoFontFamily * (*get_family) (PangoFontFace *face);
  455. /*< private >*/
  456. /* Padding for future expansion */
  457. void (*_pango_reserved3) (void);
  458. void (*_pango_reserved4) (void);
  459. };
  460. #endif /* PANGO_DISABLE_DEPRECATED */
  461. PANGO_AVAILABLE_IN_ALL
  462. GType pango_font_face_get_type (void) G_GNUC_CONST;
  463. PANGO_AVAILABLE_IN_ALL
  464. PangoFontDescription *pango_font_face_describe (PangoFontFace *face);
  465. PANGO_AVAILABLE_IN_ALL
  466. const char *pango_font_face_get_face_name (PangoFontFace *face) G_GNUC_PURE;
  467. PANGO_AVAILABLE_IN_1_4
  468. void pango_font_face_list_sizes (PangoFontFace *face,
  469. int **sizes,
  470. int *n_sizes);
  471. PANGO_AVAILABLE_IN_1_18
  472. gboolean pango_font_face_is_synthesized (PangoFontFace *face) G_GNUC_PURE;
  473. PANGO_AVAILABLE_IN_1_46
  474. PangoFontFamily * pango_font_face_get_family (PangoFontFace *face);
  475. /*
  476. * PangoFont
  477. */
  478. #define PANGO_TYPE_FONT (pango_font_get_type ())
  479. #define PANGO_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONT, PangoFont))
  480. #define PANGO_IS_FONT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONT))
  481. #define PANGO_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT, PangoFontClass))
  482. #define PANGO_IS_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT))
  483. #define PANGO_FONT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT, PangoFontClass))
  484. #ifndef PANGO_DISABLE_DEPRECATED
  485. /**
  486. * PangoFont:
  487. *
  488. * A `PangoFont` is used to represent a font in a
  489. * rendering-system-independent manner.
  490. */
  491. struct _PangoFont
  492. {
  493. GObject parent_instance;
  494. };
  495. typedef struct _PangoFontClass PangoFontClass;
  496. struct _PangoFontClass
  497. {
  498. GObjectClass parent_class;
  499. /*< public >*/
  500. PangoFontDescription *(*describe) (PangoFont *font);
  501. PangoCoverage * (*get_coverage) (PangoFont *font,
  502. PangoLanguage *language);
  503. void (*get_glyph_extents) (PangoFont *font,
  504. PangoGlyph glyph,
  505. PangoRectangle *ink_rect,
  506. PangoRectangle *logical_rect);
  507. PangoFontMetrics * (*get_metrics) (PangoFont *font,
  508. PangoLanguage *language);
  509. PangoFontMap * (*get_font_map) (PangoFont *font);
  510. PangoFontDescription *(*describe_absolute) (PangoFont *font);
  511. void (*get_features) (PangoFont *font,
  512. hb_feature_t *features,
  513. guint len,
  514. guint *num_features);
  515. hb_font_t * (*create_hb_font) (PangoFont *font);
  516. };
  517. #endif /* PANGO_DISABLE_DEPRECATED */
  518. PANGO_AVAILABLE_IN_ALL
  519. GType pango_font_get_type (void) G_GNUC_CONST;
  520. PANGO_AVAILABLE_IN_ALL
  521. PangoFontDescription *pango_font_describe (PangoFont *font);
  522. PANGO_AVAILABLE_IN_1_14
  523. PangoFontDescription *pango_font_describe_with_absolute_size (PangoFont *font);
  524. PANGO_AVAILABLE_IN_ALL
  525. PangoCoverage * pango_font_get_coverage (PangoFont *font,
  526. PangoLanguage *language);
  527. #ifndef __GI_SCANNER__
  528. PANGO_DEPRECATED_IN_1_44
  529. PangoEngineShape * pango_font_find_shaper (PangoFont *font,
  530. PangoLanguage *language,
  531. guint32 ch);
  532. #endif
  533. PANGO_AVAILABLE_IN_ALL
  534. PangoFontMetrics * pango_font_get_metrics (PangoFont *font,
  535. PangoLanguage *language);
  536. PANGO_AVAILABLE_IN_ALL
  537. void pango_font_get_glyph_extents (PangoFont *font,
  538. PangoGlyph glyph,
  539. PangoRectangle *ink_rect,
  540. PangoRectangle *logical_rect);
  541. PANGO_AVAILABLE_IN_1_10
  542. PangoFontMap *pango_font_get_font_map (PangoFont *font);
  543. PANGO_AVAILABLE_IN_1_46
  544. PangoFontFace * pango_font_get_face (PangoFont *font);
  545. PANGO_AVAILABLE_IN_1_44
  546. gboolean pango_font_has_char (PangoFont *font,
  547. gunichar wc);
  548. PANGO_AVAILABLE_IN_1_44
  549. void pango_font_get_features (PangoFont *font,
  550. hb_feature_t *features,
  551. guint len,
  552. guint *num_features);
  553. PANGO_AVAILABLE_IN_1_44
  554. hb_font_t * pango_font_get_hb_font (PangoFont *font);
  555. PANGO_AVAILABLE_IN_1_50
  556. PangoLanguage ** pango_font_get_languages (PangoFont *font);
  557. PANGO_AVAILABLE_IN_1_50
  558. GBytes * pango_font_serialize (PangoFont *font);
  559. PANGO_AVAILABLE_IN_1_50
  560. PangoFont * pango_font_deserialize (PangoContext *context,
  561. GBytes *bytes,
  562. GError **error);
  563. /**
  564. * PANGO_GLYPH_EMPTY:
  565. *
  566. * A `PangoGlyph` value that indicates a zero-width empty glpyh.
  567. *
  568. * This is useful for example in shaper modules, to use as the glyph for
  569. * various zero-width Unicode characters (those passing [func@is_zero_width]).
  570. */
  571. /**
  572. * PANGO_GLYPH_INVALID_INPUT:
  573. *
  574. * A `PangoGlyph` value for invalid input.
  575. *
  576. * `PangoLayout` produces one such glyph per invalid input UTF-8 byte and such
  577. * a glyph is rendered as a crossed box.
  578. *
  579. * Note that this value is defined such that it has the %PANGO_GLYPH_UNKNOWN_FLAG
  580. * set.
  581. *
  582. * Since: 1.20
  583. */
  584. /**
  585. * PANGO_GLYPH_UNKNOWN_FLAG:
  586. *
  587. * Flag used in `PangoGlyph` to turn a `gunichar` value of a valid Unicode
  588. * character into an unknown-character glyph for that `gunichar`.
  589. *
  590. * Such unknown-character glyphs may be rendered as a 'hex box'.
  591. */
  592. /**
  593. * PANGO_GET_UNKNOWN_GLYPH:
  594. * @wc: a Unicode character
  595. *
  596. * The way this unknown glyphs are rendered is backend specific. For example,
  597. * a box with the hexadecimal Unicode code-point of the character written in it
  598. * is what is done in the most common backends.
  599. *
  600. * Returns: a `PangoGlyph` value that means no glyph was found for @wc.
  601. */
  602. #define PANGO_GLYPH_EMPTY ((PangoGlyph)0x0FFFFFFF)
  603. #define PANGO_GLYPH_INVALID_INPUT ((PangoGlyph)0xFFFFFFFF)
  604. #define PANGO_GLYPH_UNKNOWN_FLAG ((PangoGlyph)0x10000000)
  605. #define PANGO_GET_UNKNOWN_GLYPH(wc) ((PangoGlyph)(wc)|PANGO_GLYPH_UNKNOWN_FLAG)
  606. #ifndef __GI_SCANNER__
  607. #ifndef PANGO_DISABLE_DEPRECATED
  608. #define PANGO_UNKNOWN_GLYPH_WIDTH 10
  609. #define PANGO_UNKNOWN_GLYPH_HEIGHT 14
  610. #endif
  611. #endif
  612. G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoFontFamily, g_object_unref)
  613. G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoFontFace, g_object_unref)
  614. G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoFont, g_object_unref)
  615. G_DEFINE_AUTOPTR_CLEANUP_FUNC(PangoFontDescription, pango_font_description_free)
  616. G_END_DECLS
  617. #endif /* __PANGO_FONT_H__ */