pango-font.h 24 KB

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