pangofc-font.h 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /* Pango
  2. * pangofc-font.h: Base fontmap type for fontconfig-based backends
  3. *
  4. * Copyright (C) 2003 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_FC_FONT_H__
  22. #define __PANGO_FC_FONT_H__
  23. #include <pango/pango.h>
  24. #include <ft2build.h>
  25. #include FT_FREETYPE_H
  26. #include <fontconfig/fontconfig.h>
  27. G_BEGIN_DECLS
  28. #define PANGO_TYPE_FC_FONT (pango_fc_font_get_type ())
  29. #define PANGO_FC_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_FC_FONT, PangoFcFont))
  30. #define PANGO_IS_FC_FONT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_FC_FONT))
  31. typedef struct _PangoFcFont PangoFcFont;
  32. typedef struct _PangoFcFontClass PangoFcFontClass;
  33. #if defined(PANGO_ENABLE_ENGINE) || defined(PANGO_ENABLE_BACKEND)
  34. /**
  35. * PANGO_RENDER_TYPE_FC:
  36. *
  37. * A string constant used to identify shape engines that work
  38. * with the fontconfig based backends. See the @engine_type field
  39. * of #PangoEngineInfo.
  40. **/
  41. #define PANGO_RENDER_TYPE_FC "PangoRenderFc"
  42. #ifdef PANGO_ENABLE_BACKEND
  43. #define PANGO_FC_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_FC_FONT, PangoFcFontClass))
  44. #define PANGO_IS_FC_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_FC_FONT))
  45. #define PANGO_FC_FONT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_FC_FONT, PangoFcFontClass))
  46. /**
  47. * PangoFcFont:
  48. *
  49. * #PangoFcFont is a base class for font implementations
  50. * using the Fontconfig and FreeType libraries and is used in
  51. * conjunction with #PangoFcFontMap. When deriving from this
  52. * class, you need to implement all of its virtual functions
  53. * other than shutdown() along with the get_glyph_extents()
  54. * virtual function from #PangoFont.
  55. **/
  56. struct _PangoFcFont
  57. {
  58. PangoFont parent_instance;
  59. FcPattern *font_pattern; /* fully resolved pattern */
  60. PangoFontMap *fontmap; /* associated map */
  61. gpointer priv; /* used internally */
  62. PangoMatrix matrix; /* used internally */
  63. PangoFontDescription *description;
  64. GSList *metrics_by_lang;
  65. guint is_hinted : 1;
  66. guint is_transformed : 1;
  67. };
  68. /**
  69. * PangoFcFontClass:
  70. * @lock_face: Returns the FT_Face of the font and increases
  71. * the reference count for the face by one.
  72. * @unlock_face: Decreases the reference count for the
  73. * FT_Face of the font by one. When the count is zero,
  74. * the #PangoFcFont subclass is allowed to free the
  75. * FT_Face.
  76. * @has_char: Return %TRUE if the the font contains a glyph
  77. * corresponding to the specified character.
  78. * @get_glyph: Gets the glyph that corresponds to the given
  79. * Unicode character.
  80. * @get_unknown_glyph: (nullable): Gets the glyph that
  81. * should be used to display an unknown-glyph indication
  82. * for the specified Unicode character. May be %NULL.
  83. * @shutdown: (nullable): Performs any font-specific
  84. * shutdown code that needs to be done when
  85. * pango_fc_font_map_shutdown is called. May be %NULL.
  86. *
  87. * Class structure for #PangoFcFont.
  88. **/
  89. struct _PangoFcFontClass
  90. {
  91. /*< private >*/
  92. PangoFontClass parent_class;
  93. /*< public >*/
  94. FT_Face (*lock_face) (PangoFcFont *font);
  95. void (*unlock_face) (PangoFcFont *font);
  96. gboolean (*has_char) (PangoFcFont *font,
  97. gunichar wc);
  98. guint (*get_glyph) (PangoFcFont *font,
  99. gunichar wc);
  100. PangoGlyph (*get_unknown_glyph) (PangoFcFont *font,
  101. gunichar wc);
  102. void (*shutdown) (PangoFcFont *font);
  103. /*< private >*/
  104. /* Padding for future expansion */
  105. void (*_pango_reserved1) (void);
  106. void (*_pango_reserved2) (void);
  107. void (*_pango_reserved3) (void);
  108. void (*_pango_reserved4) (void);
  109. };
  110. #endif /* PANGO_ENABLE_BACKEND */
  111. gboolean pango_fc_font_has_char (PangoFcFont *font,
  112. gunichar wc);
  113. guint pango_fc_font_get_glyph (PangoFcFont *font,
  114. gunichar wc);
  115. #ifndef PANGO_DISABLE_DEPRECATED
  116. G_DEPRECATED_FOR(PANGO_GET_UNKNOWN_GLYPH)
  117. PangoGlyph pango_fc_font_get_unknown_glyph (PangoFcFont *font,
  118. gunichar wc);
  119. G_DEPRECATED
  120. void pango_fc_font_kern_glyphs (PangoFcFont *font,
  121. PangoGlyphString *glyphs);
  122. #endif /* PANGO_DISABLE_DEPRECATED */
  123. #endif /* PANGO_ENABLE_ENGINE || PANGO_ENABLE_BACKEND */
  124. GType pango_fc_font_get_type (void) G_GNUC_CONST;
  125. FT_Face pango_fc_font_lock_face (PangoFcFont *font);
  126. void pango_fc_font_unlock_face (PangoFcFont *font);
  127. G_END_DECLS
  128. #endif /* __PANGO_FC_FONT_H__ */