2 * pangowin32-private.h:
4 * Copyright (C) 1999 Red Hat Software
5 * Copyright (C) 2000-2002 Tor Lillqvist
6 * Copyright (C) 2001 Alexander Larsson
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
24 #ifndef __PANGOWIN32_PRIVATE_H__
25 #define __PANGOWIN32_PRIVATE_H__
27 /* Define if you want the possibility to get copious debugging output.
28 * (You still need to set the PANGO_WIN32_DEBUG environment variable
31 #define PANGO_WIN32_DEBUGGING 1
33 #ifdef PANGO_WIN32_DEBUGGING
35 #define PING(printlist) \
36 (_pango_win32_debug ? \
37 (g_print ("%s:%d ", __PRETTY_FUNCTION__, __LINE__), \
43 #define PING(printlist) \
44 (_pango_win32_debug ? \
45 (g_print ("%s:%d ", __FILE__, __LINE__), \
51 #else /* !PANGO_WIN32_DEBUGGING */
52 #define PING(printlist)
55 #include <pango/pango-modules.h>
56 #include <pango/pangowin32.h>
60 PANGO_WIN32_COVERAGE_UNSPEC,
61 PANGO_WIN32_COVERAGE_ZH_TW,
62 PANGO_WIN32_COVERAGE_ZH_CN,
63 PANGO_WIN32_COVERAGE_JA,
64 PANGO_WIN32_COVERAGE_KO,
65 PANGO_WIN32_COVERAGE_VI,
66 PANGO_WIN32_N_COVERAGES
67 } PangoWin32CoverageLanguageClass;
69 #define PANGO_TYPE_WIN32_FONT_MAP (_pango_win32_font_map_get_type ())
70 #define PANGO_WIN32_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_WIN32_FONT_MAP, PangoWin32FontMap))
71 #define PANGO_WIN32_IS_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_WIN32_FONT_MAP))
72 #define PANGO_WIN32_FONT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_WIN32_FONT_MAP, PangoWin32FontMapClass))
73 #define PANGO_IS_WIN32_FONT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_WIN32_FONT_MAP))
74 #define PANGO_WIN32_FONT_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_WIN32_FONT_MAP, PangoWin32FontMapClass))
76 #define PANGO_TYPE_WIN32_FONT (_pango_win32_font_get_type ())
77 #define PANGO_WIN32_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_WIN32_FONT, PangoWin32Font))
78 #define PANGO_WIN32_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_WIN32_FONT, PangoWin32FontClass))
79 #define PANGO_WIN32_IS_FONT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_WIN32_FONT))
80 #define PANGO_WIN32_IS_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_WIN32_FONT))
81 #define PANGO_WIN32_FONT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_WIN32_FONT, PangoWin32FontClass))
83 typedef struct _PangoWin32FontMap PangoWin32FontMap;
84 typedef struct _PangoWin32FontMapClass PangoWin32FontMapClass;
85 typedef struct _PangoWin32Font PangoWin32Font;
86 typedef struct _PangoWin32FontClass PangoWin32FontClass;
87 typedef struct _PangoWin32Face PangoWin32Face;
88 typedef struct _PangoWin32GlyphInfo PangoWin32GlyphInfo;
89 typedef struct _PangoWin32MetricsInfo PangoWin32MetricsInfo;
91 struct _PangoWin32FontMap
93 PangoFontMap parent_instance;
95 PangoWin32FontCache *font_cache;
98 /* Map Pango family names to PangoWin32Family structs */
101 /* Map LOGFONTWs (taking into account only the lfFaceName, lfItalic
102 * and lfWeight fields) to LOGFONTWs corresponding to actual fonts
107 double resolution; /* (points / pixel) * PANGO_SCALE */
110 struct _PangoWin32FontMapClass
112 PangoFontMapClass parent_class;
114 PangoFont *(*find_font) (PangoWin32FontMap *fontmap,
115 PangoContext *context,
116 PangoWin32Face *face,
117 const PangoFontDescription *desc);
121 struct _PangoWin32Font
128 GSList *metrics_by_lang;
130 PangoFontMap *fontmap;
132 /* Written by pango_win32_get_hfont: */
138 PangoWin32Face *win32face;
140 /* If TRUE, font is in cache of recently unused fonts and not otherwise
144 GHashTable *glyph_info;
147 struct _PangoWin32FontClass
149 PangoFontClass parent_class;
151 gboolean (*select_font) (PangoFont *font,
153 void (*done_font) (PangoFont *font);
154 double (*get_metrics_factor) (PangoFont *font);
157 struct _PangoWin32Face
159 PangoFontFace parent_instance;
162 PangoFontDescription *description;
163 PangoCoverage *coverages[PANGO_WIN32_N_COVERAGES];
165 gboolean is_synthetic;
171 GSList *cached_fonts;
174 struct _PangoWin32GlyphInfo
176 PangoRectangle logical_rect;
177 PangoRectangle ink_rect;
180 struct _PangoWin32MetricsInfo
182 const char *sample_str;
183 PangoFontMetrics *metrics;
186 /* TrueType defines: */
188 #define MAKE_TT_TABLE_NAME(c1, c2, c3, c4) \
189 (((guint32)c4) << 24 | ((guint32)c3) << 16 | ((guint32)c2) << 8 | ((guint32)c1))
191 #define CMAP (MAKE_TT_TABLE_NAME('c','m','a','p'))
192 #define CMAP_HEADER_SIZE 4
194 #define NAME (MAKE_TT_TABLE_NAME('n','a','m','e'))
195 #define NAME_HEADER_SIZE 6
197 #define ENCODING_TABLE_SIZE 8
199 #define APPLE_UNICODE_PLATFORM_ID 0
200 #define MACINTOSH_PLATFORM_ID 1
201 #define ISO_PLATFORM_ID 2
202 #define MICROSOFT_PLATFORM_ID 3
204 #define SYMBOL_ENCODING_ID 0
205 #define UNICODE_ENCODING_ID 1
206 #define UCS4_ENCODING_ID 10
208 /* All the below structs must be packed! */
210 struct cmap_encoding_subtable
222 guint16 seg_count_x_2;
223 guint16 search_range;
224 guint16 entry_selector;
232 struct format_12_cmap
245 guint16 format_selector;
247 guint16 string_storage_offset;
256 guint16 string_length;
257 guint16 string_offset;
260 GType _pango_win32_font_get_type (void) G_GNUC_CONST;
262 void _pango_win32_make_matching_logfontw (PangoFontMap *fontmap,
267 GType _pango_win32_font_map_get_type (void) G_GNUC_CONST;
269 void _pango_win32_fontmap_cache_remove (PangoFontMap *fontmap,
270 PangoWin32Font *xfont);
272 gboolean _pango_win32_get_name_header (HDC hdc,
273 struct name_header *header);
274 gboolean _pango_win32_get_name_record (HDC hdc,
276 struct name_record *record);
278 extern HDC _pango_win32_hdc;
279 extern OSVERSIONINFO _pango_win32_os_version_info;
280 extern gboolean _pango_win32_debug;
282 #endif /* __PANGOWIN32_PRIVATE_H__ */