pangofc-font.h 5.5 KB

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