Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 
 
 

152 righe
5.2 KiB

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