Upload tizen 2.0 beta source
[external/pango1.0.git] / pango / pangox-private.h
1 /* Pango
2  * pangox-private.h:
3  *
4  * Copyright (C) 1999 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
22 #ifndef __PANGOX_PRIVATE_H__
23 #define __PANGOX_PRIVATE_H__
24
25 #include <pango/pangox.h>
26 #include <pango/pango-modules.h>
27
28 typedef struct _PangoXFace        PangoXFace;
29 typedef struct _PangoXFont        PangoXFont;
30 typedef struct _PangoXSubfontInfo PangoXSubfontInfo;
31
32 struct _PangoXFont
33 {
34   PangoFont font;
35   Display *display;
36
37   char **fonts;
38   int n_fonts;
39   int size;
40
41   /* hash table mapping from charset-name to array of PangoXSubfont ids,
42    * of length n_fonts
43    */
44   GHashTable *subfonts_by_charset;
45
46   PangoXSubfontInfo **subfonts;
47
48   int n_subfonts;
49   int max_subfonts;
50
51   GSList *metrics_by_lang;
52
53   PangoFontMap *fontmap;
54   /* If TRUE, font is in cache of recently unused fonts and not otherwise
55    * in use.
56    */
57   gboolean in_cache;
58
59   PangoXFace *xface;    /* Used to remove cached fonts */
60 };
61
62
63 #define PANGO_TYPE_X_FONT_MAP              (pango_x_font_map_get_type ())
64 #define PANGO_X_FONT_MAP(object)           (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_X_FONT_MAP, PangoXFontMap))
65 #define PANGO_X_FONT_MAP_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_X_FONT_MAP, PangoXFontMapClass))
66 #define PANGO_X_IS_FONT_MAP(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_X_FONT_MAP))
67 #define PANGO_X_IS_FONT_MAP_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_X_FONT_MAP))
68 #define PANGO_X_FONT_MAP_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_X_FONT_MAP, PangoXFontMapClass))
69
70 typedef struct _PangoXFontMap      PangoXFontMap;
71 typedef struct _PangoXFontMapClass PangoXFontMapClass;
72
73 struct _PangoXFontMap
74 {
75   PangoFontMap parent_instance;
76
77   Display *display;
78
79   PangoXFontCache *font_cache;
80   GQueue *freed_fonts;
81
82   GHashTable *families;
83   GHashTable *size_infos;
84
85   GHashTable *to_atom_cache;
86   GHashTable *from_atom_cache;
87
88   int n_fonts;
89
90   double resolution;            /* (points / pixel) * PANGO_SCALE */
91
92   Window coverage_win;
93 };
94
95 GType    pango_x_font_map_get_type   (void) G_GNUC_CONST;
96
97 PangoXFont *   pango_x_font_new                (PangoFontMap    *fontmap,
98                                                 const char      *spec,
99                                                 int              size);
100 PangoMap *     pango_x_get_shaper_map          (PangoLanguage   *language);
101 char *         pango_x_make_matching_xlfd      (PangoFontMap    *fontmap,
102                                                 char            *xlfd,
103                                                 const char      *charset,
104                                                 int              size);
105 PangoCoverage *pango_x_face_get_coverage       (PangoXFace      *xface,
106                                                 PangoFont       *font,
107                                                 PangoLanguage   *language);
108 void           pango_x_face_remove             (PangoXFace      *xface,
109                                                 PangoFont       *font);
110
111 Display *      pango_x_fontmap_get_display     (PangoFontMap    *fontmap);
112 void           pango_x_fontmap_cache_add       (PangoFontMap    *fontmap,
113                                                 PangoXFont      *xfont);
114 void           pango_x_fontmap_cache_remove    (PangoFontMap    *fontmap,
115                                                 PangoXFont      *xfont);
116
117 Atom           pango_x_fontmap_atom_from_name (PangoFontMap *fontmap,
118                                                const char   *atomname);
119 const char    *pango_x_fontmap_name_from_atom  (PangoFontMap *fontmap,
120                                                 Atom          atom);
121
122 #endif /* __PANGOX_PRIVATE_H__ */