+2007-03-10 Tor Lillqvist <tml@novell.com>
+
+ * pango/pangowin32-private.h
+ * pango/pangowin32.c
+ * pango/pangowin32-fontcache.c
+ * pango/pangowin32-fontmap.c
+ * pango/pangocairo-win32font.c
+ * pango/pangowin32.def: Move functions defined in one file and
+ used in another to the file where used, make them static, and drop
+ from pangowin32-private.h. Prefix all private non-static functions
+ with underscore. Also functions used only by the pangocairo DLL
+ are considered private. (#120195)
+
+2007-03-10 Tor Lillqvist <tml@novell.com>
+
+ * README: Uniscribe is optional only at run-time.
+
2007-03-07 Tor Lillqvist <tml@novell.com>
* configure.in
{
g_object_ref (win32font);
if (win32font->in_cache)
- pango_win32_fontmap_cache_remove (PANGO_FONT_MAP (win32fontmap), win32font);
+ _pango_win32_fontmap_cache_remove (PANGO_FONT_MAP (win32fontmap), win32font);
return PANGO_FONT (win32font);
}
else
cairo_matrix_init_identity (&cwfont->ctm);
- pango_win32_make_matching_logfontw (win32font->fontmap,
- &face->logfontw,
- win32font->size,
- &win32font->logfontw);
+ _pango_win32_make_matching_logfontw (win32font->fontmap,
+ &face->logfontw,
+ win32font->size,
+ &win32font->logfontw);
cwfont->options = cairo_font_options_copy (_pango_cairo_context_get_merged_font_options (context));
* settings ask for it.
*/
if (font_smoothing &&
- (pango_win32_os_version_info.dwMajorVersion > 5 ||
- (pango_win32_os_version_info.dwMajorVersion == 5 &&
- pango_win32_os_version_info.dwMinorVersion >= 1)))
+ (_pango_win32_os_version_info.dwMajorVersion > 5 ||
+ (_pango_win32_os_version_info.dwMajorVersion == 5 &&
+ _pango_win32_os_version_info.dwMinorVersion >= 1)))
{
UINT smoothing_type;
typedef struct _PangoWin32Family PangoWin32Family;
typedef struct _PangoWin32SizeInfo PangoWin32SizeInfo;
-/* Number of freed fonts */
-#define MAX_FREED_FONTS 16
-
struct _PangoWin32Family
{
PangoFontFamily parent_instance;
#define PANGO_WIN32_FACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_WIN32_TYPE_FACE, PangoWin32Face))
#define PANGO_WIN32_IS_FACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_WIN32_TYPE_FACE))
-GType pango_win32_family_get_type (void);
-GType pango_win32_face_get_type (void);
+static GType pango_win32_face_get_type (void);
static void pango_win32_face_list_sizes (PangoFontFace *face,
int **sizes,
static PangoWin32FontMap *default_fontmap = NULL;
-G_DEFINE_TYPE (PangoWin32FontMap, pango_win32_font_map, PANGO_TYPE_FONT_MAP)
+G_DEFINE_TYPE (PangoWin32FontMap, _pango_win32_font_map, PANGO_TYPE_FONT_MAP)
#define TOLOWER(c) \
(((c) >= 'A' && (c) <= 'Z') ? (c) - 'A' + 'a' : (c))
lf = *lfp;
- EnumFontFamiliesExW (pango_win32_hdc, &lf,
+ EnumFontFamiliesExW (_pango_win32_hdc, &lf,
(FONTENUMPROCW) pango_win32_inner_enum_proc,
lParam, 0);
}
static void
-pango_win32_font_map_init (PangoWin32FontMap *win32fontmap)
+_pango_win32_font_map_init (PangoWin32FontMap *win32fontmap)
{
LOGFONTW logfont;
ItalicHelper helper = { win32fontmap, NULL };
memset (&logfont, 0, sizeof (logfont));
logfont.lfCharSet = DEFAULT_CHARSET;
- EnumFontFamiliesExW (pango_win32_hdc, &logfont,
+ EnumFontFamiliesExW (_pango_win32_hdc, &logfont,
(FONTENUMPROCW) pango_win32_enum_proc,
(LPARAM) win32fontmap, 0);
}
g_slist_free (helper.list);
- win32fontmap->resolution = (PANGO_SCALE / (double) GetDeviceCaps (pango_win32_hdc, LOGPIXELSY)) * 72.0;
+ win32fontmap->resolution = (PANGO_SCALE / (double) GetDeviceCaps (_pango_win32_hdc, LOGPIXELSY)) * 72.0;
}
static void
-pango_win32_font_map_class_init (PangoWin32FontMapClass *class)
+_pango_win32_font_map_class_init (PangoWin32FontMapClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
PangoFontMapClass *fontmap_class = PANGO_FONT_MAP_CLASS (class);
pango_win32_font_cache_free (win32fontmap->font_cache);
- G_OBJECT_CLASS (pango_win32_font_map_parent_class)->finalize (object);
+ G_OBJECT_CLASS (_pango_win32_font_map_parent_class)->finalize (object);
}
/*
class->is_monospace = pango_win32_family_is_monospace;
}
-GType
+static GType
pango_win32_family_get_type (void)
{
static GType object_type = 0;
return result;
}
+static PangoWin32Font *
+pango_win32_font_neww (PangoFontMap *fontmap,
+ const LOGFONTW *lfp,
+ int size)
+{
+ PangoWin32Font *result;
+
+ g_return_val_if_fail (fontmap != NULL, NULL);
+ g_return_val_if_fail (lfp != NULL, NULL);
+
+ result = (PangoWin32Font *)g_object_new (PANGO_TYPE_WIN32_FONT, NULL);
+
+ result->fontmap = fontmap;
+ g_object_ref (fontmap);
+
+ result->size = size;
+ _pango_win32_make_matching_logfontw (fontmap, lfp, size, &result->logfontw);
+
+ return result;
+}
+
static PangoFont *
pango_win32_font_map_real_find_font (PangoWin32FontMap *win32fontmap,
PangoContext *context,
g_object_ref (win32font);
if (win32font->in_cache)
- pango_win32_fontmap_cache_remove (fontmap, win32font);
+ _pango_win32_fontmap_cache_remove (fontmap, win32font);
return (PangoFont *)win32font;
}
if ((hfont = CreateFontIndirect (lfp)) == NULL)
goto fail0;
- if ((oldhfont = SelectObject (pango_win32_hdc, hfont)) == NULL)
+ if ((oldhfont = SelectObject (_pango_win32_hdc, hfont)) == NULL)
goto fail1;
- if (!pango_win32_get_name_header (pango_win32_hdc, &header))
+ if (!_pango_win32_get_name_header (_pango_win32_hdc, &header))
goto fail2;
PING (("%d name records", header.num_records));
for (i = 0; i < header.num_records; i++)
{
- if (!pango_win32_get_name_record (pango_win32_hdc, i, &record))
+ if (!_pango_win32_get_name_record (_pango_win32_hdc, i, &record))
goto fail2;
if ((record.name_id != 1 && record.name_id != 16) || record.string_length <= 0)
else
goto fail2;
- if (!pango_win32_get_name_record (pango_win32_hdc, name_ix, &record))
+ if (!_pango_win32_get_name_record (_pango_win32_hdc, name_ix, &record))
goto fail2;
string = g_malloc (record.string_length + 1);
- if (GetFontData (pango_win32_hdc, NAME,
+ if (GetFontData (_pango_win32_hdc, NAME,
header.string_storage_offset + record.string_offset,
string, record.string_length) != record.string_length)
goto fail2;
PING(("%s", name));
- SelectObject (pango_win32_hdc, oldhfont);
+ SelectObject (_pango_win32_hdc, oldhfont);
DeleteObject (hfont);
return name;
fail2:
g_free (string);
- SelectObject (pango_win32_hdc, oldhfont);
+ SelectObject (_pango_win32_hdc, oldhfont);
fail1:
DeleteObject (hfont);
if ((hfont = CreateFontIndirectW (lfp)) == NULL)
goto fail0;
- if ((oldhfont = SelectObject (pango_win32_hdc, hfont)) == NULL)
+ if ((oldhfont = SelectObject (_pango_win32_hdc, hfont)) == NULL)
goto fail1;
- if (!pango_win32_get_name_header (pango_win32_hdc, &header))
+ if (!_pango_win32_get_name_header (_pango_win32_hdc, &header))
goto fail2;
PING (("%d name records", header.num_records));
for (i = 0; i < header.num_records; i++)
{
- if (!pango_win32_get_name_record (pango_win32_hdc, i, &record))
+ if (!_pango_win32_get_name_record (_pango_win32_hdc, i, &record))
goto fail2;
if ((record.name_id != 1 && record.name_id != 16) || record.string_length <= 0)
else
goto fail2;
- if (!pango_win32_get_name_record (pango_win32_hdc, name_ix, &record))
+ if (!_pango_win32_get_name_record (_pango_win32_hdc, name_ix, &record))
goto fail2;
string = g_malloc (record.string_length + 1);
- if (GetFontData (pango_win32_hdc, NAME,
+ if (GetFontData (_pango_win32_hdc, NAME,
header.string_storage_offset + record.string_offset,
string, record.string_length) != record.string_length)
goto fail2;
PING(("%s", name));
- SelectObject (pango_win32_hdc, oldhfont);
+ SelectObject (_pango_win32_hdc, oldhfont);
DeleteObject (hfont);
return name;
fail2:
g_free (string);
- SelectObject (pango_win32_hdc, oldhfont);
+ SelectObject (_pango_win32_hdc, oldhfont);
fail1:
DeleteObject (hfont);
* an installed font.
*/
void
-pango_win32_make_matching_logfontw (PangoFontMap *fontmap,
- const LOGFONTW *lfp,
- int size,
- LOGFONTW *out)
+_pango_win32_make_matching_logfontw (PangoFontMap *fontmap,
+ const LOGFONTW *lfp,
+ int size,
+ LOGFONTW *out)
{
PangoWin32FontMap *win32fontmap;
GSList *tmp_list;
*out = *lfp; /* Whatever. We need to pass something... */
}
-gint
-pango_win32_coverage_language_classify (PangoLanguage *lang)
-{
- if (pango_language_matches (lang, "zh-tw"))
- return PANGO_WIN32_COVERAGE_ZH_TW;
- else if (pango_language_matches (lang, "zh-cn"))
- return PANGO_WIN32_COVERAGE_ZH_CN;
- else if (pango_language_matches (lang, "ja"))
- return PANGO_WIN32_COVERAGE_JA;
- else if (pango_language_matches (lang, "ko"))
- return PANGO_WIN32_COVERAGE_KO;
- else if (pango_language_matches (lang, "vi"))
- return PANGO_WIN32_COVERAGE_VI;
- else
- return PANGO_WIN32_COVERAGE_UNSPEC;
-}
-
-void
-pango_win32_font_entry_set_coverage (PangoWin32Face *face,
- PangoCoverage *coverage,
- PangoLanguage *lang)
-{
- face->coverages[pango_win32_coverage_language_classify (lang)] = pango_coverage_ref (coverage);
-}
-
static PangoFontDescription *
pango_win32_face_describe (PangoFontFace *face)
{
*n_sizes = 0;
}
-GType
+static GType
pango_win32_face_get_type (void)
{
static GType object_type = 0;
if (!object_type)
{
- const GTypeInfo object_info =
+ static const GTypeInfo object_info =
{
- sizeof (PangoFontFaceClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) pango_win32_face_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (PangoWin32Face),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
+ sizeof (PangoFontFaceClass),
+ (GBaseInitFunc) NULL,
+ (GBaseFinalizeFunc) NULL,
+ (GClassInitFunc) pango_win32_face_class_init,
+ NULL, /* class_finalize */
+ NULL, /* class_data */
+ sizeof (PangoWin32Face),
+ 0, /* n_preallocs */
+ (GInstanceInitFunc) NULL,
};
-
+
object_type = g_type_register_static (PANGO_TYPE_FONT_FACE,
- I_("PangoWin32Face"),
- &object_info, 0);
+ I_("PangoWin32Face"),
+ &object_info, 0);
}
-
+
return object_type;
}
-PangoCoverage *
-pango_win32_font_entry_get_coverage (PangoWin32Face *face,
- PangoLanguage *lang)
-{
- gint i = pango_win32_coverage_language_classify (lang);
- if (face->coverages[i])
- {
- pango_coverage_ref (face->coverages[i]);
- return face->coverages[i];
- }
-
- return NULL;
-}
-
-void
-pango_win32_font_entry_remove (PangoWin32Face *face,
- PangoFont *font)
-{
- face->cached_fonts = g_slist_remove (face->cached_fonts, font);
-}
-
/**
* pango_win32_font_map_get_font_cache:
* @font_map: a #PangoWin32FontMap.
}
void
-pango_win32_fontmap_cache_add (PangoFontMap *fontmap,
- PangoWin32Font *win32font)
-{
- PangoWin32FontMap *win32fontmap = PANGO_WIN32_FONT_MAP (fontmap);
-
- if (win32fontmap->freed_fonts->length == MAX_FREED_FONTS)
- {
- PangoWin32Font *old_font = g_queue_pop_tail (win32fontmap->freed_fonts);
- g_object_unref (old_font);
- }
-
- g_object_ref (win32font);
- g_queue_push_head (win32fontmap->freed_fonts, win32font);
- win32font->in_cache = TRUE;
-}
-
-void
-pango_win32_fontmap_cache_remove (PangoFontMap *fontmap,
- PangoWin32Font *win32font)
+_pango_win32_fontmap_cache_remove (PangoFontMap *fontmap,
+ PangoWin32Font *win32font)
{
PangoWin32FontMap *win32fontmap = PANGO_WIN32_FONT_MAP (fontmap);
GList *link = g_queue_find (win32fontmap->freed_fonts, win32font);
#ifdef PANGO_WIN32_DEBUGGING
#ifdef __GNUC__
#define PING(printlist) \
-(pango_win32_debug ? \
+(_pango_win32_debug ? \
(g_print ("%s:%d ", __PRETTY_FUNCTION__, __LINE__), \
g_print printlist, \
g_print ("\n"), \
0)
#else
#define PING(printlist) \
-(pango_win32_debug ? \
+(_pango_win32_debug ? \
(g_print ("%s:%d ", __FILE__, __LINE__), \
g_print printlist, \
g_print ("\n"), \
PANGO_WIN32_N_COVERAGES
} PangoWin32CoverageLanguageClass;
-#define PANGO_TYPE_WIN32_FONT_MAP (pango_win32_font_map_get_type ())
+#define PANGO_TYPE_WIN32_FONT_MAP (_pango_win32_font_map_get_type ())
#define PANGO_WIN32_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_WIN32_FONT_MAP, PangoWin32FontMap))
#define PANGO_WIN32_IS_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_WIN32_FONT_MAP))
#define PANGO_WIN32_FONT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_WIN32_FONT_MAP, PangoWin32FontMapClass))
#define PANGO_IS_WIN32_FONT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_WIN32_FONT_MAP))
#define PANGO_WIN32_FONT_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_WIN32_FONT_MAP, PangoWin32FontMapClass))
-#define PANGO_TYPE_WIN32_FONT (pango_win32_font_get_type ())
+#define PANGO_TYPE_WIN32_FONT (_pango_win32_font_get_type ())
#define PANGO_WIN32_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_WIN32_FONT, PangoWin32Font))
#define PANGO_WIN32_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_WIN32_FONT, PangoWin32FontClass))
#define PANGO_WIN32_IS_FONT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_WIN32_FONT))
guint16 string_offset;
};
-GType pango_win32_font_get_type (void);
+GType _pango_win32_font_get_type (void);
-PangoWin32Font *pango_win32_font_neww (PangoFontMap *fontmap,
- const LOGFONTW *lfp,
- int size);
-PangoMap * pango_win32_get_shaper_map (PangoLanguage *lang);
-void pango_win32_make_matching_logfontw (PangoFontMap *fontmap,
+void _pango_win32_make_matching_logfontw (PangoFontMap *fontmap,
const LOGFONTW *lfp,
int size,
LOGFONTW *out);
-PangoCoverage * pango_win32_font_entry_get_coverage (PangoWin32Face *face,
- PangoLanguage *lang);
-void pango_win32_font_entry_set_coverage (PangoWin32Face *face,
- PangoCoverage *coverage,
- PangoLanguage *lang);
-void pango_win32_font_entry_remove (PangoWin32Face *face,
- PangoFont *font);
-GType pango_win32_font_map_get_type (void);
+GType _pango_win32_font_map_get_type (void);
-void pango_win32_fontmap_cache_add (PangoFontMap *fontmap,
- PangoWin32Font *xfont);
-void pango_win32_fontmap_cache_remove (PangoFontMap *fontmap,
+void _pango_win32_fontmap_cache_remove (PangoFontMap *fontmap,
PangoWin32Font *xfont);
-gint pango_win32_coverage_language_classify (PangoLanguage *lang);
-
-gboolean pango_win32_get_name_header (HDC hdc,
+gboolean _pango_win32_get_name_header (HDC hdc,
struct name_header *header);
-gboolean pango_win32_get_name_record (HDC hdc,
+gboolean _pango_win32_get_name_record (HDC hdc,
gint i,
struct name_record *record);
-extern HDC pango_win32_hdc;
-extern OSVERSIONINFO pango_win32_os_version_info;
-extern gboolean pango_win32_debug;
+extern HDC _pango_win32_hdc;
+extern OSVERSIONINFO _pango_win32_os_version_info;
+extern gboolean _pango_win32_debug;
#endif /* __PANGOWIN32_PRIVATE_H__ */
#include "pangowin32.h"
#include "pangowin32-private.h"
+#define MAX_FREED_FONTS 16
+
#define CH_IS_UNIHAN_BMP(ch) ((ch) >= 0x3400 && (ch) <= 0x9FFF)
#define CH_IS_UNIHAN(ch) (CH_IS_UNIHAN_BMP (ch) || \
((ch) >= 0x20000 && (ch) <= 0x2A6DF) || \
((ch) >= 0x2F800 && (ch) <= 0x2FA1F))
-HDC pango_win32_hdc;
-OSVERSIONINFO pango_win32_os_version_info;
-gboolean pango_win32_debug = FALSE;
+HDC _pango_win32_hdc;
+OSVERSIONINFO _pango_win32_os_version_info;
+gboolean _pango_win32_debug = FALSE;
static void pango_win32_font_dispose (GObject *object);
static void pango_win32_font_finalize (GObject *object);
return NULL;
}
- SelectObject (pango_win32_hdc, win32font->hfont);
- GetTextMetrics (pango_win32_hdc, &tm);
+ SelectObject (_pango_win32_hdc, win32font->hfont);
+ GetTextMetrics (_pango_win32_hdc, &tm);
win32font->tm_overhang = tm.tmOverhang;
win32font->tm_descent = tm.tmDescent;
return result;
}
-G_DEFINE_TYPE (PangoWin32Font, pango_win32_font, PANGO_TYPE_FONT)
+G_DEFINE_TYPE (PangoWin32Font, _pango_win32_font, PANGO_TYPE_FONT)
static void
-pango_win32_font_init (PangoWin32Font *win32font)
+_pango_win32_font_init (PangoWin32Font *win32font)
{
win32font->size = -1;
HDC
pango_win32_get_dc (void)
{
- if (pango_win32_hdc == NULL)
+ if (_pango_win32_hdc == NULL)
{
- pango_win32_hdc = CreateDC ("DISPLAY", NULL, NULL, NULL);
- memset (&pango_win32_os_version_info, 0,
- sizeof (pango_win32_os_version_info));
- pango_win32_os_version_info.dwOSVersionInfoSize =
+ _pango_win32_hdc = CreateDC ("DISPLAY", NULL, NULL, NULL);
+ memset (&_pango_win32_os_version_info, 0,
+ sizeof (_pango_win32_os_version_info));
+ _pango_win32_os_version_info.dwOSVersionInfoSize =
sizeof (OSVERSIONINFO);
- GetVersionEx (&pango_win32_os_version_info);
+ GetVersionEx (&_pango_win32_os_version_info);
/* Also do some generic pangowin32 initialisations... this function
* is a suitable place for those as it is called from a couple
*/
#ifdef PANGO_WIN32_DEBUGGING
if (getenv ("PANGO_WIN32_DEBUG") != NULL)
- pango_win32_debug = TRUE;
+ _pango_win32_debug = TRUE;
#endif
}
- return pango_win32_hdc;
+ return _pango_win32_hdc;
}
/**
gboolean
pango_win32_get_debug_flag (void)
{
- return pango_win32_debug;
+ return _pango_win32_debug;
}
static void
-pango_win32_font_class_init (PangoWin32FontClass *class)
+_pango_win32_font_class_init (PangoWin32FontClass *class)
{
GObjectClass *object_class = G_OBJECT_CLASS (class);
PangoFontClass *font_class = PANGO_FONT_CLASS (class);
pango_win32_get_dc ();
}
-PangoWin32Font *
-pango_win32_font_neww (PangoFontMap *fontmap,
- const LOGFONTW *lfp,
- int size)
-{
- PangoWin32Font *result;
-
- g_return_val_if_fail (fontmap != NULL, NULL);
- g_return_val_if_fail (lfp != NULL, NULL);
-
- result = (PangoWin32Font *)g_object_new (PANGO_TYPE_WIN32_FONT, NULL);
-
- result->fontmap = fontmap;
- g_object_ref (fontmap);
-
- result->size = size;
- pango_win32_make_matching_logfontw (fontmap, lfp, size, &result->logfontw);
-
- return result;
-}
-
/**
* pango_win32_render:
* @hdc: the device context
g_return_if_fail (glyphs != NULL);
#ifdef PANGO_WIN32_DEBUGGING
- if (pango_win32_debug)
+ if (_pango_win32_debug)
{
PING (("num_glyphs:%d", glyphs->num_glyphs));
for (i = 0; i < glyphs->num_glyphs; i++)
i++;
}
#ifdef PANGO_WIN32_DEBUGGING
- if (pango_win32_debug)
+ if (_pango_win32_debug)
{
g_print ("ExtTextOutW at %d,%d deltas:",
x + PANGO_PIXELS (start_x_offset),
memset (&gm, 0, sizeof (gm));
hfont = pango_win32_get_hfont (font);
- SelectObject (pango_win32_hdc, hfont);
- /* FIXME: (Alex) This constant reuse of pango_win32_hdc is
+ SelectObject (_pango_win32_hdc, hfont);
+ /* FIXME: (Alex) This constant reuse of _pango_win32_hdc is
not thread-safe */
- res = GetGlyphOutlineA (pango_win32_hdc,
+ res = GetGlyphOutlineA (_pango_win32_hdc,
glyph_index,
GGO_METRICS | GGO_GLYPH_INDEX,
&gm,
PangoCoverage *coverage;
TEXTMETRIC tm;
- SelectObject (pango_win32_hdc, hfont);
- GetTextMetrics (pango_win32_hdc, &tm);
+ SelectObject (_pango_win32_hdc, hfont);
+ GetTextMetrics (_pango_win32_hdc, &tm);
metrics->ascent = tm.tmAscent * PANGO_SCALE;
metrics->descent = tm.tmDescent * PANGO_SCALE;
}
static void
+pango_win32_fontmap_cache_add (PangoFontMap *fontmap,
+ PangoWin32Font *win32font)
+{
+ PangoWin32FontMap *win32fontmap = PANGO_WIN32_FONT_MAP (fontmap);
+
+ if (win32fontmap->freed_fonts->length == MAX_FREED_FONTS)
+ {
+ PangoWin32Font *old_font = g_queue_pop_tail (win32fontmap->freed_fonts);
+ g_object_unref (old_font);
+ }
+
+ g_object_ref (win32font);
+ g_queue_push_head (win32fontmap->freed_fonts, win32font);
+ win32font->in_cache = TRUE;
+}
+
+static void
pango_win32_font_dispose (GObject *object)
{
PangoWin32Font *win32font = PANGO_WIN32_FONT (object);
if (!win32font->in_cache && win32font->fontmap)
pango_win32_fontmap_cache_add (win32font->fontmap, win32font);
- G_OBJECT_CLASS (pango_win32_font_parent_class)->dispose (object);
+ G_OBJECT_CLASS (_pango_win32_font_parent_class)->dispose (object);
}
static void
}
static void
+pango_win32_font_entry_remove (PangoWin32Face *face,
+ PangoFont *font)
+{
+ face->cached_fonts = g_slist_remove (face->cached_fonts, font);
+}
+
+static void
pango_win32_font_finalize (GObject *object)
{
PangoWin32Font *win32font = (PangoWin32Font *)object;
g_object_unref (win32font->fontmap);
- G_OBJECT_CLASS (pango_win32_font_parent_class)->finalize (object);
+ G_OBJECT_CLASS (_pango_win32_font_parent_class)->finalize (object);
}
static PangoFontDescription *
return desc;
}
-PangoMap *
+static PangoMap *
pango_win32_get_shaper_map (PangoLanguage *lang)
{
static guint engine_type_id = 0;
return pango_find_map (lang, engine_type_id, render_type_id);
}
+static gint
+pango_win32_coverage_language_classify (PangoLanguage *lang)
+{
+ if (pango_language_matches (lang, "zh-tw"))
+ return PANGO_WIN32_COVERAGE_ZH_TW;
+ else if (pango_language_matches (lang, "zh-cn"))
+ return PANGO_WIN32_COVERAGE_ZH_CN;
+ else if (pango_language_matches (lang, "ja"))
+ return PANGO_WIN32_COVERAGE_JA;
+ else if (pango_language_matches (lang, "ko"))
+ return PANGO_WIN32_COVERAGE_KO;
+ else if (pango_language_matches (lang, "vi"))
+ return PANGO_WIN32_COVERAGE_VI;
+ else
+ return PANGO_WIN32_COVERAGE_UNSPEC;
+}
+
+static PangoCoverage *
+pango_win32_font_entry_get_coverage (PangoWin32Face *face,
+ PangoLanguage *lang)
+{
+ gint i = pango_win32_coverage_language_classify (lang);
+ if (face->coverages[i])
+ {
+ pango_coverage_ref (face->coverages[i]);
+ return face->coverages[i];
+ }
+
+ return NULL;
+}
+
+static void
+pango_win32_font_entry_set_coverage (PangoWin32Face *face,
+ PangoCoverage *coverage,
+ PangoLanguage *lang)
+{
+ face->coverages[pango_win32_coverage_language_classify (lang)] = pango_coverage_ref (coverage);
+}
+
static PangoCoverage *
pango_win32_font_get_coverage (PangoFont *font,
PangoLanguage *lang)
if (win32font->win32face->cmap)
return win32font->win32face->cmap;
- pango_win32_font_select_font (font, pango_win32_hdc);
+ pango_win32_font_select_font (font, _pango_win32_hdc);
/* Prefer the format 12 cmap */
- if ((cmap = get_format_12_cmap (pango_win32_hdc)) != NULL)
+ if ((cmap = get_format_12_cmap (_pango_win32_hdc)) != NULL)
{
win32font->win32face->cmap_format = 12;
win32font->win32face->cmap = cmap;
}
- else if ((cmap = get_format_4_cmap (pango_win32_hdc)) != NULL)
+ else if ((cmap = get_format_4_cmap (_pango_win32_hdc)) != NULL)
{
win32font->win32face->cmap_format = 4;
win32font->win32face->cmap = cmap;
}
gboolean
-pango_win32_get_name_header (HDC hdc,
- struct name_header *header)
+_pango_win32_get_name_header (HDC hdc,
+ struct name_header *header)
{
if (GetFontData (hdc, NAME, 0, header, sizeof (*header)) != sizeof (*header))
return FALSE;
}
gboolean
-pango_win32_get_name_record (HDC hdc,
- gint i,
- struct name_record *record)
+_pango_win32_get_name_record (HDC hdc,
+ gint i,
+ struct name_record *record)
{
if (GetFontData (hdc, NAME, 6 + i * sizeof (*record),
record, sizeof (*record)) != sizeof (*record))
return TRUE;
hfont = pango_win32_get_hfont (font);
- oldhfont = SelectObject (pango_win32_hdc, hfont);
+ oldhfont = SelectObject (_pango_win32_hdc, hfont);
- if (!pango_win32_get_name_header (pango_win32_hdc, &header))
+ if (!_pango_win32_get_name_header (_pango_win32_hdc, &header))
{
- SelectObject (pango_win32_hdc, oldhfont);
+ SelectObject (_pango_win32_hdc, oldhfont);
return FALSE;
}
for (i = 0; i < header.num_records; i++)
{
- if (!pango_win32_get_name_record (pango_win32_hdc, i, &record))
+ if (!_pango_win32_get_name_record (_pango_win32_hdc, i, &record))
{
- SelectObject (pango_win32_hdc, oldhfont);
+ SelectObject (_pango_win32_hdc, oldhfont);
return FALSE;
}
}
}
- SelectObject (pango_win32_hdc, oldhfont);
+ SelectObject (_pango_win32_hdc, oldhfont);
return retval;
}
if (id_range_offset[i] == 0)
{
#ifdef PANGO_WIN32_DEBUGGING
- if (pango_win32_debug)
+ if (_pango_win32_debug)
{
if (end_count[i] == start_count[i])
g_print ("%04x ", start_count[i]);
#ifdef PANGO_WIN32_DEBUGGING
else if (ch0 < G_MAXUINT)
{
- if (pango_win32_debug)
+ if (_pango_win32_debug)
{
if (ch > ch0 + 2)
g_print ("%04x:%04x ", ch0, ch - 1);
#ifdef PANGO_WIN32_DEBUGGING
if (ch0 < G_MAXUINT)
{
- if (pango_win32_debug)
+ if (_pango_win32_debug)
{
if (ch > ch0 + 2)
g_print ("%04x:%04x ", ch0, ch - 1);
for (i = 0; i < cmap12->count; i++)
{
#ifdef PANGO_WIN32_DEBUGGING
- if (pango_win32_debug)
+ if (_pango_win32_debug)
{
if (cmap12->groups[i*3+0] == cmap12->groups[i*3+1])
g_print ("%04x ", cmap12->groups[i*3+0]);
else
g_assert_not_reached ();
#ifdef PANGO_WIN32_DEBUGGING
- if (pango_win32_debug)
+ if (_pango_win32_debug)
g_print ("\n");
#endif
}
EXPORTS
+ _pango_win32_fontmap_cache_remove
+ _pango_win32_make_matching_logfontw
+ _pango_win32_font_get_type
+ _pango_win32_font_map_get_type
pango_win32_font_cache_free
pango_win32_font_cache_load
pango_win32_font_cache_loadw
pango_win32_font_cache_unload
pango_win32_font_description_from_logfont
pango_win32_font_description_from_logfontw
- pango_win32_font_entry_get_coverage
- pango_win32_font_entry_remove
pango_win32_font_get_glyph_index
- pango_win32_font_get_type
+ pango_win32_font_logfont
pango_win32_font_logfont
pango_win32_font_map_for_display
pango_win32_font_map_get_font_cache
- pango_win32_font_map_get_type
- pango_win32_font_neww
- pango_win32_font_logfont
- pango_win32_font_done_font
- pango_win32_font_get_metrics_factor
- pango_win32_font_select_font
- pango_win32_fontmap_cache_add
- pango_win32_fontmap_cache_remove
pango_win32_get_context
pango_win32_get_dc
pango_win32_get_debug_flag
- pango_win32_get_shaper_map
pango_win32_get_unknown_glyph
- pango_win32_make_matching_logfontw
pango_win32_render
pango_win32_render_layout
pango_win32_render_layout_line
pango_win32_render_transformed
pango_win32_shutdown_display
-
+ pango_win32_font_done_font
+ pango_win32_font_get_metrics_factor
+ pango_win32_font_select_font