summaryrefslogtreecommitdiff
path: root/pango/pangowin32-private.h
diff options
context:
space:
mode:
authorTor Lillqvist <tml@iki.fi>2002-09-21 11:28:59 +0000
committerTor Lillqvist <tml@src.gnome.org>2002-09-21 11:28:59 +0000
commitc418148dcb0964ac602c7f6104d24e51df07d813 (patch)
tree829ddccbbe912cbff4b5e46d1759dfcb209e9875 /pango/pangowin32-private.h
parent162c80f96a88224bd11097c1a421a0d01371c4e8 (diff)
downloadpango-c418148dcb0964ac602c7f6104d24e51df07d813.tar.gz
Distribute specifically pango.aliases and pango.modules, not the whole
2002-09-21 Tor Lillqvist <tml@iki.fi> * pango-zip.sh.in: Distribute specifically pango.aliases and pango.modules, not the whole etc/pango which might contain editor backup files. * pango/pangowin32-private.h * pango/pangowin32*.c: Rename DEBUGGING to PANGO_WIN32_DEBUGGING. Use plain printf instrad of g_print in the PING macro for debugging output (to avoid UTF-8 requirement). * pango/pangowin32.h: Guard against redefinition of _WIN32_WINNT. * pango/pangowin32-private.h: Remove the FS_VIETNAMESE define, not needed. Rename PangoWin32Font::face to win32face. Add enum PangoWin32CoverageLanguageClass, used to classify PangoLanguages that might have locale-specific coverage of fonts (i.e. CJKV). Change PangoWin32Face::coverage into an array, coverages. Move some TrueType macro and struct defines from pangowin32.c here. Rename them a bit to match the names used in the specs better. Add declarations for new functions (see below). * pango/pangowin32.c (pango_win32_get_hfont): Convert LOGFONT::lfFaceName to UTF-8 before printing. (pango_win32_render): Revert the change from 2002-09-05. Characters not in a font are supposed to show up at this stage as invalid glyphs (usually a box). It's up to the higher layers to filter out TABs and other characters that shouldn't be visible. (pango_win32_get_name_header, pango_win32_get_name_record): New functions, to read the name table header and records from a TrueType font. (font_name_in): New function, checks if a font has a name in one of the spoecial-case languages, or actually locales (zh_TW, zh_CN, ja, ko, vi). Checks the TrueType name table. (pango_win32_font_calc_coverage): Take a PangoLanguage parameter, too. Use it to decide whether to hide the Unified CJKV Ideographs block in case the font is not for the specified locale. If so, the coverage for these characters is set to PANGO_COVERAGE_APPROXIMATE. * pango/pangowin32-fontmap.c: Remove PangoWin32FontMap::faces, unused. Remove dead _WE_WANT_GLOBAL_ALIASES_ code. Rename parent_class to font_map_parent_class to match pangox-fontmap.c. (get_family_name, get_family_name_lowercase): New functions. Search for an English name for a TrueType font, in case the font name in LOGFONT::lfFaceName is non-ASCII. (Can one assume that if it is ASCII, it is the English name? Do some TrueType fonts have different names in French, German, etc, and does the system return these if the locale is set to use French, German, etc?) (pango_win32_insert_font): Don't store LOGFONTs that differ only in charset. What charset we specify when calling CreateFontIndirect() is irrelevant, as we are going to use ExtTextOutW() anyway, i.e. Unicode. Use the English family name from get_family_name_lowercase(), not the one returned in the LOGFONT from font enumeration. Bypass the code that sets up the mapping for monospace, serif and sans, and the recignition of plain "courier" for "courier new". We need a pango.aliases anyhow, so let it handle that. (pango_win32_coverage_language_classify): New function. (pango_win32_font_entry_set_coverage, pango_win32_font_entry_get_coverage): Take also a PangoLanguage parameter, use the corresponding entry in the PangoWin32Face::coverages array. * pango/pango-utils.c (pango_get_lib_subdirectory, pango_get_sysconf_subdirectory): Fix doc comment on Win32 behaviour.
Diffstat (limited to 'pango/pangowin32-private.h')
-rw-r--r--pango/pangowin32-private.h140
1 files changed, 109 insertions, 31 deletions
diff --git a/pango/pangowin32-private.h b/pango/pangowin32-private.h
index f0d21914..dc1f5faa 100644
--- a/pango/pangowin32-private.h
+++ b/pango/pangowin32-private.h
@@ -2,7 +2,7 @@
* pangowin32-private.h:
*
* Copyright (C) 1999 Red Hat Software
- * Copyright (C) 2000 Tor Lillqvist
+ * Copyright (C) 2000-2002 Tor Lillqvist
* Copyright (C) 2001 Alexander Larsson
*
* This library is free software; you can redistribute it and/or
@@ -24,30 +24,38 @@
#ifndef __PANGOWIN32_PRIVATE_H__
#define __PANGOWIN32_PRIVATE_H__
-#define DEBUGGING 0
+/* Define if you want copious debugging output. */
+/* #define PANGO_WIN32_DEBUGGING 1 */
-#if defined(DEBUGGING) && DEBUGGING
+#ifdef PANGO_WIN32_DEBUGGING
#ifdef __GNUC__
#define PING(printlist) \
-(g_print ("%s:%d ", __PRETTY_FUNCTION__, __LINE__), \
- g_print printlist, \
- g_print ("\n"))
+(printf ("%s:%d ", __PRETTY_FUNCTION__, __LINE__), \
+ printf printlist, \
+ printf ("\n"))
#else
#define PING(printlist) \
-(g_print ("%s:%d ", __FILE__, __LINE__), \
- g_print printlist, \
- g_print ("\n"))
+(printf ("%s:%d ", __FILE__, __LINE__), \
+ printf printlist, \
+ printf ("\n"))
#endif
-#else /* !DEBUGGING */
+#else /* !PANGO_WIN32_DEBUGGING */
#define PING(printlist)
#endif
#include "pango-modules.h"
#include "pangowin32.h"
-#ifndef FS_VIETNAMESE
-#define FS_VIETNAMESE 0x100
-#endif
+typedef enum
+ {
+ PANGO_WIN32_COVERAGE_UNSPEC,
+ PANGO_WIN32_COVERAGE_ZH_TW,
+ PANGO_WIN32_COVERAGE_ZH_CN,
+ PANGO_WIN32_COVERAGE_JA,
+ PANGO_WIN32_COVERAGE_KO,
+ PANGO_WIN32_COVERAGE_VI,
+ PANGO_WIN32_N_COVERAGES
+ } PangoWin32CoverageLanguageClass;
typedef struct _PangoWin32Font PangoWin32Font;
typedef struct _PangoWin32Face PangoWin32Face;
@@ -68,7 +76,7 @@ struct _PangoWin32Font
gint tm_descent;
gint tm_overhang;
- PangoWin32Face *entry;
+ PangoWin32Face *win32face;
/* If TRUE, font is in cache of recently unused fonts and not otherwise
* in use.
@@ -83,8 +91,7 @@ struct _PangoWin32Face
LOGFONT logfont;
PangoFontDescription *description;
- PangoCoverage *coverage;
-
+ PangoCoverage *coverages[PANGO_WIN32_N_COVERAGES];
char *face_name;
gpointer unicode_table;
@@ -99,24 +106,95 @@ struct _PangoWin32GlyphInfo
};
-PangoWin32Font *pango_win32_font_new (PangoFontMap *fontmap,
- const LOGFONT *lfp,
- int size);
-PangoMap * pango_win32_get_shaper_map (PangoLanguage *lang);
-void pango_win32_make_matching_logfont (PangoFontMap *fontmap,
- const LOGFONT *lfp,
- int size,
- LOGFONT *out);
-PangoCoverage * pango_win32_font_entry_get_coverage (PangoWin32Face *face);
+/* TrueType defines: */
+
+#define MAKE_TT_TABLE_NAME(c1, c2, c3, c4) \
+ (((guint32)c4) << 24 | ((guint32)c3) << 16 | ((guint32)c2) << 8 | ((guint32)c1))
+
+#define CMAP (MAKE_TT_TABLE_NAME('c','m','a','p'))
+#define CMAP_HEADER_SIZE 4
+
+#define NAME (MAKE_TT_TABLE_NAME('n','a','m','e'))
+#define NAME_HEADER_SIZE 6
+
+#define ENCODING_TABLE_SIZE 8
+
+#define APPLE_UNICODE_PLATFORM_ID 0
+#define MACINTOSH_PLATFORM_ID 1
+#define ISO_PLATFORM_ID 2
+#define MICROSOFT_PLATFORM_ID 3
+
+#define SYMBOL_ENCODING_ID 0
+#define UNICODE_ENCODING_ID 1
+#define UCS4_ENCODING_ID 10
+
+struct cmap_encoding_subtable
+{ /* Must be packed! */
+ guint16 platform_id;
+ guint16 encoding_id;
+ guint32 offset;
+};
+
+struct type_4_cmap
+{ /* Must be packed! */
+ guint16 format;
+ guint16 length;
+ guint16 language;
+ guint16 seg_count_x_2;
+ guint16 search_range;
+ guint16 entry_selector;
+ guint16 range_shift;
+
+ guint16 reserved;
+
+ guint16 arrays[1];
+};
+
+struct name_header
+{
+ guint16 format_selector;
+ guint16 num_records;
+ guint16 string_storage_offset;
+};
+
+struct name_record
+{
+ guint16 platform_id;
+ guint16 encoding_id;
+ guint16 language_id;
+ guint16 name_id;
+ guint16 string_length;
+ guint16 string_offset;
+};
+
+PangoWin32Font *pango_win32_font_new (PangoFontMap *fontmap,
+ const LOGFONT *lfp,
+ int size);
+PangoMap * pango_win32_get_shaper_map (PangoLanguage *lang);
+void pango_win32_make_matching_logfont (PangoFontMap *fontmap,
+ const LOGFONT *lfp,
+ int size,
+ LOGFONT *out);
+PangoCoverage * pango_win32_font_entry_get_coverage (PangoWin32Face *face,
+ PangoLanguage *lang);
void pango_win32_font_entry_set_coverage (PangoWin32Face *face,
- PangoCoverage *coverage);
+ PangoCoverage *coverage,
+ PangoLanguage *lang);
void pango_win32_font_entry_remove (PangoWin32Face *face,
- PangoFont *font);
+ PangoFont *font);
+
+void pango_win32_fontmap_cache_add (PangoFontMap *fontmap,
+ PangoWin32Font *xfont);
+void pango_win32_fontmap_cache_remove (PangoFontMap *fontmap,
+ PangoWin32Font *xfont);
+
+gint pango_win32_coverage_language_classify (PangoLanguage *lang);
-void pango_win32_fontmap_cache_add (PangoFontMap *fontmap,
- PangoWin32Font *xfont);
-void pango_win32_fontmap_cache_remove (PangoFontMap *fontmap,
- PangoWin32Font *xfont);
+gboolean pango_win32_get_name_header (HDC hdc,
+ struct name_header *header);
+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;