pango-font.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623
  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. *
  139. * The bits in a #PangoFontMask correspond to fields in a
  140. * #PangoFontDescription that have been set.
  141. */
  142. typedef enum {
  143. PANGO_FONT_MASK_FAMILY = 1 << 0,
  144. PANGO_FONT_MASK_STYLE = 1 << 1,
  145. PANGO_FONT_MASK_VARIANT = 1 << 2,
  146. PANGO_FONT_MASK_WEIGHT = 1 << 3,
  147. PANGO_FONT_MASK_STRETCH = 1 << 4,
  148. PANGO_FONT_MASK_SIZE = 1 << 5,
  149. PANGO_FONT_MASK_GRAVITY = 1 << 6
  150. } PangoFontMask;
  151. /* CSS scale factors (1.2 factor between each size) */
  152. /**
  153. * PANGO_SCALE_XX_SMALL:
  154. *
  155. * The scale factor for three shrinking steps (1 / (1.2 * 1.2 * 1.2)).
  156. */
  157. /**
  158. * PANGO_SCALE_X_SMALL:
  159. *
  160. * The scale factor for two shrinking steps (1 / (1.2 * 1.2)).
  161. */
  162. /**
  163. * PANGO_SCALE_SMALL:
  164. *
  165. * The scale factor for one shrinking step (1 / 1.2).
  166. */
  167. /**
  168. * PANGO_SCALE_MEDIUM:
  169. *
  170. * The scale factor for normal size (1.0).
  171. */
  172. /**
  173. * PANGO_SCALE_LARGE:
  174. *
  175. * The scale factor for one magnification step (1.2).
  176. */
  177. /**
  178. * PANGO_SCALE_X_LARGE:
  179. *
  180. * The scale factor for two magnification steps (1.2 * 1.2).
  181. */
  182. /**
  183. * PANGO_SCALE_XX_LARGE:
  184. *
  185. * The scale factor for three magnification steps (1.2 * 1.2 * 1.2).
  186. */
  187. #define PANGO_SCALE_XX_SMALL ((double)0.5787037037037)
  188. #define PANGO_SCALE_X_SMALL ((double)0.6444444444444)
  189. #define PANGO_SCALE_SMALL ((double)0.8333333333333)
  190. #define PANGO_SCALE_MEDIUM ((double)1.0)
  191. #define PANGO_SCALE_LARGE ((double)1.2)
  192. #define PANGO_SCALE_X_LARGE ((double)1.4399999999999)
  193. #define PANGO_SCALE_XX_LARGE ((double)1.728)
  194. /*
  195. * PangoFontDescription
  196. */
  197. /**
  198. * PANGO_TYPE_FONT_DESCRIPTION:
  199. *
  200. * The #GObject type for #PangoFontDescription.
  201. */
  202. #define PANGO_TYPE_FONT_DESCRIPTION (pango_font_description_get_type ())
  203. GType pango_font_description_get_type (void) G_GNUC_CONST;
  204. PangoFontDescription *pango_font_description_new (void);
  205. PangoFontDescription *pango_font_description_copy (const PangoFontDescription *desc);
  206. PangoFontDescription *pango_font_description_copy_static (const PangoFontDescription *desc);
  207. guint pango_font_description_hash (const PangoFontDescription *desc) G_GNUC_PURE;
  208. gboolean pango_font_description_equal (const PangoFontDescription *desc1,
  209. const PangoFontDescription *desc2) G_GNUC_PURE;
  210. void pango_font_description_free (PangoFontDescription *desc);
  211. void pango_font_descriptions_free (PangoFontDescription **descs,
  212. int n_descs);
  213. void pango_font_description_set_family (PangoFontDescription *desc,
  214. const char *family);
  215. void pango_font_description_set_family_static (PangoFontDescription *desc,
  216. const char *family);
  217. const char *pango_font_description_get_family (const PangoFontDescription *desc) G_GNUC_PURE;
  218. void pango_font_description_set_style (PangoFontDescription *desc,
  219. PangoStyle style);
  220. PangoStyle pango_font_description_get_style (const PangoFontDescription *desc) G_GNUC_PURE;
  221. void pango_font_description_set_variant (PangoFontDescription *desc,
  222. PangoVariant variant);
  223. PangoVariant pango_font_description_get_variant (const PangoFontDescription *desc) G_GNUC_PURE;
  224. void pango_font_description_set_weight (PangoFontDescription *desc,
  225. PangoWeight weight);
  226. PangoWeight pango_font_description_get_weight (const PangoFontDescription *desc) G_GNUC_PURE;
  227. void pango_font_description_set_stretch (PangoFontDescription *desc,
  228. PangoStretch stretch);
  229. PangoStretch pango_font_description_get_stretch (const PangoFontDescription *desc) G_GNUC_PURE;
  230. void pango_font_description_set_size (PangoFontDescription *desc,
  231. gint size);
  232. gint pango_font_description_get_size (const PangoFontDescription *desc) G_GNUC_PURE;
  233. void pango_font_description_set_absolute_size (PangoFontDescription *desc,
  234. double size);
  235. gboolean pango_font_description_get_size_is_absolute (const PangoFontDescription *desc) G_GNUC_PURE;
  236. void pango_font_description_set_gravity (PangoFontDescription *desc,
  237. PangoGravity gravity);
  238. PangoGravity pango_font_description_get_gravity (const PangoFontDescription *desc) G_GNUC_PURE;
  239. PangoFontMask pango_font_description_get_set_fields (const PangoFontDescription *desc) G_GNUC_PURE;
  240. void pango_font_description_unset_fields (PangoFontDescription *desc,
  241. PangoFontMask to_unset);
  242. void pango_font_description_merge (PangoFontDescription *desc,
  243. const PangoFontDescription *desc_to_merge,
  244. gboolean replace_existing);
  245. void pango_font_description_merge_static (PangoFontDescription *desc,
  246. const PangoFontDescription *desc_to_merge,
  247. gboolean replace_existing);
  248. gboolean pango_font_description_better_match (const PangoFontDescription *desc,
  249. const PangoFontDescription *old_match,
  250. const PangoFontDescription *new_match) G_GNUC_PURE;
  251. PangoFontDescription *pango_font_description_from_string (const char *str);
  252. char * pango_font_description_to_string (const PangoFontDescription *desc);
  253. char * pango_font_description_to_filename (const PangoFontDescription *desc);
  254. /*
  255. * PangoFontMetrics
  256. */
  257. /**
  258. * PANGO_TYPE_FONT_METRICS:
  259. *
  260. * The #GObject type for #PangoFontMetrics.
  261. */
  262. #define PANGO_TYPE_FONT_METRICS (pango_font_metrics_get_type ())
  263. GType pango_font_metrics_get_type (void) G_GNUC_CONST;
  264. PangoFontMetrics *pango_font_metrics_ref (PangoFontMetrics *metrics);
  265. void pango_font_metrics_unref (PangoFontMetrics *metrics);
  266. int pango_font_metrics_get_ascent (PangoFontMetrics *metrics) G_GNUC_PURE;
  267. int pango_font_metrics_get_descent (PangoFontMetrics *metrics) G_GNUC_PURE;
  268. int pango_font_metrics_get_approximate_char_width (PangoFontMetrics *metrics) G_GNUC_PURE;
  269. int pango_font_metrics_get_approximate_digit_width (PangoFontMetrics *metrics) G_GNUC_PURE;
  270. int pango_font_metrics_get_underline_position (PangoFontMetrics *metrics) G_GNUC_PURE;
  271. int pango_font_metrics_get_underline_thickness (PangoFontMetrics *metrics) G_GNUC_PURE;
  272. int pango_font_metrics_get_strikethrough_position (PangoFontMetrics *metrics) G_GNUC_PURE;
  273. int pango_font_metrics_get_strikethrough_thickness (PangoFontMetrics *metrics) G_GNUC_PURE;
  274. #ifdef PANGO_ENABLE_BACKEND
  275. PangoFontMetrics *pango_font_metrics_new (void);
  276. struct _PangoFontMetrics
  277. {
  278. /* <private> */
  279. guint ref_count;
  280. int ascent;
  281. int descent;
  282. int approximate_char_width;
  283. int approximate_digit_width;
  284. int underline_position;
  285. int underline_thickness;
  286. int strikethrough_position;
  287. int strikethrough_thickness;
  288. };
  289. #endif /* PANGO_ENABLE_BACKEND */
  290. /*
  291. * PangoFontFamily
  292. */
  293. /**
  294. * PANGO_TYPE_FONT_FAMILY:
  295. *
  296. * The #GObject type for #PangoFontFamily.
  297. */
  298. /**
  299. * PANGO_FONT_FAMILY:
  300. * @object: a #GObject.
  301. *
  302. * Casts a #GObject to a #PangoFontFamily.
  303. */
  304. /**
  305. * PANGO_IS_FONT_FAMILY:
  306. * @object: a #GObject.
  307. *
  308. * Returns: %TRUE if @object is a #PangoFontFamily.
  309. */
  310. #define PANGO_TYPE_FONT_FAMILY (pango_font_family_get_type ())
  311. #define PANGO_FONT_FAMILY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONT_FAMILY, PangoFontFamily))
  312. #define PANGO_IS_FONT_FAMILY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONT_FAMILY))
  313. typedef struct _PangoFontFamily PangoFontFamily;
  314. typedef struct _PangoFontFace PangoFontFace;
  315. GType pango_font_family_get_type (void) G_GNUC_CONST;
  316. void pango_font_family_list_faces (PangoFontFamily *family,
  317. PangoFontFace ***faces,
  318. int *n_faces);
  319. const char *pango_font_family_get_name (PangoFontFamily *family) G_GNUC_PURE;
  320. gboolean pango_font_family_is_monospace (PangoFontFamily *family) G_GNUC_PURE;
  321. #ifdef PANGO_ENABLE_BACKEND
  322. #define PANGO_FONT_FAMILY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT_FAMILY, PangoFontFamilyClass))
  323. #define PANGO_IS_FONT_FAMILY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT_FAMILY))
  324. #define PANGO_FONT_FAMILY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT_FAMILY, PangoFontFamilyClass))
  325. typedef struct _PangoFontFamilyClass PangoFontFamilyClass;
  326. /**
  327. * PangoFontFamily:
  328. *
  329. * The #PangoFontFamily structure is used to represent a family of related
  330. * font faces. The faces in a family share a common design, but differ in
  331. * slant, weight, width and other aspects.
  332. */
  333. struct _PangoFontFamily
  334. {
  335. GObject parent_instance;
  336. };
  337. struct _PangoFontFamilyClass
  338. {
  339. GObjectClass parent_class;
  340. /*< public >*/
  341. void (*list_faces) (PangoFontFamily *family,
  342. PangoFontFace ***faces,
  343. int *n_faces);
  344. const char * (*get_name) (PangoFontFamily *family);
  345. gboolean (*is_monospace) (PangoFontFamily *family);
  346. /*< private >*/
  347. /* Padding for future expansion */
  348. void (*_pango_reserved2) (void);
  349. void (*_pango_reserved3) (void);
  350. void (*_pango_reserved4) (void);
  351. };
  352. #endif /* PANGO_ENABLE_BACKEND */
  353. /*
  354. * PangoFontFace
  355. */
  356. /**
  357. * PANGO_TYPE_FONT_FACE:
  358. *
  359. * The #GObject type for #PangoFontFace.
  360. */
  361. /**
  362. * PANGO_FONT_FACE:
  363. * @object: a #GObject.
  364. *
  365. * Casts a #GObject to a #PangoFontFace.
  366. */
  367. /**
  368. * PANGO_IS_FONT_FACE:
  369. * @object: a #GObject.
  370. *
  371. * Returns: %TRUE if @object is a #PangoFontFace.
  372. */
  373. #define PANGO_TYPE_FONT_FACE (pango_font_face_get_type ())
  374. #define PANGO_FONT_FACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONT_FACE, PangoFontFace))
  375. #define PANGO_IS_FONT_FACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONT_FACE))
  376. GType pango_font_face_get_type (void) G_GNUC_CONST;
  377. PangoFontDescription *pango_font_face_describe (PangoFontFace *face);
  378. const char *pango_font_face_get_face_name (PangoFontFace *face) G_GNUC_PURE;
  379. void pango_font_face_list_sizes (PangoFontFace *face,
  380. int **sizes,
  381. int *n_sizes);
  382. gboolean pango_font_face_is_synthesized (PangoFontFace *face) G_GNUC_PURE;
  383. #ifdef PANGO_ENABLE_BACKEND
  384. #define PANGO_FONT_FACE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT_FACE, PangoFontFaceClass))
  385. #define PANGO_IS_FONT_FACE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT_FACE))
  386. #define PANGO_FONT_FACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT_FACE, PangoFontFaceClass))
  387. typedef struct _PangoFontFaceClass PangoFontFaceClass;
  388. /**
  389. * PangoFontFace:
  390. *
  391. * The #PangoFontFace structure is used to represent a group of fonts with
  392. * the same family, slant, weight, width, but varying sizes.
  393. */
  394. struct _PangoFontFace
  395. {
  396. GObject parent_instance;
  397. };
  398. struct _PangoFontFaceClass
  399. {
  400. GObjectClass parent_class;
  401. /*< public >*/
  402. const char * (*get_face_name) (PangoFontFace *face);
  403. PangoFontDescription * (*describe) (PangoFontFace *face);
  404. void (*list_sizes) (PangoFontFace *face,
  405. int **sizes,
  406. int *n_sizes);
  407. gboolean (*is_synthesized) (PangoFontFace *face);
  408. /*< private >*/
  409. /* Padding for future expansion */
  410. void (*_pango_reserved3) (void);
  411. void (*_pango_reserved4) (void);
  412. };
  413. #endif /* PANGO_ENABLE_BACKEND */
  414. /*
  415. * PangoFont
  416. */
  417. /**
  418. * PANGO_TYPE_FONT:
  419. *
  420. * The #GObject type for #PangoFont.
  421. */
  422. /**
  423. * PANGO_FONT:
  424. * @object: a #GObject.
  425. *
  426. * Casts a #GObject to a #PangoFont.
  427. */
  428. /**
  429. * PANGO_IS_FONT:
  430. * @object: a #GObject.
  431. *
  432. * Returns: %TRUE if @object is a #PangoFont.
  433. */
  434. #define PANGO_TYPE_FONT (pango_font_get_type ())
  435. #define PANGO_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FONT, PangoFont))
  436. #define PANGO_IS_FONT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FONT))
  437. GType pango_font_get_type (void) G_GNUC_CONST;
  438. PangoFontDescription *pango_font_describe (PangoFont *font);
  439. PangoFontDescription *pango_font_describe_with_absolute_size (PangoFont *font);
  440. PangoCoverage * pango_font_get_coverage (PangoFont *font,
  441. PangoLanguage *language);
  442. PangoEngineShape * pango_font_find_shaper (PangoFont *font,
  443. PangoLanguage *language,
  444. guint32 ch);
  445. PangoFontMetrics * pango_font_get_metrics (PangoFont *font,
  446. PangoLanguage *language);
  447. void pango_font_get_glyph_extents (PangoFont *font,
  448. PangoGlyph glyph,
  449. PangoRectangle *ink_rect,
  450. PangoRectangle *logical_rect);
  451. PangoFontMap *pango_font_get_font_map (PangoFont *font);
  452. #ifdef PANGO_ENABLE_BACKEND
  453. #define PANGO_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FONT, PangoFontClass))
  454. #define PANGO_IS_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FONT))
  455. #define PANGO_FONT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FONT, PangoFontClass))
  456. typedef struct _PangoFontClass PangoFontClass;
  457. /**
  458. * PangoFont:
  459. *
  460. * The #PangoFont structure is used to represent
  461. * a font in a rendering-system-independent matter.
  462. * To create an implementation of a #PangoFont,
  463. * the rendering-system specific code should allocate
  464. * a larger structure that contains a nested
  465. * #PangoFont, fill in the <structfield>klass</structfield> member of
  466. * the nested #PangoFont with a pointer to
  467. * a appropriate #PangoFontClass, then call
  468. * pango_font_init() on the structure.
  469. *
  470. * The #PangoFont structure contains one member
  471. * which the implementation fills in.
  472. */
  473. struct _PangoFont
  474. {
  475. GObject parent_instance;
  476. };
  477. struct _PangoFontClass
  478. {
  479. GObjectClass parent_class;
  480. /*< public >*/
  481. PangoFontDescription *(*describe) (PangoFont *font);
  482. PangoCoverage * (*get_coverage) (PangoFont *font,
  483. PangoLanguage *lang);
  484. PangoEngineShape * (*find_shaper) (PangoFont *font,
  485. PangoLanguage *lang,
  486. guint32 ch);
  487. void (*get_glyph_extents) (PangoFont *font,
  488. PangoGlyph glyph,
  489. PangoRectangle *ink_rect,
  490. PangoRectangle *logical_rect);
  491. PangoFontMetrics * (*get_metrics) (PangoFont *font,
  492. PangoLanguage *language);
  493. PangoFontMap * (*get_font_map) (PangoFont *font);
  494. PangoFontDescription *(*describe_absolute) (PangoFont *font);
  495. /*< private >*/
  496. /* Padding for future expansion */
  497. void (*_pango_reserved1) (void);
  498. void (*_pango_reserved2) (void);
  499. };
  500. /* used for very rare and miserable situtations that we cannot even
  501. * draw a hexbox
  502. */
  503. #define PANGO_UNKNOWN_GLYPH_WIDTH 10
  504. #define PANGO_UNKNOWN_GLYPH_HEIGHT 14
  505. #endif /* PANGO_ENABLE_BACKEND */
  506. /**
  507. * PANGO_GLYPH_EMPTY:
  508. *
  509. * The %PANGO_GLYPH_EMPTY macro represents a #PangoGlyph value that has a
  510. * special meaning, which is a zero-width empty glyph. This is useful for
  511. * example in shaper modules, to use as the glyph for various zero-width
  512. * Unicode characters (those passing pango_is_zero_width()).
  513. */
  514. /**
  515. * PANGO_GLYPH_INVALID_INPUT:
  516. *
  517. * The %PANGO_GLYPH_INVALID_INPUT macro represents a #PangoGlyph value that has a
  518. * special meaning of invalid input. #PangoLayout produces one such glyph
  519. * per invalid input UTF-8 byte and such a glyph is rendered as a crossed
  520. * box.
  521. *
  522. * Note that this value is defined such that it has the %PANGO_GLYPH_UNKNOWN_FLAG
  523. * on.
  524. *
  525. * Since: 1.20
  526. */
  527. /**
  528. * PANGO_GLYPH_UNKNOWN_FLAG:
  529. *
  530. * The %PANGO_GLYPH_UNKNOWN_FLAG macro is a flag value that can be added to
  531. * a #gunichar value of a valid Unicode character, to produce a #PangoGlyph
  532. * value, representing an unknown-character glyph for the respective #gunichar.
  533. */
  534. /**
  535. * PANGO_GET_UNKNOWN_GLYPH:
  536. * @wc: a Unicode character
  537. *
  538. * The way this unknown glyphs are rendered is backend specific. For example,
  539. * a box with the hexadecimal Unicode code-point of the character written in it
  540. * is what is done in the most common backends.
  541. *
  542. * Returns: a #PangoGlyph value that means no glyph was found for @wc.
  543. */
  544. #define PANGO_GLYPH_EMPTY ((PangoGlyph)0x0FFFFFFF)
  545. #define PANGO_GLYPH_INVALID_INPUT ((PangoGlyph)0xFFFFFFFF)
  546. #define PANGO_GLYPH_UNKNOWN_FLAG ((PangoGlyph)0x10000000)
  547. #define PANGO_GET_UNKNOWN_GLYPH(wc) ((PangoGlyph)(wc)|PANGO_GLYPH_UNKNOWN_FLAG)
  548. G_END_DECLS
  549. #endif /* __PANGO_FONT_H__ */