Git init
[external/pango1.0.git] / pango / pangox.h
1 /* Pango
2  * pangox.h:
3  *
4  * Copyright (C) 1999 Red Hat Software
5  * Copyright (C) 2000 SuSE Linux Ltd
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Library General Public
9  * License as published by the Free Software Foundation; either
10  * version 2 of the License, or (at your option) any later version.
11  *
12  * This library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15  * Library General Public License for more details.
16  *
17  * You should have received a copy of the GNU Library General Public
18  * License along with this library; if not, write to the
19  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20  * Boston, MA 02111-1307, USA.
21  */
22
23 #ifndef __PANGOX_H__
24 #define __PANGOX_H__
25
26 #include <glib.h>
27 #include <pango/pango-layout.h>
28
29 G_BEGIN_DECLS
30
31 #include <X11/Xlib.h>
32
33 #ifndef PANGO_DISABLE_DEPRECATED
34
35 #define PANGO_RENDER_TYPE_X "PangoRenderX"
36
37 typedef GC (*PangoGetGCFunc) (PangoContext *context, PangoColor *color, GC base_gc);
38 typedef void (*PangoFreeGCFunc) (PangoContext *context, GC gc);
39
40 /* Calls for applications
41  */
42 PangoContext * pango_x_get_context        (Display          *display);
43 void           pango_x_context_set_funcs  (PangoContext     *context,
44                                            PangoGetGCFunc    get_gc_func,
45                                            PangoFreeGCFunc   free_gc_func);
46
47 PangoFont *    pango_x_load_font          (Display          *display,
48                                            const gchar      *spec);
49 void           pango_x_render             (Display          *display,
50                                            Drawable          d,
51                                            GC                gc,
52                                            PangoFont        *font,
53                                            PangoGlyphString *glyphs,
54                                            gint              x,
55                                            gint              y);
56 void           pango_x_render_layout_line (Display          *display,
57                                            Drawable          drawable,
58                                            GC                gc,
59                                            PangoLayoutLine  *line,
60                                            int               x,
61                                            int               y);
62 void           pango_x_render_layout      (Display          *display,
63                                            Drawable          drawable,
64                                            GC                gc,
65                                            PangoLayout      *layout,
66                                            int               x,
67                                            int               y);
68
69 /* API for rendering modules
70  */
71 typedef guint16 PangoXSubfont;
72
73 #define PANGO_X_MAKE_GLYPH(subfont,index_) ((subfont)<<16 | (index_))
74 #define PANGO_X_GLYPH_SUBFONT(glyph) ((glyph)>>16)
75 #define PANGO_X_GLYPH_INDEX(glyph) ((glyph) & 0xffff)
76
77 int        pango_x_list_subfonts     (PangoFont      *font,
78                                       char          **charsets,
79                                       int             n_charsets,
80                                       PangoXSubfont **subfont_ids,
81                                       int           **subfont_charsets);
82 gboolean   pango_x_has_glyph         (PangoFont      *font,
83                                       PangoGlyph      glyph);
84 PangoGlyph pango_x_get_unknown_glyph (PangoFont      *font);
85
86 #ifdef PANGO_ENABLE_ENGINE
87 PangoGlyph pango_x_font_get_unknown_glyph (PangoFont    *font,
88                                            gunichar      wc);
89 #endif /* PANGO_ENABLE_ENGINE */
90
91 /* API for libraries that want to use PangoX mixed with classic X fonts.
92  */
93 typedef struct _PangoXFontCache PangoXFontCache;
94
95 PangoXFontCache *pango_x_font_cache_new     (Display         *display);
96 void             pango_x_font_cache_free    (PangoXFontCache *cache);
97
98 XFontStruct * pango_x_font_cache_load      (PangoXFontCache *cache,
99                                             const char      *xlfd);
100 void          pango_x_font_cache_unload    (PangoXFontCache *cache,
101                                             XFontStruct     *fs);
102
103 PangoFontMap *   pango_x_font_map_for_display  (Display     *display);
104 void             pango_x_shutdown_display      (Display     *display);
105 PangoXFontCache *pango_x_font_map_get_font_cache (PangoFontMap *font_map);
106
107 char *pango_x_font_subfont_xlfd (PangoFont     *font,
108                                  PangoXSubfont  subfont_id);
109
110
111 gboolean pango_x_find_first_subfont (PangoFont     *font,
112                                      char         **charsets,
113                                      int            n_charsets,
114                                      PangoXSubfont *rfont);
115
116 void pango_x_fallback_shape (PangoFont        *font,
117                              PangoGlyphString *glyphs,
118                              const char       *text,
119                              int               n_chars);
120
121 gboolean pango_x_apply_ligatures (PangoFont     *font,
122                                   PangoXSubfont  subfont,
123                                   gunichar     **glyphs,
124                                   int           *n_glyphs,
125                                   int          **clusters);
126
127 #endif /* PANGO_DISABLE_DEPRECATED */
128
129 G_END_DECLS
130
131 #endif /* __PANGOX_H__ */