summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2012-08-16 21:48:50 -0400
committerBehdad Esfahbod <behdad@behdad.org>2012-08-16 22:02:41 -0400
commit194b6ee552318ec6c494f34ed9f0979d0460fe4f (patch)
treeaf5b939f4750a4208b58c06b71fe09cdefa144f0
parent8168660e5f1906aed2a45d30529058f51473bcef (diff)
downloadpango-194b6ee552318ec6c494f34ed9f0979d0460fe4f.tar.gz
Remove PangoX
Been overdue...
-rw-r--r--Makefile.am6
-rw-r--r--configure.in22
-rw-r--r--docs/pango-sections.txt34
-rw-r--r--docs/tmpl/fonts.sgml9
-rw-r--r--docs/tmpl/glyphs.sgml19
-rw-r--r--docs/tmpl/layout.sgml6
-rw-r--r--docs/tmpl/main.sgml4
-rw-r--r--docs/tmpl/tab-stops.sgml2
-rw-r--r--docs/tmpl/text-attributes.sgml3
-rw-r--r--modules/basic/Makefile.am18
-rw-r--r--modules/basic/basic-x.c720
-rw-r--r--pango-view/Makefile.am13
-rw-r--r--pango-view/viewer-pangox.c122
-rw-r--r--pango/Makefile.am56
-rw-r--r--pango/pangox-fontcache.c249
-rw-r--r--pango/pangox-fontmap.c1628
-rw-r--r--pango/pangox-private.h127
-rw-r--r--pango/pangox.aliases220
-rw-r--r--pango/pangox.c1790
-rw-r--r--pango/pangox.def36
-rw-r--r--pango/pangox.h152
-rw-r--r--pango/pangox.rc.in30
-rw-r--r--pangox.pc.in11
23 files changed, 9 insertions, 5268 deletions
diff --git a/Makefile.am b/Makefile.am
index b0b56ec6..1ac018a3 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,13 +6,11 @@ EXTRA_DIST = \
autogen.sh \
pango.pc.in \
pangocairo.pc.in \
- pangox.pc.in \
pangoxft.pc.in \
pangoft2.pc.in \
pangowin32.pc.in \
pango-uninstalled.pc.in \
pangocairo-uninstalled.pc.in \
- pangox-uninstalled.pc.in \
pangoxft-uninstalled.pc.in \
pangoft2-uninstalled.pc.in \
pangowin32-uninstalled.pc.in \
@@ -84,10 +82,6 @@ if HAVE_CAIRO
pkgconfig_DATA += pangocairo.pc
endif
-if HAVE_X
-pkgconfig_DATA += pangox.pc
-endif
-
if HAVE_XFT
pkgconfig_DATA += pangoxft.pc
endif
diff --git a/configure.in b/configure.in
index fc5a0f76..90ed3c46 100644
--- a/configure.in
+++ b/configure.in
@@ -225,21 +225,6 @@ AC_ARG_ENABLE(rebuilds,
AM_CONDITIONAL(CROSS_COMPILING, [test $cross_compiling = yes])
-have_x=false
-if test "x$pango_os_win32" != xyes; then
- AC_PATH_XTRA
-
- if test x$no_x = xyes ; then
- AC_MSG_WARN([X development libraries not found])
- have_x=false
- else
- X_LIBS="$X_LIBS -lX11"
- have_x=true
- AC_DEFINE(HAVE_X, 1, [Have X libraries])
- fi
-fi
-AM_CONDITIONAL(HAVE_X, $have_x)
-
have_fontconfig=false
have_freetype=false
have_xft=false
@@ -268,7 +253,7 @@ AM_CONDITIONAL(HAVE_FREETYPE, $have_freetype)
#
# Checks for Xft/XRender
#
-if $have_x && $have_freetype ; then
+if $have_freetype ; then
PKG_CHECK_MODULES(XFT, xft >= 2.0.0 xrender, have_xft=true, AC_MSG_RESULT([no]))
fi
if $have_xft ; then
@@ -983,14 +968,13 @@ _EOF
])
AC_CONFIG_FILES([
-Makefile
+Makefile
pango/Makefile
pango/mini-fribidi/Makefile
pango/pango.rc
pango/pangoft2.rc
pango/pangowin32.rc
pango/pangocairo.rc
-pango/pangox.rc
pango/pangoxft.rc
pango-view/Makefile
modules/Makefile
@@ -1008,13 +992,11 @@ build/win32/Makefile
build/win32/vs9/Makefile
build/win32/vs10/Makefile
pango.pc
-pangox.pc
pangowin32.pc
pangoft2.pc
pangoxft.pc
pangocairo.pc
pango-uninstalled.pc
-pangox-uninstalled.pc
pangowin32-uninstalled.pc
pangoft2-uninstalled.pc
pangoxft-uninstalled.pc
diff --git a/docs/pango-sections.txt b/docs/pango-sections.txt
index d8f2c05e..51b69bcb 100644
--- a/docs/pango-sections.txt
+++ b/docs/pango-sections.txt
@@ -692,40 +692,6 @@ PangoRendererPrivate
</SECTION>
<SECTION>
-<TITLE>X Fonts and Rendering</TITLE>
-<FILE>x-fonts</FILE>
-PANGO_RENDER_TYPE_X
-pango_x_get_context
-pango_x_context_set_funcs
-PangoGetGCFunc
-PangoFreeGCFunc
-pango_x_render
-pango_x_render_layout_line
-pango_x_render_layout
-PangoXSubfont
-PANGO_X_MAKE_GLYPH
-PANGO_X_GLYPH_SUBFONT
-PANGO_X_GLYPH_INDEX
-pango_x_load_font
-pango_x_get_unknown_glyph
-pango_x_has_glyph
-pango_x_list_subfonts
-pango_x_font_map_for_display
-pango_x_shutdown_display
-pango_x_font_map_get_font_cache
-pango_x_font_subfont_xlfd
-pango_x_find_first_subfont
-pango_x_font_get_unknown_glyph
-pango_x_apply_ligatures
-pango_x_fallback_shape
-PangoXFontCache
-pango_x_font_cache_new
-pango_x_font_cache_free
-pango_x_font_cache_load
-pango_x_font_cache_unload
-</SECTION>
-
-<SECTION>
<TITLE>Win32 Fonts and Rendering</TITLE>
<FILE>win32-fonts</FILE>
PANGO_RENDER_TYPE_WIN32
diff --git a/docs/tmpl/fonts.sgml b/docs/tmpl/fonts.sgml
index d4ce3160..5e7402d7 100644
--- a/docs/tmpl/fonts.sgml
+++ b/docs/tmpl/fonts.sgml
@@ -442,15 +442,6 @@ the documentation of the corresponding getters for documentation
of their meaning.
</para>
-@ref_count:
-@ascent:
-@descent:
-@approximate_char_width:
-@approximate_digit_width:
-@underline_position:
-@underline_thickness:
-@strikethrough_position:
-@strikethrough_thickness:
<!-- ##### MACRO PANGO_TYPE_FONT_METRICS ##### -->
<para>
diff --git a/docs/tmpl/glyphs.sgml b/docs/tmpl/glyphs.sgml
index 5d4be350..926bf539 100644
--- a/docs/tmpl/glyphs.sgml
+++ b/docs/tmpl/glyphs.sgml
@@ -168,12 +168,6 @@ horizontal origin.
</para>
-@xx:
-@xy:
-@yx:
-@yy:
-@x0:
-@y0:
<!-- ##### MACRO PANGO_TYPE_MATRIX ##### -->
<para>
@@ -395,9 +389,6 @@ The storage for the glyph information is owned
by the structure which simplifies memory management.
</para>
-@num_glyphs:
-@glyphs:
-@log_clusters:
<!-- ##### STRUCT PangoGlyphItem ##### -->
<para>
@@ -408,8 +399,6 @@ of shaping text with #PangoLayout is a list of #PangoLayoutLine,
each of which contains a list of #PangoGlyphItem.
</para>
-@item:
-@glyphs:
<!-- ##### STRUCT PangoGlyphItemIter ##### -->
<para>
@@ -453,14 +442,6 @@ None of the members of a #PangoGlyphItemIter should be modified manually.
</para>
-@glyph_item:
-@text:
-@start_glyph:
-@start_index:
-@start_char:
-@end_glyph:
-@end_index:
-@end_char:
@Since: 1.22
<!-- ##### MACRO PANGO_TYPE_GLYPH_STRING ##### -->
diff --git a/docs/tmpl/layout.sgml b/docs/tmpl/layout.sgml
index a3f22a03..997507df 100644
--- a/docs/tmpl/layout.sgml
+++ b/docs/tmpl/layout.sgml
@@ -845,12 +845,6 @@ Routines for rendering PangoLayout objects are provided in
code specific to each rendering system.
</para>
-@layout:
-@start_index:
-@length:
-@runs:
-@is_paragraph_start:
-@resolved_dir:
<!-- ##### TYPEDEF PangoLayoutRun ##### -->
<para>
diff --git a/docs/tmpl/main.sgml b/docs/tmpl/main.sgml
index f3759cec..112baaaf 100644
--- a/docs/tmpl/main.sgml
+++ b/docs/tmpl/main.sgml
@@ -36,10 +36,6 @@ The #PangoItem structure stores information about
a segment of text. It contains the following fields:
</para>
-@offset:
-@length:
-@num_chars:
-@analysis:
<!-- ##### STRUCT PangoAnalysis ##### -->
<para>
diff --git a/docs/tmpl/tab-stops.sgml b/docs/tmpl/tab-stops.sgml
index 62b02020..0e28a72e 100644
--- a/docs/tmpl/tab-stops.sgml
+++ b/docs/tmpl/tab-stops.sgml
@@ -68,7 +68,7 @@ The #GObject type for #PangoTabAlign.
@positions_in_pixels:
@first_alignment:
@first_position:
-@Varargs:
+@...:
@Returns:
diff --git a/docs/tmpl/text-attributes.sgml b/docs/tmpl/text-attributes.sgml
index edcd3ec9..1f58e0dc 100644
--- a/docs/tmpl/text-attributes.sgml
+++ b/docs/tmpl/text-attributes.sgml
@@ -580,9 +580,6 @@ The #PangoColor structure is used to
represent a color in an uncalibrated RGB color-space.
</para>
-@red:
-@green:
-@blue:
<!-- ##### MACRO PANGO_TYPE_COLOR ##### -->
<para>
diff --git a/modules/basic/Makefile.am b/modules/basic/Makefile.am
index 70e4b6b1..306b9ec4 100644
--- a/modules/basic/Makefile.am
+++ b/modules/basic/Makefile.am
@@ -1,23 +1,5 @@
include $(top_srcdir)/modules/Module.mk
-if HAVE_X
-INCLUDES += $(X_CFLAGS)
-if INCLUDE_BASIC_X
-noinst_LTLIBRARIES += libpango-basic-x.la
-else
-if DYNAMIC_BASIC_X
-module_LTLIBRARIES += pango-basic-x.la
-endif
-endif
-endif
-
-pango_basic_x_la_LDFLAGS = -module $(MODULE_LIBTOOL_OPTIONS)
-pango_basic_x_la_LIBADD = $(pangoxlibs)
-pango_basic_x_la_SOURCES = basic-x.c
-libpango_basic_x_la_SOURCES = basic-x.c
-libpango_basic_x_la_CFLAGS = -DPANGO_MODULE_PREFIX=_pango_basic_x
-
-
if HAVE_FREETYPE
INCLUDES += $(FREETYPE_CFLAGS) $(HARFBUZZ_CFLAGS)
if INCLUDE_BASIC_FC
diff --git a/modules/basic/basic-x.c b/modules/basic/basic-x.c
deleted file mode 100644
index ba4effc9..00000000
--- a/modules/basic/basic-x.c
+++ /dev/null
@@ -1,720 +0,0 @@
-/* Pango
- * basic.c:
- *
- * Copyright (C) 1999 Red Hat Software
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-#include <glib.h>
-#include <string.h>
-#include "pango-engine.h"
-#include "pango-utils.h"
-
-#undef PANGO_DISABLE_DEPRECATED
-#include "pangox.h"
-
-/* No extra fields needed */
-typedef PangoEngineShape BasicEngineX;
-typedef PangoEngineShapeClass BasicEngineXClass ;
-
-typedef struct _CharRange CharRange;
-typedef struct _Charset Charset;
-typedef struct _CharsetOrdering CharsetOrdering;
-typedef struct _CharCache CharCache;
-typedef struct _CharCachePointer CharCachePointer;
-typedef struct _MaskTable MaskTable;
-
-typedef PangoGlyph (*ConvFunc) (CharCache *cache,
- GIConv cd,
- const gchar *input);
-
-#define MAX_CHARSETS 32
-
-#define SCRIPT_ENGINE_NAME "BasicScriptEngineX"
-
-struct _Charset
-{
- int index;
- const char *id;
- const char *x_charset;
- ConvFunc conv_func;
-};
-
-struct _CharsetOrdering
-{
- const char *langs;
- char charsets[MAX_CHARSETS];
-};
-
-struct _CharRange
-{
- guint16 start;
- guint16 end;
- guint16 charsets;
-};
-
-struct _MaskTable
-{
- int n_subfonts;
-
- PangoXSubfont *subfonts;
- Charset **charsets;
-};
-
-struct _CharCache
-{
- guint ref_count;
- CharsetOrdering *ordering;
- MaskTable *mask_tables[256];
- GIConv converters[MAX_CHARSETS];
- PangoCoverage *coverage;
-};
-
-struct _CharCachePointer
-{
- PangoLanguage *lang;
- CharCache *cache;
-};
-
-static PangoGlyph conv_8bit (CharCache *cache,
- GIConv cd,
- const char *input);
-static PangoGlyph conv_eucjp (CharCache *cache,
- GIConv cd,
- const char *input);
-static PangoGlyph conv_16bit (CharCache *cache,
- GIConv cd,
- const char *input);
-static PangoGlyph conv_ucs4 (CharCache *cache,
- GIConv cd,
- const char *input);
-static PangoGlyph conv_16bit_MSB_on (CharCache *cache,
- GIConv cd,
- const char *input);
-static PangoGlyph conv_gb18030_1 (CharCache *cache,
- GIConv cd,
- const char *input);
-static PangoGlyph conv_euctw (CharCache *cache,
- GIConv cd,
- const char *input);
-
-#include "tables-big.i"
-
-static PangoEngineScriptInfo basic_scripts[] = {
- { PANGO_SCRIPT_COMMON, "" },
-};
-
-static PangoEngineInfo script_engines[] = {
- {
- SCRIPT_ENGINE_NAME,
- PANGO_ENGINE_TYPE_SHAPE,
- PANGO_RENDER_TYPE_X,
- basic_scripts, G_N_ELEMENTS(basic_scripts)
- }
-};
-
-/*
- * X window system script engine portion
- */
-
-/* Structure of our cache:
- *
- * PangoFont => CharCachePointer ===\
- * | \
- * CharCachePointer ======> CharCache => CharsetOrdering
- * | |======> MaskTable[0] => {subfonts,charset}[n_subfonts],
- * | |======> MaskTable[1] => {subfonts,charset}[n_subfonts],
- * | \======> MaskTable[...] => {subfonts,charset}[n_subfonts]
- * |
- * CharCachePointer ======> CharCache => CharsetOrdering
- * |======> MaskTable[0] => {subfonts,charset}[n_subfonts],
- * |======> MaskTable[1] => {subfonts,charset}[n_subfonts],
- * \======> MaskTable[...] => {subfonts,charset}[n_subfonts]
- *
- * A CharCache structure caches the lookup of what subfonts can be used for what characters for a pair of a Font
- * and CharsetOrdering. Multiple language tags can share the same CharsetOrdering - the list of CharCachePointer
- * structures that is attached to the font as object data provides lookups from language tag to charcache.
- */
-static CharCache *
-char_cache_new (CharsetOrdering *ordering)
-{
- CharCache *result;
- int i;
-
- result = g_new0 (CharCache, 1);
-
- result->ref_count = 1;
- result->ordering = ordering;
- for (i=0; i<MAX_CHARSETS; i++)
- result->converters[i] = (GIConv)-1;
-
- return result;
-}
-
-static void
-char_cache_free (CharCache *cache)
-{
- int i;
-
- for (i=0; i<256; i++)
- if (cache->mask_tables[i])
- {
- g_free (cache->mask_tables[i]->subfonts);
- g_free (cache->mask_tables[i]->charsets);
-
- g_free (cache->mask_tables[i]);
- }
-
- for (i=0; i<MAX_CHARSETS; i++)
- if (cache->converters[i] != (GIConv)-1)
- g_iconv_close (cache->converters[i]);
-
- g_free (cache);
-}
-
-static PangoGlyph
-find_char (CharCache *cache, PangoFont *font, gunichar wc, const char *input)
-{
- int mask_index;
- MaskTable *mask_table;
- int i;
-
- switch (wc)
- {
- case '\n':
- case '\r':
- case 0x2028: /* Line separator */
- case 0x2029: /* Paragraph separator */
- return PANGO_GET_UNKNOWN_GLYPH (wc);
- break;
- }
-
- if (wc >= G_N_ELEMENTS (char_masks))
- mask_index = 0;
- else
- mask_index = char_masks[wc];
-
- if (cache->mask_tables[mask_index])
- mask_table = cache->mask_tables[mask_index];
- else
- {
- const char *charset_names[G_N_ELEMENTS(charsets)];
- Charset *charsets_map[G_N_ELEMENTS(charsets)];
- guint mask;
- int n_charsets = 0;
- int *subfont_charsets;
-
- mask_table = g_new (MaskTable, 1);
-
- mask = char_mask_map[mask_index] | ENC_ISO_10646;
-
- /* Find the character sets that are included in this mask
- */
-
- for (i=0; i<(int)G_N_ELEMENTS(charsets); i++)
- {
- int charset_index = cache->ordering->charsets[i];
-
- if (mask & (1 << charset_index))
- {
- charset_names[n_charsets] = charsets[charset_index].x_charset;
- charsets_map[n_charsets] = &charsets[charset_index];
-
- n_charsets++;
- }
- }
-
- mask_table->n_subfonts = pango_x_list_subfonts (font, (char**)(void*)charset_names, n_charsets, &mask_table->subfonts, &subfont_charsets);
-
- mask_table->charsets = g_new (Charset *, mask_table->n_subfonts);
- for (i=0; i<mask_table->n_subfonts; i++)
- mask_table->charsets[i] = charsets_map[subfont_charsets[i]];
-
- g_free (subfont_charsets);
-
- cache->mask_tables[mask_index] = mask_table;
- }
-
- for (i=0; i < mask_table->n_subfonts; i++)
- {
- PangoGlyph index;
- PangoGlyph glyph;
- Charset *charset;
-
- charset = mask_table->charsets[i];
- if (charset)
- {
- GIConv cd = cache->converters[charset->index];
-
- if (charset->id && cd == (GIConv)-1)
- {
- cd = g_iconv_open (charset->id, "UTF-8");
- if (cd == (GIConv)-1)
- {
- g_warning ("Could not load converter from %s to UTF-8", charset->id);
- mask_table->charsets[i] = NULL;
- continue;
- }
-
- cache->converters[charset->index] = cd;
- }
-
- index = (*charset->conv_func) (cache, cd, input);
- glyph = PANGO_X_MAKE_GLYPH (mask_table->subfonts[i], index);
-
- if (pango_x_has_glyph (font, glyph))
- return glyph;
- }
- }
-
- return 0;
-}
-
-static void
-set_glyph (PangoFont *font, PangoGlyphString *glyphs, int i, int offset, PangoGlyph glyph)
-{
- PangoRectangle logical_rect;
-
- glyphs->glyphs[i].glyph = glyph;
-
- glyphs->glyphs[i].geometry.x_offset = 0;
- glyphs->glyphs[i].geometry.y_offset = 0;
-
- glyphs->log_clusters[i] = offset;
-
- pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, NULL, &logical_rect);
- glyphs->glyphs[i].geometry.width = logical_rect.width;
-}
-
-static PangoGlyph
-conv_8bit (CharCache *cache G_GNUC_UNUSED,
- GIConv cd,
- const char *input)
-{
- char outbuf;
-
- const char *inptr = input;
- size_t inbytesleft;
- char *outptr = &outbuf;
- size_t outbytesleft = 1;
-
- inbytesleft = g_utf8_next_char (input) - input;
-
- g_iconv (cd, (char **)&inptr, &inbytesleft, &outptr, &outbytesleft);
-
- return (guchar)outbuf;
-}
-
-static PangoGlyph
-conv_eucjp (CharCache *cache G_GNUC_UNUSED,
- GIConv cd,
- const char *input)
-{
- char outbuf[4];
-
- const char *inptr = input;
- size_t inbytesleft;
- char *outptr = outbuf;
- size_t outbytesleft = 4;
-
- inbytesleft = g_utf8_next_char (input) - input;
-
- g_iconv (cd, (char **)&inptr, &inbytesleft, &outptr, &outbytesleft);
-
- if ((guchar)outbuf[0] < 128)
- return outbuf[0];
- else if ((guchar)outbuf[0] == 0x8e && outbytesleft == 2)
- return ((guchar)outbuf[1]);
- else if ((guchar)outbuf[0] == 0x8f && outbytesleft == 1)
- return ((guchar)outbuf[1] & 0x7f) * 256 + ((guchar)outbuf[2] & 0x7f);
- else
- return ((guchar)outbuf[0] & 0x7f) * 256 + ((guchar)outbuf[1] & 0x7f);
-}
-
-static PangoGlyph
-conv_16bit (CharCache *cache G_GNUC_UNUSED,
- GIConv cd,
- const char *input)
-{
- char outbuf[2];
-
- const char *inptr = input;
- size_t inbytesleft;
- char *outptr = outbuf;
- size_t outbytesleft = 2;
-
- inbytesleft = g_utf8_next_char (input) - input;
-
- g_iconv (cd, (char **)&inptr, &inbytesleft, &outptr, &outbytesleft);
-
- if ((guchar)outbuf[0] < 128)
- return outbuf[0];
- else
- return ((guchar)outbuf[0] & 0x7f) * 256 + ((guchar)outbuf[1] & 0x7f);
-}
-
-static PangoGlyph
-conv_16bit_MSB_on (CharCache *cache G_GNUC_UNUSED,
- GIConv cd,
- const char *input)
-{
- char outbuf[2];
-
- const char *inptr = input;
- size_t inbytesleft;
- char *outptr = outbuf;
- size_t outbytesleft = 2;
-
- inbytesleft = g_utf8_next_char (input) - input;
-
- g_iconv (cd, (char **)&inptr, &inbytesleft, &outptr, &outbytesleft);
-
- if ((guchar)outbuf[0] < 128)
- return outbuf[0];
- else
- return (guchar)outbuf[0] * 256 + (guchar)outbuf[1];
-}
-
-static PangoGlyph
-conv_gb18030_1 (CharCache *cache G_GNUC_UNUSED,
- GIConv cd,
- const char *input)
-{
- char outbuf[4];
-
- const char *inptr = input;
- size_t inbytesleft;
- char *outptr = outbuf;
- size_t outbytesleft = 4;
-
-
- inbytesleft = g_utf8_next_char (input) - input;
-
- g_iconv (cd, (char **)&inptr, &inbytesleft, &outptr, &outbytesleft);
-
- if ((guchar)outbuf[0] < 128)
- return outbuf[0];
- else
- return 12600 * ((guchar)outbuf[0] - 0x81) + 1260 * ((guchar)outbuf[1] - 0x30) + 10 * ((guchar)outbuf[2] - 0x81) + ((guchar)outbuf[3] - 0x30);
-}
-
-static PangoGlyph
-conv_euctw (CharCache *cache G_GNUC_UNUSED,
- GIConv cd,
- const char *input)
-{
- char outbuf[4];
-
- const char *inptr = input;
- size_t inbytesleft;
- char *outptr = outbuf;
- size_t outbytesleft = 4;
-
- inbytesleft = g_utf8_next_char (input) - input;
-
- g_iconv (cd, (char **)&inptr, &inbytesleft, &outptr, &outbytesleft);
-
- /* The first two bytes determine which page of CNS to use; we
- * get this information from tables-big.i, so ignore them
- */
- if ((guchar)outbuf[0] < 128)
- return outbuf[0];
- else
- return ((guchar)outbuf[2] & 0x7f) * 256 + ((guchar)outbuf[3] & 0x7f);
-}
-
-static PangoGlyph
-conv_ucs4 (CharCache *cache G_GNUC_UNUSED,
- GIConv cd G_GNUC_UNUSED,
- const char *input)
-{
- return g_utf8_get_char (input);
-}
-
-static void
-swap_range (PangoGlyphString *glyphs, int start, int end)
-{
- int i, j;
-
- for (i = start, j = end - 1; i < j; i++, j--)
- {
- PangoGlyphInfo glyph_info;
- gint log_cluster;
-
- glyph_info = glyphs->glyphs[i];
- glyphs->glyphs[i] = glyphs->glyphs[j];
- glyphs->glyphs[j] = glyph_info;
-
- log_cluster = glyphs->log_clusters[i];
- glyphs->log_clusters[i] = glyphs->log_clusters[j];
- glyphs->log_clusters[j] = log_cluster;
- }
-}
-
-static void
-char_caches_free (GSList *caches)
-{
- GSList *tmp_list = caches;
- while (tmp_list)
- {
- CharCachePointer *pointer = tmp_list->data;
-
- pointer->cache->ref_count--;
- if (pointer->cache->ref_count == 0)
- char_cache_free (pointer->cache);
- g_free (pointer);
-
- tmp_list = tmp_list->next;
- }
- g_slist_free (caches);
-}
-
-static CharsetOrdering *
-ordering_for_lang (PangoLanguage *lang)
-{
- int i;
-
- for (i = 0; i < (int)G_N_ELEMENTS (charset_orderings) - 1; i++)
- {
- if (pango_language_matches (lang, charset_orderings[i].langs))
- return &charset_orderings[i];
- }
-
- return &charset_orderings[i];
-}
-
-static CharCache *
-get_char_cache (PangoFont *font,
- PangoLanguage *lang)
-{
- GQuark cache_id = g_quark_from_string ("basic-char-cache");
- CharCache *cache = NULL;
- CharCachePointer *pointer;
- CharsetOrdering *ordering;
- GSList *caches;
- GSList *tmp_list;
-
- caches = g_object_get_qdata (G_OBJECT (font), cache_id);
- tmp_list = caches;
- while (tmp_list)
- {
- pointer = tmp_list->data;
- if (pointer->lang == lang)
- return pointer->cache;
-
- tmp_list = tmp_list->next;
- }
-
- ordering = ordering_for_lang (lang);
-
- tmp_list = caches;
- while (tmp_list)
- {
- pointer = tmp_list->data;
- if (pointer->cache->ordering == ordering)
- {
- cache = pointer->cache;
- break;
- }
-
- tmp_list = tmp_list->next;
- }
-
- if (!cache)
- cache = char_cache_new (ordering);
- else
- cache->ref_count++;
-
- pointer = g_new (CharCachePointer, 1);
- pointer->lang = lang;
- pointer->cache = cache;
-
- caches = g_slist_prepend (caches, pointer);
-
- g_object_steal_qdata (G_OBJECT (font), cache_id);
- g_object_set_qdata_full (G_OBJECT (font), cache_id,
- caches, (GDestroyNotify)char_caches_free);
-
- return cache;
-}
-
-static void
-basic_engine_shape (PangoEngineShape *engine G_GNUC_UNUSED,
- PangoFont *font,
- const char *text,
- gint length,
- const PangoAnalysis *analysis,
- PangoGlyphString *glyphs)
-{
- int n_chars;
- int i;
- const char *p;
-
- CharCache *cache;
-
- g_return_if_fail (font != NULL);
- g_return_if_fail (text != NULL);
- g_return_if_fail (length >= 0);
- g_return_if_fail (analysis != NULL);
-
- cache = get_char_cache (font, analysis->language);
-
- n_chars = g_utf8_strlen (text, length);
- pango_glyph_string_set_size (glyphs, n_chars);
-
- p = text;
- for (i=0; i < n_chars; i++)
- {
- gunichar wc;
- gunichar mirrored_ch;
- PangoGlyph index;
- char buf[6];
- const char *input;
-
- wc = g_utf8_get_char (p);
-
- input = p;
- if (analysis->level % 2)
- if (pango_get_mirror_char (wc, &mirrored_ch))
- {
- wc = mirrored_ch;
-
- g_unichar_to_utf8 (wc, buf);
- input = buf;
- }
-
- if (wc == 0xa0) /* non-break-space */
- {
- wc = 0x20;
-
- g_unichar_to_utf8 (wc, buf);
- input = buf;
- }
-
- if (pango_is_zero_width (wc))
- {
- set_glyph (font, glyphs, i, p - text, PANGO_GLYPH_EMPTY);
- }
- else
- {
- index = find_char (cache, font, wc, input);
- if (index)
- {
- set_glyph (font, glyphs, i, p - text, index);
-
- if (g_unichar_type (wc) == G_UNICODE_NON_SPACING_MARK)
- {
- if (i > 0)
- {
- PangoRectangle logical_rect, ink_rect;
-
- glyphs->glyphs[i].geometry.width = MAX (glyphs->glyphs[i-1].geometry.width,
- glyphs->glyphs[i].geometry.width);
- glyphs->glyphs[i-1].geometry.width = 0;
- glyphs->log_clusters[i] = glyphs->log_clusters[i-1];
-
- /* Some heuristics to try to guess how overstrike glyphs are
- * done and compensate
- */
- pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, &ink_rect, &logical_rect);
- if (logical_rect.width == 0 && ink_rect.x == 0)
- glyphs->glyphs[i].geometry.x_offset = (glyphs->glyphs[i].geometry.width - ink_rect.width) / 2;
- }
- }
- }
- else
- set_glyph (font, glyphs, i, p - text, PANGO_GET_UNKNOWN_GLYPH (wc));
- }
-
- p = g_utf8_next_char (p);
- }
-
- /* Simple bidi support... may have separate modules later */
-
- if (analysis->level % 2)
- {
- int start, end;
-
- /* Swap all glyphs */
- swap_range (glyphs, 0, n_chars);
-
- /* Now reorder glyphs within each cluster back to LTR */
- for (start=0; start<n_chars;)
- {
- end = start;
- while (end < n_chars &&
- glyphs->log_clusters[end] == glyphs->log_clusters[start])
- end++;
-
- swap_range (glyphs, start, end);
- start = end;
- }
- }
-}
-
-static PangoCoverageLevel
-basic_engine_covers (PangoEngineShape *engine G_GNUC_UNUSED,
- PangoFont *font,
- PangoLanguage *lang,
- gunichar wc)
-{
- CharCache *cache = get_char_cache (font, lang);
- char buf[6];
-
- g_unichar_to_utf8 (wc, buf);
-
- return find_char (cache, font, wc, buf) ? PANGO_COVERAGE_EXACT : PANGO_COVERAGE_NONE;
-}
-
-static void
-basic_engine_x_class_init (PangoEngineShapeClass *class)
-{
- class->covers = basic_engine_covers;
- class->script_shape = basic_engine_shape;
-}
-
-PANGO_ENGINE_SHAPE_DEFINE_TYPE (BasicEngineX, basic_engine_x,
- basic_engine_x_class_init, NULL)
-
-void
-PANGO_MODULE_ENTRY(init) (GTypeModule *module)
-{
- basic_engine_x_register_type (module);
-}
-
-void
-PANGO_MODULE_ENTRY(exit) (void)
-{
-}
-
-void
-PANGO_MODULE_ENTRY(list) (PangoEngineInfo **engines,
- int *n_engines)
-{
- *engines = script_engines;
- *n_engines = G_N_ELEMENTS (script_engines);
-}
-
-PangoEngine *
-PANGO_MODULE_ENTRY(create) (const char *id)
-{
- if (!strcmp (id, SCRIPT_ENGINE_NAME))
- return g_object_new (basic_engine_x_type, NULL);
- else
- return NULL;
-}
diff --git a/pango-view/Makefile.am b/pango-view/Makefile.am
index dbfd81a0..51f58613 100644
--- a/pango-view/Makefile.am
+++ b/pango-view/Makefile.am
@@ -48,15 +48,6 @@ pango_view_SOURCES = \
pango_view_LDADD = \
../pango/libpango-$(PANGO_API_VERSION).la \
$(GLIB_LIBS)
-if HAVE_X
-pango_view_SOURCES += \
- viewer-x.h \
- viewer-x.c \
- viewer-pangox.c
-pango_view_LDADD += \
- ../pango/libpangox-$(PANGO_API_VERSION).la \
- $(X_LIBS)
-endif
if HAVE_FREETYPE
pango_view_SOURCES += \
viewer-pangoft2.c
@@ -66,7 +57,9 @@ pango_view_LDADD += \
endif
if HAVE_XFT
pango_view_SOURCES += \
- viewer-pangoxft.c
+ viewer-pangoxft.c \
+ viewer-x.h \
+ viewer-x.c
pango_view_LDADD += \
../pango/libpangoft2-$(PANGO_API_VERSION).la \
../pango/libpangoxft-$(PANGO_API_VERSION).la \
diff --git a/pango-view/viewer-pangox.c b/pango-view/viewer-pangox.c
deleted file mode 100644
index 137319d9..00000000
--- a/pango-view/viewer-pangox.c
+++ /dev/null
@@ -1,122 +0,0 @@
-/* viewer-pangox.c: PangoX viewer backend.
- *
- * Copyright (C) 1999,2004,2005 Red Hat, Inc.
- * Copyright (C) 2001 Sun Microsystems
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-#include "config.h"
-
-#include "viewer-render.h"
-#include "viewer-x.h"
-
-#include <pango/pangox.h>
-
-static void
-pangox_view_destroy (gpointer instance)
-{
- XViewer *x = (XViewer *)instance;
-
- pango_x_shutdown_display (x->display);
-
- x_view_destroy (instance);
-}
-
-static PangoContext *
-pangox_view_get_context (gpointer instance)
-{
- XViewer *x = (XViewer *) instance;
- PangoContext *context;
- PangoMatrix matrix = {0., 0., 0., 0., 0., 0.};
-
- context = pango_font_map_create_context (pango_x_font_map_for_display (x->display));
-
- /* We set an all-zero matrix on the context, to negotiate that
- * this backend doesn't support transformations.
- */
- pango_context_set_matrix (context, &matrix);
-
- return context;
-}
-
-typedef struct
-{
- XViewer *x;
- Drawable drawable;
- GC gc;
-} MyXContext;
-
-static void
-render_callback (PangoLayout *layout,
- int x,
- int y,
- gpointer context,
- gpointer state G_GNUC_UNUSED)
-{
- MyXContext *x_context = (MyXContext *) context;
-
- pango_x_render_layout (x_context->x->display,
- x_context->drawable,
- x_context->gc,
- layout,
- x, y);
-}
-
-static void
-pangox_view_render (gpointer instance,
- gpointer surface,
- PangoContext *context,
- int *width,
- int *height,
- gpointer state)
-{
- XViewer *x = (XViewer *) instance;
- Pixmap pixmap = (Pixmap) surface;
- GC gc;
- MyXContext x_context;
-
- gc = XCreateGC (x->display, pixmap, 0, NULL);
-
- XSetForeground(x->display, gc, WhitePixel(x->display, x->screen));
- XFillRectangle (x->display, pixmap, gc, 0, 0, *width, *height);
-
- x_context.x = x;
- x_context.drawable = pixmap;
- x_context.gc = gc;
-
- XSetForeground(x->display, gc, BlackPixel(x->display, x->screen));
- do_output (context, render_callback, NULL, &x_context, state, width, height);
-
- XFlush(x->display);
-
- XFreeGC (x->display, gc);
-}
-
-const PangoViewer pangox_viewer = {
- "PangoX",
- "x",
- NULL,
- x_view_create,
- pangox_view_destroy,
- pangox_view_get_context,
- x_view_create_surface,
- x_view_destroy_surface,
- pangox_view_render,
- NULL,
- x_view_create_window,
- x_view_destroy_window,
- x_view_display
-};
diff --git a/pango/Makefile.am b/pango/Makefile.am
index c08b5cc9..4e9592a7 100644
--- a/pango/Makefile.am
+++ b/pango/Makefile.am
@@ -169,45 +169,6 @@ Pango_1_0_gir_CFLAGS = -I$(top_builddir) -I$(top_srcdir) $(PANGO_CFLAGS)
Pango_1_0_gir_FILES = $(filter-out %-private.h pango-color-table.h, $(pango_introspection_files))
Pango_1_0_gir_SCANNERFLAGS = --c-include "pango/pango.h"
-# ------------------- libpangox -------------------
-
-if HAVE_X
-pangoinclude_HEADERS += $(pangox_headers)
-lib_LTLIBRARIES += libpangox-1.0.la
-aliasdir = $(sysconfdir)/pango
-alias_DATA = pangox.aliases
-endif
-
-pangox_headers = pangox.h
-pangox_public_sources = pangox.c
-
-libpangox_1_0_la_LDFLAGS = $(LIBRARY_LIBTOOL_OPTIONS)
-libpangox_1_0_la_LIBADD = \
- libpango-$(PANGO_API_VERSION).la \
- $(INCLUDED_X_MODULES) \
- $(GLIB_LIBS) \
- $(X_LIBS) \
- $(X_EXTRA_LIBS)
-libpangox_1_0_la_DEPENDENCIES = \
- libpango-$(PANGO_API_VERSION).la \
- $(INCLUDED_X_MODULES)
-
-if PLATFORM_WIN32
-libpangox_1_0_la_LDFLAGS += -export-symbols $(srcdir)/pangox.def -Wl,pangox-win32-res.o
-libpangox_1_0_la_DEPENDENCIES += pangox-win32-res.o pangox.def
-endif
-
-pangox-win32-res.o: pangox.rc
- $(WINDRES) $< $@
-
-libpangox_1_0_la_SOURCES = \
- $(pangox_public_sources) \
- modules.h \
- module-defs-x.c \
- pangox-private.h \
- pangox-fontcache.c \
- pangox-fontmap.c
-
# ------------------- libpangoft2 -------------------
if HAVE_FREETYPE
@@ -483,8 +444,7 @@ if HAVE_FREETYPE
endif
$(INSTALL) $(srcdir)/pangowin32.def $(DESTDIR)$(libdir)/pangowin32-$(PANGO_API_VERSION).def
$(INSTALL) $(srcdir)/pangocairo.def $(DESTDIR)$(libdir)/pangocairo-$(PANGO_API_VERSION).def
-if HAVE_X
- $(INSTALL) $(srcdir)/pangox.def $(DESTDIR)$(libdir)/pangox-$(PANGO_API_VERSION).def
+if HAVE_XFT
$(INSTALL) $(srcdir)/pangoxft.def $(DESTDIR)$(libdir)/pangoxft-$(PANGO_API_VERSION).def
endif
uninstall-def-files:
@@ -494,8 +454,7 @@ if HAVE_FREETYPE
endif
-$(RM) $(DESTDIR)$(libdir)/pangowin32-$(PANGO_API_VERSION).def
-$(RM) $(DESTDIR)$(libdir)/pangocairo-$(PANGO_API_VERSION).def
-if HAVE_X
- -$(RM) $(DESTDIR)$(libdir)/pangox-$(PANGO_API_VERSION).def
+if HAVE_XFT
-$(RM) $(DESTDIR)$(libdir)/pangoxft-$(PANGO_API_VERSION).def
endif
else
@@ -560,16 +519,10 @@ endif # HAVE_INTROSPECTION
bin_PROGRAMS = pango-querymodules
-#
-# As a temporary hack, we pull in libpangox here so that we can link
-#
pango_querymodules_SOURCES = \
querymodules.c
pango_querymodules_LDADD =
-if HAVE_X
-pango_querymodules_LDADD += libpangox-$(PANGO_API_VERSION).la
-endif
if HAVE_XFT
pango_querymodules_LDADD += libpangoxft-$(PANGO_API_VERSION).la
endif
@@ -595,15 +548,12 @@ EXTRA_DIST = \
makefile.msc \
pango.rc \
pango.rc.in \
- pangox.aliases \
pangoft2.rc \
pangoft2.rc.in \
pangowin32.rc \
pangowin32.rc.in \
pangocairo.rc \
pangocairo.rc.in \
- pangox.rc \
- pangox.rc.in \
pangoxft.rc \
pangoxft.rc.in \
check.defs
@@ -651,7 +601,7 @@ install-data-local: install-ms-lib install-def-files
install-exec-hook:
if DISABLE_EXPLICIT_DEPS
- -for i in libpangoft2-$(PANGO_API_VERSION).la libpangoxft-$(PANGO_API_VERSION).la libpangox-$(PANGO_API_VERSION).la libpangowin32-$(PANGO_API_VERSION).la; do \
+ -for i in libpangoft2-$(PANGO_API_VERSION).la libpangoxft-$(PANGO_API_VERSION).la libpangowin32-$(PANGO_API_VERSION).la; do \
test -f $(DESTDIR)$(libdir)/$$i && $(SHELL) $(top_srcdir)/sanitize-la.sh $(DESTDIR)$(libdir)/$$i ; \
done
endif
diff --git a/pango/pangox-fontcache.c b/pango/pangox-fontcache.c
deleted file mode 100644
index f60b8c9e..00000000
--- a/pango/pangox-fontcache.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/* Pango
- * pango-fontcache.c: Cache of XFontStructs by XLFD
- *
- * Copyright (C) 2000 Red Hat Software
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-#include "pangox.h"
-
-/* Font cache
- */
-
-/* Number of fonts to retain after they are not otherwise referenced.
- */
-#define CACHE_SIZE 16
-
-typedef struct _CacheEntry CacheEntry;
-
-struct _PangoXFontCache
-{
- Display *display;
-
- GHashTable *forward;
- GHashTable *back;
-
- GList *mru;
- GList *mru_tail;
- int mru_count;
-};
-
-struct _CacheEntry
-{
- char *xlfd;
- XFontStruct *fs;
-
- gint ref_count;
- GList *mru;
-};
-
-static void
-free_cache_entry (char *xlfd G_GNUC_UNUSED,
- CacheEntry *entry,
- PangoXFontCache *cache)
-{
- g_free (entry->xlfd);
- XFreeFont (cache->display, entry->fs);
-
- g_slice_free (CacheEntry, entry);
-}
-
-/**
- * pango_x_font_cache_free:
- * @cache: a #PangoXFontCache
- *
- * Frees a #PangoXFontCache and all associated memory. All fonts loaded
- * through this font cache will be freed along with the cache.
- **/
-void
-pango_x_font_cache_free (PangoXFontCache *cache)
-{
- g_return_if_fail (cache != NULL);
-
- g_hash_table_foreach (cache->forward, (GHFunc)free_cache_entry, cache);
-
- g_hash_table_destroy (cache->forward);
- g_hash_table_destroy (cache->back);
-
- g_list_free (cache->mru);
-
- g_slice_free (PangoXFontCache, cache);
-}
-
-/**
- * pango_x_font_cache_new:
- * @display: an X display.
- *
- * Creates a font cache for the specified display.
- *
- * Return value: The newly allocated #PangoXFontCache, which should be
- * freed with pango_x_font_cache_free().
- **/
-PangoXFontCache *
-pango_x_font_cache_new (Display *display)
-{
- PangoXFontCache *cache;
-
- g_return_val_if_fail (display != NULL, NULL);
-
- cache = g_slice_new (PangoXFontCache);
-
- cache->display = display;
-
- cache->forward = g_hash_table_new (g_str_hash, g_str_equal);
- cache->back = g_hash_table_new (g_direct_hash, g_direct_equal);
-
- cache->mru = NULL;
- cache->mru_tail = NULL;
- cache->mru_count = 0;
-
- return cache;
-}
-
-static void
-cache_entry_unref (PangoXFontCache *cache, CacheEntry *entry)
-{
- if (g_atomic_int_dec_and_test (&entry->ref_count))
- {
- g_hash_table_remove (cache->forward, entry->xlfd);
- g_hash_table_remove (cache->back, entry->fs);
-
- free_cache_entry (NULL, entry, cache);
- }
-}
-
-/**
- * pango_x_font_cache_load:
- * @cache: a #PangoXFontCache
- * @xlfd: the X Logical Font Description to load.
- *
- * Loads a #XFontStruct from a X Logical Font Description. The
- * result may be newly loaded, or it may have been previously
- * stored.
- *
- * Return value: The font structure, or %NULL if the font could
- * not be loaded. In order to free this structure, you must call
- * pango_x_font_cache_unload().
- **/
-XFontStruct *
-pango_x_font_cache_load (PangoXFontCache *cache,
- const char *xlfd)
-{
- CacheEntry *entry;
-
- g_return_val_if_fail (cache != NULL, NULL);
- g_return_val_if_fail (xlfd != NULL, NULL);
-
- entry = g_hash_table_lookup (cache->forward, xlfd);
-
- if (entry)
- {
- g_atomic_int_inc (&entry->ref_count);
- }
- else
- {
- XFontStruct *fs = XLoadQueryFont (cache->display, xlfd);
-
- if (!fs)
- return NULL;
-
- entry = g_slice_new (CacheEntry);
-
- entry->xlfd = g_strdup (xlfd);
- entry->fs = fs;
-
- entry->ref_count = 1;
- entry->mru = NULL;
-
- g_hash_table_insert (cache->forward, entry->xlfd, entry);
- g_hash_table_insert (cache->back, entry->fs, entry);
- }
-
- if (entry->mru)
- {
- if (cache->mru_count > 1 && entry->mru->prev)
- {
- /* Move to the head of the mru list */
-
- if (entry->mru == cache->mru_tail)
- {
- cache->mru_tail = cache->mru_tail->prev;
- cache->mru_tail->next = NULL;
- }
- else
- {
- entry->mru->prev->next = entry->mru->next;
- entry->mru->next->prev = entry->mru->prev;
- }
-
- entry->mru->next = cache->mru;
- entry->mru->prev = NULL;
- cache->mru->prev = entry->mru;
- cache->mru = entry->mru;
- }
- }
- else
- {
- g_atomic_int_inc (&entry->ref_count);
-
- /* Insert into the mru list */
-
- if (cache->mru_count == CACHE_SIZE)
- {
- CacheEntry *old_entry = cache->mru_tail->data;
-
- cache->mru_tail = cache->mru_tail->prev;
- cache->mru_tail->next = NULL;
-
- g_list_free_1 (old_entry->mru);
- old_entry->mru = NULL;
- cache_entry_unref (cache, old_entry);
- }
- else
- cache->mru_count++;
-
- cache->mru = g_list_prepend (cache->mru, entry);
- if (!cache->mru_tail)
- cache->mru_tail = cache->mru;
- entry->mru = cache->mru;
- }
-
- return entry->fs;
-}
-
-/**
- * pango_x_font_cache_unload:
- * @cache: a #PangoXFontCache
- * @fs: the font structure to unload
- *
- * Frees a font structure previously loaded with pango_x_font_cache_load().
- **/
-void
-pango_x_font_cache_unload (PangoXFontCache *cache,
- XFontStruct *fs)
-{
- CacheEntry *entry;
-
- g_return_if_fail (cache != NULL);
- g_return_if_fail (fs != NULL);
-
- entry = g_hash_table_lookup (cache->back, fs);
- g_return_if_fail (entry != NULL);
-
- cache_entry_unref (cache, entry);
-}
diff --git a/pango/pangox-fontmap.c b/pango/pangox-fontmap.c
deleted file mode 100644
index 74925dc9..00000000
--- a/pango/pangox-fontmap.c
+++ /dev/null
@@ -1,1628 +0,0 @@
-/* Pango
- * pangox-fontmap.c: X font handling
- *
- * Copyright (C) 2000 Red Hat Software
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-#include <glib.h>
-
-#include <X11/Xatom.h>
-
-/* For XExtSetCloseDisplay */
-#include <X11/Xlibint.h>
-
-#include "pango-engine-private.h"
-#include "pango-fontmap.h"
-#include "pango-impl-utils.h"
-#include "modules.h"
-
-#undef PANGO_DISABLE_DEPRECATED
-
-#include "pangox-private.h"
-
-typedef struct _PangoXFamily PangoXFamily;
-typedef struct _PangoXFamilyClass PangoXFamilyClass;
-typedef struct _PangoXSizeInfo PangoXSizeInfo;
-
-/* Number of freed fonts */
-#define MAX_FREED_FONTS 16
-
-/* This is the largest field length we will accept. If a fontname has a field
- larger than this we will skip it. */
-#define XLFD_MAX_FIELD_LEN 64
-#define MAX_FONTS 32767
-
-/* These are the field numbers in the X Logical Font Description fontnames,
- e.g. -adobe-courier-bold-o-normal--25-180-100-100-m-150-iso8859-1 */
-typedef enum
-{
- XLFD_FOUNDRY = 0,
- XLFD_FAMILY = 1,
- XLFD_WEIGHT = 2,
- XLFD_SLANT = 3,
- XLFD_SET_WIDTH = 4,
- XLFD_ADD_STYLE = 5,
- XLFD_PIXELS = 6,
- XLFD_POINTS = 7,
- XLFD_RESOLUTION_X = 8,
- XLFD_RESOLUTION_Y = 9,
- XLFD_SPACING = 10,
- XLFD_AVERAGE_WIDTH = 11,
- XLFD_CHARSET = 12,
- XLFD_NUM_FIELDS
-} FontField;
-
-struct _PangoXFamily
-{
- PangoFontFamily parent_instance;
-
- char *family_name;
- GSList *font_entries;
-};
-
-struct _PangoXFamilyClass
-{
- PangoFontFamilyClass parent_class;
-};
-
-struct _PangoXFace
-{
- PangoFontFace parent_instance;
-
- char *xlfd;
- PangoFontDescription *description;
- PangoCoverage *coverage;
-
- char *face_name;
-
- GSList *cached_fonts;
-};
-
-struct _PangoXSizeInfo
-{
- char *identifier;
- GSList *xlfds;
-};
-
-static const struct {
- const gchar text[12];
- PangoWeight value;
-} weights_map[] = {
- { "light", 300 },
- { "regular", 400 },
- { "book", 400 },
- { "medium", 500 },
- { "semibold", 600 },
- { "demibold", 600 },
- { "bold", 700 },
- { "extrabold", 800 },
- { "ultrabold", 800 },
- { "heavy", 900 },
- { "black", 900 }
-};
-
-static const struct {
- const gchar text[4];
- PangoStyle value;
-} styles_map[] = {
- { "r", PANGO_STYLE_NORMAL },
- { "i", PANGO_STYLE_ITALIC },
- { "o", PANGO_STYLE_OBLIQUE }
-};
-
-static const struct {
- const gchar text[16];
- PangoStretch value;
-} stretches_map[] = {
- { "normal", PANGO_STRETCH_NORMAL },
- { "semicondensed", PANGO_STRETCH_SEMI_CONDENSED },
- { "condensed", PANGO_STRETCH_CONDENSED },
-};
-
-static void pango_x_font_map_finalize (GObject *object);
-static PangoFont *pango_x_font_map_load_font (PangoFontMap *fontmap,
- PangoContext *context,
- const PangoFontDescription *description);
-static void pango_x_font_map_list_families (PangoFontMap *fontmap,
- PangoFontFamily ***families,
- int *n_families);
-
-static void pango_x_fontmap_cache_clear (PangoXFontMap *xfontmap);
-static void pango_x_font_map_read_aliases (PangoXFontMap *xfontmap);
-
-static gint pango_x_get_size (PangoXFontMap *fontmap,
- const char *fontname);
-static void pango_x_insert_font (PangoXFontMap *fontmap,
- const char *fontname);
-static gboolean pango_x_is_xlfd_font_name (const char *fontname);
-static char * pango_x_get_xlfd_field (const char *fontname,
- FontField field_num,
- char *buffer);
-static char * pango_x_get_identifier (const char *fontname);
-
-
-#define PANGO_X_TYPE_FAMILY (pango_x_family_get_type ())
-#define PANGO_X_FAMILY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_X_TYPE_FAMILY, PangoXFamily))
-#define PANGO_X_IS_FAMILY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_X_TYPE_FAMILY))
-
-GType pango_x_family_get_type (void);
-
-
-#define PANGO_X_TYPE_FACE (pango_x_face_get_type ())
-#define PANGO_X_FACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_X_TYPE_FACE, PangoXFace))
-#define PANGO_X_IS_FACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_X_TYPE_FACE))
-
-GType pango_x_face_get_type (void);
-
-G_DEFINE_TYPE (PangoXFontMap, pango_x_font_map, PANGO_TYPE_FONT_MAP);
-
-static void
-pango_x_font_map_init (PangoXFontMap *xfontmap)
-{
- xfontmap->families = g_hash_table_new (g_str_hash, g_str_equal);
- xfontmap->size_infos = g_hash_table_new (g_str_hash, g_str_equal);
- xfontmap->to_atom_cache = g_hash_table_new (g_str_hash, g_str_equal);
- xfontmap->from_atom_cache = g_hash_table_new (g_direct_hash, g_direct_equal);
- xfontmap->n_fonts = 0;
-}
-
-static void
-pango_x_font_map_class_init (PangoXFontMapClass *class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (class);
- PangoFontMapClass *font_map_class = PANGO_FONT_MAP_CLASS (class);
-
- object_class->finalize = pango_x_font_map_finalize;
-
- font_map_class->load_font = pango_x_font_map_load_font;
- font_map_class->list_families = pango_x_font_map_list_families;
- font_map_class->shape_engine_type = PANGO_RENDER_TYPE_X;
-}
-
-/*
- * Hackery to set up notification when a Display is closed
- */
-static GSList *registered_displays;
-
-static int
-close_display_cb (Display *display,
- XExtCodes *extcodes G_GNUC_UNUSED)
-{
- pango_x_shutdown_display (display);
- registered_displays = g_slist_remove (registered_displays, display);
-
- return 0;
-}
-
-static void
-register_display (Display *display)
-{
- XExtCodes *extcodes;
- GSList *tmp_list;
-
- for (tmp_list = registered_displays; tmp_list; tmp_list = tmp_list->next)
- {
- if (tmp_list->data == display)
- return;
- }
-
- registered_displays = g_slist_prepend (registered_displays, display);
-
- extcodes = XAddExtension (display);
- XESetCloseDisplay (display, extcodes->extension, close_display_cb);
-}
-
-static GList *fontmaps = NULL;
-
-/**
- * pango_x_font_map_for_display:
- * @display: an X #Display.
- *
- * Returns a #PangoXFontMap for @display. Font maps are cached and should
- * not be freed. If the font map for a display is no longer needed, it can
- * be released with pango_x_shutdown_display().
- *
- * Return value: a #PangoXFontMap for @display.
- **/
-PangoFontMap *
-pango_x_font_map_for_display (Display *display)
-{
- PangoXFontMap *xfontmap;
- GList *tmp_list = fontmaps;
- char **xfontnames;
- int num_fonts, i;
- int screen;
- static gboolean registered_modules = FALSE;
-
- g_return_val_if_fail (display != NULL, NULL);
-
- if (!registered_modules)
- {
- registered_modules = TRUE;
-
- for (i = 0; _pango_included_x_modules[i].list; i++)
- pango_module_register (&_pango_included_x_modules[i]);
- }
-
- /* Make sure that the type system is initialized */
- g_type_init ();
-
- while (tmp_list)
- {
- xfontmap = tmp_list->data;
-
- if (xfontmap->display == display)
- return PANGO_FONT_MAP (xfontmap);
-
- tmp_list = tmp_list->next;
- }
-
- xfontmap = g_object_new (PANGO_TYPE_X_FONT_MAP, NULL);
-
- xfontmap->display = display;
- xfontmap->font_cache = pango_x_font_cache_new (display);
- xfontmap->freed_fonts = g_queue_new ();
-
- /* Get a maximum of MAX_FONTS fontnames from the X server.
- Use "-*" as the pattern rather than "-*-*-*-*-*-*-*-*-*-*-*-*-*-*" since
- the latter may result in fonts being returned which don't actually exist.
- xlsfonts also uses "*" so I think it's OK. "-*" gets rid of aliases. */
- xfontnames = XListFonts (xfontmap->display, "-*", MAX_FONTS, &num_fonts);
- if (num_fonts == MAX_FONTS)
- g_warning("MAX_FONTS exceeded. Some fonts may be missing.");
-
- /* Insert the font families into the main table */
- for (i = 0; i < num_fonts; i++)
- {
- if (pango_x_is_xlfd_font_name (xfontnames[i]))
- pango_x_insert_font (xfontmap, xfontnames[i]);
- }
-
- XFreeFontNames (xfontnames);
-
- pango_x_font_map_read_aliases (xfontmap);
-
- fontmaps = g_list_prepend (fontmaps, xfontmap);
-
- /* This is a little screwed up, since different screens on the same display
- * might have different resolutions
- */
- screen = DefaultScreen (xfontmap->display);
- xfontmap->resolution = (PANGO_SCALE * 72.27 / 25.4) * ((double) DisplayWidthMM (xfontmap->display, screen) /
- DisplayWidth (xfontmap->display, screen));
-
- register_display (xfontmap->display);
-
- return PANGO_FONT_MAP (xfontmap);
-}
-
-/**
- * pango_x_shutdown_display:
- * @display: an X #Display
- *
- * Free cached resources for the given X display structure.
- **/
-void
-pango_x_shutdown_display (Display *display)
-{
- GList *tmp_list;
-
- g_return_if_fail (display != NULL);
-
- tmp_list = fontmaps;
- while (tmp_list)
- {
- PangoXFontMap *xfontmap = tmp_list->data;
-
- if (xfontmap->display == display)
- {
- fontmaps = g_list_delete_link (fontmaps, tmp_list);
- pango_x_fontmap_cache_clear (xfontmap);
- g_object_unref (xfontmap);
-
- return;
- }
-
- tmp_list = tmp_list->next;
- }
-}
-
-static void
-pango_x_font_map_finalize (GObject *object)
-{
- PangoXFontMap *xfontmap = PANGO_X_FONT_MAP (object);
-
- g_list_foreach (xfontmap->freed_fonts->head, (GFunc)g_object_unref, NULL);
- g_queue_free (xfontmap->freed_fonts);
-
- pango_x_font_cache_free (xfontmap->font_cache);
-
- /* FIXME: None of these hashtables free their key/values
- g_hash_table_destroy (xfontmap->families);
- g_hash_table_destroy (xfontmap->size_infos);
- g_hash_table_destroy (xfontmap->to_atom_cache);
- g_hash_table_destroy (xfontmap->from_atom_cache);
- */
-
- fontmaps = g_list_remove (fontmaps, xfontmap);
-
- G_OBJECT_CLASS (pango_x_font_map_parent_class)->finalize (object);
-}
-
-static void
-list_families_foreach (gpointer key G_GNUC_UNUSED,
- gpointer value,
- gpointer user_data)
-{
- GSList **list = user_data;
-
- *list = g_slist_prepend (*list, value);
-}
-
-static void
-pango_x_font_map_list_families (PangoFontMap *fontmap,
- PangoFontFamily ***families,
- int *n_families)
-{
- GSList *family_list = NULL;
- GSList *tmp_list;
- PangoXFontMap *xfontmap = (PangoXFontMap *)fontmap;
-
- if (!n_families)
- return;
-
- g_hash_table_foreach (xfontmap->families, list_families_foreach, &family_list);
-
- *n_families = g_slist_length (family_list);
-
- if (families)
- {
- int i = 0;
-
- *families = g_new (PangoFontFamily *, *n_families);
-
- tmp_list = family_list;
- while (tmp_list)
- {
- (*families)[i] = tmp_list->data;
- i++;
- tmp_list = tmp_list->next;
- }
- }
-
- g_slist_free (family_list);
-}
-
-static PangoXFamily *
-pango_x_get_font_family (PangoXFontMap *xfontmap,
- const char *family_name)
-{
- PangoXFamily *font_family = g_hash_table_lookup (xfontmap->families, family_name);
- if (!font_family)
- {
- font_family = g_object_new (PANGO_X_TYPE_FAMILY, NULL);
- font_family->family_name = g_strdup (family_name);
- font_family->font_entries = NULL;
-
- g_hash_table_insert (xfontmap->families, font_family->family_name, font_family);
- }
-
- return font_family;
-}
-
-static PangoFont *
-pango_x_font_map_load_font (PangoFontMap *fontmap,
- PangoContext *context G_GNUC_UNUSED,
- const PangoFontDescription *description)
-{
- PangoXFontMap *xfontmap = (PangoXFontMap *)fontmap;
- PangoXFamily *font_family;
- PangoFont *result = NULL;
- GSList *tmp_list;
- const gchar *family;
- gchar *name;
- gint size;
-
- g_return_val_if_fail (description != NULL, NULL);
-
- family = pango_font_description_get_family (description);
- name = g_ascii_strdown (family ? family : "", -1);
- size = pango_font_description_get_size (description);
-
- if (size < 0)
- return NULL;
-
- font_family = g_hash_table_lookup (xfontmap->families, name);
- if (font_family)
- {
- PangoXFace *best_match = NULL;
-
- tmp_list = font_family->font_entries;
- while (tmp_list)
- {
- PangoXFace *font_entry = tmp_list->data;
-
- if (pango_font_description_better_match (description,
- best_match ? best_match->description : NULL,
- font_entry->description))
- best_match = font_entry;
-
- tmp_list = tmp_list->next;
- }
-
- if (best_match)
- {
- GSList *tmp_list = best_match->cached_fonts;
-
- while (tmp_list)
- {
- PangoXFont *xfont = tmp_list->data;
- if (xfont->size == size)
- {
- result = (PangoFont *)xfont;
-
- g_object_ref (result);
- if (xfont->in_cache)
- pango_x_fontmap_cache_remove (fontmap, xfont);
-
- break;
- }
- tmp_list = tmp_list->next;
- }
-
- if (!result)
- {
- PangoXFont *xfont = pango_x_font_new (fontmap, best_match->xlfd, size);
-
- xfont->xface = best_match;
- best_match->cached_fonts = g_slist_prepend (best_match->cached_fonts, xfont);
-
- result = (PangoFont *)xfont;
- }
- }
- }
-
- g_free (name);
- return result;
-}
-
-
-/************************
- * Coverage Map Caching *
- ************************/
-
-/* We need to be robust against errors accessing the coverage
- * cache window, since it is not our window. So we temporarily
- * set this error handler while accessing it. The error_occurred
- * global allows us to tell whether an error occurred for
- * XChangeProperty
- */
-static gboolean error_occurred;
-
-static int
-ignore_error (Display *d G_GNUC_UNUSED,
- XErrorEvent *e G_GNUC_UNUSED)
-{
- return 0;
-}
-
-/* Retrieve the coverage window for the given display.
- * We look for a property on the root window, and then
- * check that the window that property points to also
- * has the same property pointing to itself. The second
- * check allows us to make sure that a stale property
- * isn't just pointing to some other apps window
- */
-static Window
-pango_x_real_get_coverage_win (Display *display)
-{
- Atom type;
- int format;
- gulong n_items;
- gulong bytes_after;
- guchar *data;
- Window retval = None;
- int (*old_handler) (Display *, XErrorEvent *);
-
- Atom coverage_win_atom = XInternAtom (display,
- "PANGO_COVERAGE_WIN",
- False);
-
- XGetWindowProperty (display,
- DefaultRootWindow (display),
- coverage_win_atom,
- 0, 4,
- False, XA_WINDOW,
- &type, &format, &n_items, &bytes_after,
- &data);
-
- if (type == XA_WINDOW)
- {
- if (format == 32 && n_items == 1 && bytes_after == 0)
- retval = *(Atom *)data;
-
- XFree (data);
- }
-
- old_handler= XSetErrorHandler (ignore_error);
-
- if (XGetWindowProperty (display,
- retval,
- coverage_win_atom,
- 0, 4,
- False, XA_WINDOW,
- &type, &format, &n_items, &bytes_after,
- &data) == Success &&
- type == XA_WINDOW)
- {
- if (format != 32 || n_items != 1 || bytes_after != 0 ||
- *(Atom *)data != retval)
- retval = None;
-
- XFree (data);
- }
- else
- retval = None;
-
- XSync (display, False);
- XSetErrorHandler (old_handler);
-
- return retval;
-}
-
-/* Find or create the persistent window for caching font coverage
- * information.
- *
- * To assure atomic creation, we first look for the window, then if we
- * don't find it, grab the server, look for it again, and then if that
- * still didn't find it, create it and ungrab.
- */
-static Window
-pango_x_get_coverage_win (PangoXFontMap *xfontmap)
-{
- if (!xfontmap->coverage_win)
- xfontmap->coverage_win = pango_x_real_get_coverage_win (xfontmap->display);
-
- if (!xfontmap->coverage_win)
- {
- Display *persistant_display;
-
- persistant_display = XOpenDisplay (DisplayString (xfontmap->display));
- if (!persistant_display)
- {
- g_warning ("Cannot create or retrieve display for font coverage cache");
- return None;
- }
-
- XGrabServer (persistant_display);
-
- xfontmap->coverage_win = pango_x_real_get_coverage_win (xfontmap->display);
- if (!xfontmap->coverage_win)
- {
- XSetWindowAttributes attr;
-
- attr.override_redirect = True;
-
- XSetCloseDownMode (persistant_display, RetainPermanent);
-
- xfontmap->coverage_win =
- XCreateWindow (persistant_display,
- DefaultRootWindow (persistant_display),
- -100, -100, 10, 10, 0, 0,
- InputOnly, (Visual *)CopyFromParent,
- CWOverrideRedirect, &attr);
-
- XChangeProperty (persistant_display,
- DefaultRootWindow (persistant_display),
- XInternAtom (persistant_display,
- "PANGO_COVERAGE_WIN",
- FALSE),
- XA_WINDOW,
- 32, PropModeReplace,
- (guchar *)&xfontmap->coverage_win, 1);
-
-
- XChangeProperty (persistant_display,
- xfontmap->coverage_win,
- XInternAtom (persistant_display,
- "PANGO_COVERAGE_WIN",
- FALSE),
- XA_WINDOW,
- 32, PropModeReplace,
- (guchar *)&xfontmap->coverage_win, 1);
- }
-
- XUngrabServer (persistant_display);
-
- XSync (persistant_display, False);
- XCloseDisplay (persistant_display);
- }
-
- return xfontmap->coverage_win;
-}
-
-/* Find the cached value for the coverage map on the
- * coverage cache window, if it exists. *atom is set
- * to the interned value of str for later use in storing
- * the property if the lookup fails
- */
-static PangoCoverage *
-pango_x_get_cached_coverage (PangoXFontMap *xfontmap,
- const char *str,
- Atom *atom)
-{
- int (*old_handler) (Display *, XErrorEvent *);
- Window coverage_win;
- PangoCoverage *result = NULL;
-
- Atom type;
- int format;
- int tries = 5;
- gulong n_items;
- gulong bytes_after;
- guchar *data;
-
- *atom = XInternAtom (xfontmap->display, str, False);
-
- while (tries--)
- {
- coverage_win = pango_x_get_coverage_win (xfontmap);
-
- if (!coverage_win)
- return NULL;
-
- old_handler= XSetErrorHandler (ignore_error);
-
- if (XGetWindowProperty (xfontmap->display,
- coverage_win, *atom,
- 0, G_MAXLONG,
- False, XA_STRING,
- &type, &format, &n_items, &bytes_after,
- &data) == Success
- && type == XA_STRING)
- {
- if (format == 8 && bytes_after == 0)
- result = pango_coverage_from_bytes (data, n_items);
-
- XSetErrorHandler (old_handler);
- XFree (data);
- break;
- }
- else
- {
- /* Window disappeared out from under us */
- XSetErrorHandler (old_handler);
- xfontmap->coverage_win = None;
- }
-
- }
-
- return result;
-}
-
-/* Store the given coverage map on the coverage cache window.
- * atom is the intern'ed value of the string that identifies
- * the cache entry.
- */
-static void
-pango_x_store_cached_coverage (PangoXFontMap *xfontmap,
- Atom atom,
- PangoCoverage *coverage)
-{
- int (*old_handler) (Display *, XErrorEvent *);
- guchar *bytes;
- gint size;
-
- int tries = 5;
-
- pango_coverage_to_bytes (coverage, &bytes, &size);
-
- while (tries--)
- {
- Window coverage_win = pango_x_get_coverage_win (xfontmap);
-
- if (!coverage_win)
- break;
-
- old_handler = XSetErrorHandler (ignore_error);
- error_occurred = False;
-
- XChangeProperty (xfontmap->display,
- coverage_win,
- atom,
- XA_STRING,
- 8, PropModeReplace,
- bytes, size);
-
- XSync (xfontmap->display, False);
- XSetErrorHandler (old_handler);
-
- if (!error_occurred)
- break;
- else
- {
- /* Window disappeared out from under us */
- XSetErrorHandler (old_handler);
- xfontmap->coverage_win = None;
- }
- }
-
- g_free (bytes);
-}
-
-
-static void
-pango_x_font_map_read_alias_file (PangoXFontMap *xfontmap,
- const char *filename)
-{
- FILE *infile;
- char **xlfds;
- int lineno = 0;
- int i;
- PangoXFace *xface = NULL;
-
- infile = fopen (filename, "r");
- if (infile)
- {
- GString *line_buf = g_string_new (NULL);
- GString *tmp_buf = g_string_new (NULL);
- gint lines_read;
-
- while ((lines_read = pango_read_line (infile, line_buf)))
- {
- PangoXFamily *font_family;
- PangoStyle style;
- PangoVariant variant;
- PangoWeight weight;
- PangoStretch stretch;
-
- const char *p = line_buf->str;
-
- lineno += lines_read;
-
- if (!pango_skip_space (&p))
- continue;
-
- if (!pango_scan_string (&p, tmp_buf))
- goto error;
-
- xface = g_object_new (PANGO_X_TYPE_FACE, NULL);
- xface->xlfd = NULL;
- xface->description = pango_font_description_new ();
-
- g_string_ascii_down (tmp_buf);
- pango_font_description_set_family (xface->description, tmp_buf->str);
-
- if (!pango_scan_string (&p, tmp_buf))
- goto error;
-
- if (!pango_parse_style (tmp_buf->str, &style, TRUE))
- goto error;
- pango_font_description_set_style (xface->description, style);
-
- if (!pango_scan_string (&p, tmp_buf))
- goto error;
-
- if (!pango_parse_variant (tmp_buf->str, &variant, TRUE))
- goto error;
- pango_font_description_set_variant (xface->description, variant);
-
- if (!pango_scan_string (&p, tmp_buf))
- goto error;
-
- if (!pango_parse_weight (tmp_buf->str, &weight, TRUE))
- goto error;
- pango_font_description_set_weight (xface->description, weight);
-
- if (!pango_scan_string (&p, tmp_buf))
- goto error;
-
- if (!pango_parse_stretch (tmp_buf->str, &stretch, TRUE))
- goto error;
- pango_font_description_set_stretch (xface->description, stretch);
-
- if (!pango_scan_string (&p, tmp_buf))
- goto error;
-
- /* Remove excess whitespace and check for complete fields */
-
- xlfds = g_strsplit (tmp_buf->str, ",", -1);
- for (i=0; xlfds[i]; i++)
- {
- char *trimmed = pango_trim_string (xlfds[i]);
- g_free (xlfds[i]);
- xlfds[i] = trimmed;
-
- if (!pango_x_is_xlfd_font_name (xlfds[i]))
- {
- g_warning ("XLFD '%s' must be complete (14 fields)", xlfds[i]);
- g_strfreev (xlfds);
- goto error;
- }
- }
-
- xface->xlfd = g_strjoinv (",", xlfds);
- g_strfreev (xlfds);
-
- /* Insert the font entry into our structures */
-
- font_family = pango_x_get_font_family (xfontmap,
- pango_font_description_get_family (xface->description));
- font_family->font_entries = g_slist_prepend (font_family->font_entries, xface);
- xfontmap->n_fonts++;
-
- /* Save space by consolidating duplicated string */
- pango_font_description_set_family_static (xface->description, font_family->family_name);
- xface->cached_fonts = NULL;
- xface->coverage = NULL;
- }
-
- if (ferror (infile))
- g_warning ("Error reading '%s': %s", filename, g_strerror(errno));
-
- goto out;
-
- error:
- if (xface)
- {
- g_free (xface->xlfd);
- if (xface->description)
- pango_font_description_free (xface->description);
- g_free (xface);
- }
-
- g_warning ("Error parsing line %d of alias file '%s'", lineno, filename);
-
- out:
- g_string_free (tmp_buf, TRUE);
- g_string_free (line_buf, TRUE);
-
- fclose (infile);
- }
-
-}
-
-static void
-pango_x_font_map_read_aliases (PangoXFontMap *xfontmap)
-{
- char **files;
- char *user_file;
- char *files_str = pango_config_key_get ("PangoX/AliasFiles");
- int n;
-
- if (!files_str)
- {
- user_file = g_build_filename (g_get_user_config_dir (), "pango", "pangox.aliases", NULL);
-
- files_str = g_strconcat (user_file, ":" SYSCONFDIR "/pango/pangox.aliases", NULL);
- g_free (user_file);
- }
-
- files = pango_split_file_list (files_str);
-
- n = 0;
- while (files[n])
- n++;
-
- while (n-- > 0)
- pango_x_font_map_read_alias_file (xfontmap, files[n]);
-
- g_strfreev (files);
- g_free (files_str);
-}
-
-/*
- * Returns %TRUE if the fontname is a valid XLFD.
- * (It just checks if the number of dashes is 14, and that each
- * field < XLFD_MAX_FIELD_LEN characters long - that's not in the XLFD but it
- * makes it easier for me).
- */
-static gboolean
-pango_x_is_xlfd_font_name (const char *fontname)
-{
- int i = 0;
- int field_len = 0;
-
- while (*fontname)
- {
- if (*fontname++ == '-')
- {
- if (field_len > XLFD_MAX_FIELD_LEN) return FALSE;
- field_len = 0;
- i++;
- }
- else
- field_len++;
- }
-
- return (i == 14) ? TRUE : FALSE;
-}
-
-static int
-pango_x_get_size (PangoXFontMap *xfontmap, const char *fontname)
-{
- char size_buffer[XLFD_MAX_FIELD_LEN];
- int size;
-
- if (!pango_x_get_xlfd_field (fontname, XLFD_PIXELS, size_buffer))
- return -1;
-
- size = atoi (size_buffer);
- if (size != 0)
- {
- return (int)(0.5 + size * xfontmap->resolution);
- }
- else
- {
- /* We use the trick that scaled bitmaps have a non-zero RESOLUTION_X, while
- * actual scaleable fonts have a zero RESOLUTION_X */
- if (!pango_x_get_xlfd_field (fontname, XLFD_RESOLUTION_X, size_buffer))
- return -1;
-
- if (atoi (size_buffer) == 0)
- return 0;
- else
- return -1;
- }
-}
-
-static char *
-pango_x_get_identifier (const char *fontname)
-{
- const char *p = fontname;
- const char *start;
- int n_dashes = 0;
-
- while (n_dashes < 2)
- {
- if (*p == '-')
- n_dashes++;
- p++;
- }
-
- start = p;
-
- while (n_dashes < 6)
- {
- if (*p == '-')
- n_dashes++;
- p++;
- }
-
- return g_strndup (start, (p - 1 - start));
-}
-
-/*
- * This fills the buffer with the specified field from the X Logical Font
- * Description name, and returns it. If fontname is %NULL or the field is
- * longer than XFLD_MAX_FIELD_LEN it returns %NULL.
- * Note: For the charset field, we also return the encoding, e.g. 'iso8859-1'.
- */
-static char*
-pango_x_get_xlfd_field (const char *fontname,
- FontField field_num,
- char *buffer)
-{
- const char *t1, *t2;
- char *p;
- int countdown, len, num_dashes;
-
- if (!fontname)
- return NULL;
-
- /* we assume this is a valid fontname...that is, it has 14 fields */
-
- countdown = field_num;
- t1 = fontname;
- while (*t1 && (countdown >= 0))
- if (*t1++ == '-')
- countdown--;
-
- num_dashes = (field_num == XLFD_CHARSET) ? 2 : 1;
- for (t2 = t1; *t2; t2++)
- {
- if (*t2 == '-' && --num_dashes == 0)
- break;
- }
-
- if (t1 != t2)
- {
- /* Check we don't overflow the buffer */
- len = (long) t2 - (long) t1;
- if (len > XLFD_MAX_FIELD_LEN - 1)
- return NULL;
- strncpy (buffer, t1, len);
- buffer[len] = 0;
- /* Convert to lower case. */
- for (p = buffer; *p; p++)
- *p = g_ascii_tolower (*p);
- }
- else
- strcpy(buffer, "(nil)");
-
- return buffer;
-}
-
-/* This inserts the given fontname into the FontInfo table.
- If a FontInfo already exists with the same family and foundry, then the
- fontname is added to the FontInfos list of fontnames, else a new FontInfo
- is created and inserted in alphabetical order in the table. */
-static void
-pango_x_insert_font (PangoXFontMap *xfontmap,
- const char *fontname)
-{
- PangoFontDescription *description;
- char *family_name;
- PangoStyle style;
- PangoVariant variant;
- PangoWeight weight;
- PangoStretch stretch;
- char family_buffer[XLFD_MAX_FIELD_LEN];
- char weight_buffer[XLFD_MAX_FIELD_LEN];
- char slant_buffer[XLFD_MAX_FIELD_LEN];
- char set_width_buffer[XLFD_MAX_FIELD_LEN];
- GSList *tmp_list;
- PangoXFamily *font_family;
- PangoXFace *xface;
- PangoXSizeInfo *size_info;
- char *identifier;
- unsigned int i;
-
- /* First insert the XLFD into the list of XLFDs for the "identifier" - which
- * is the 2-4th fields of the XLFD
- */
- identifier = pango_x_get_identifier (fontname);
- size_info = g_hash_table_lookup (xfontmap->size_infos, identifier);
- if (!size_info)
- {
- size_info = g_slice_new (PangoXSizeInfo);
- size_info->identifier = identifier;
- size_info->xlfds = NULL;
-
- g_hash_table_insert (xfontmap->size_infos, identifier, size_info);
- }
- else
- g_free (identifier);
-
- size_info->xlfds = g_slist_prepend (size_info->xlfds, g_strdup (fontname));
-
- /* Convert the XLFD into a PangoFontDescription */
-
- family_name = pango_x_get_xlfd_field (fontname, XLFD_FAMILY, family_buffer);
- if (!family_name)
- return;
-
- style = PANGO_STYLE_NORMAL;
- if (pango_x_get_xlfd_field (fontname, XLFD_SLANT, slant_buffer))
- {
- for (i=0; i<G_N_ELEMENTS(styles_map); i++)
- {
- if (!strcmp (styles_map[i].text, slant_buffer))
- {
- style = styles_map[i].value;
- break;
- }
- }
- }
- else
- strcpy (slant_buffer, "*");
-
- variant = PANGO_VARIANT_NORMAL;
-
- weight = PANGO_WEIGHT_NORMAL;
- if (pango_x_get_xlfd_field (fontname, XLFD_WEIGHT, weight_buffer))
- {
- for (i=0; i<G_N_ELEMENTS(weights_map); i++)
- {
- if (!strcmp (weights_map[i].text, weight_buffer))
- {
- weight = weights_map[i].value;
- break;
- }
- }
- }
- else
- strcpy (weight_buffer, "*");
-
- stretch = PANGO_STRETCH_NORMAL;
- if (pango_x_get_xlfd_field (fontname, XLFD_SET_WIDTH, set_width_buffer))
- {
- for (i=0; i<G_N_ELEMENTS(stretches_map); i++)
- {
- if (!strcmp (stretches_map[i].text, set_width_buffer))
- {
- stretch = stretches_map[i].value;
- break;
- }
- }
- }
- else
- strcpy (set_width_buffer, "*");
-
- font_family = pango_x_get_font_family (xfontmap, family_name);
-
- tmp_list = font_family->font_entries;
- while (tmp_list)
- {
- xface = tmp_list->data;
-
- if (pango_font_description_get_style (xface->description) == style &&
- pango_font_description_get_weight (xface->description) == weight &&
- pango_font_description_get_stretch (xface->description) == stretch &&
- pango_font_description_get_variant (xface->description) == variant)
- return;
-
- tmp_list = tmp_list->next;
- }
-
- description = pango_font_description_new ();
- pango_font_description_set_family_static (description, font_family->family_name);
- pango_font_description_set_style (description, style);
- pango_font_description_set_weight (description, weight);
- pango_font_description_set_stretch (description, stretch);
- pango_font_description_set_variant (description, variant);
-
- xface = g_object_new (PANGO_X_TYPE_FACE, NULL);
- xface->description = description;
- xface->cached_fonts = NULL;
- xface->coverage = NULL;
-
- xface->xlfd = g_strconcat ("-*-",
- family_buffer,
- "-",
- weight_buffer,
- "-",
- slant_buffer,
- "-",
- set_width_buffer,
- "--*-*-*-*-*-*-*-*",
- NULL);
-
- font_family->font_entries = g_slist_append (font_family->font_entries, xface);
- xfontmap->n_fonts++;
-}
-
-/* Compare the tail of a to b */
-static gboolean
-match_end (const char *a, const char *b)
-{
- size_t len_a = strlen (a);
- size_t len_b = strlen (b);
-
- if (len_b > len_a)
- return FALSE;
- else
- return (strcmp (a + len_a - len_b, b) == 0);
-}
-
-/* Given a XLFD, charset and size, find the best matching installed X font.
- * The XLFD must be a full XLFD (14 fields)
- */
-char *
-pango_x_make_matching_xlfd (PangoFontMap *fontmap, char *xlfd, const char *charset, int size)
-{
- PangoXFontMap *xfontmap;
-
- GSList *tmp_list;
- PangoXSizeInfo *size_info;
- char *identifier;
- char *closest_match = NULL;
- gint match_distance = 0;
- gboolean match_scaleable = FALSE;
- char *result = NULL;
-
- char *dash_charset;
-
- xfontmap = PANGO_X_FONT_MAP (fontmap);
-
- dash_charset = g_strconcat ("-", charset, NULL);
-
- if (!match_end (xlfd, "-*-*") && !match_end (xlfd, dash_charset))
- {
- g_free (dash_charset);
- return NULL;
- }
-
- identifier = pango_x_get_identifier (xlfd);
- size_info = g_hash_table_lookup (xfontmap->size_infos, identifier);
- g_free (identifier);
-
- if (!size_info)
- {
- g_free (dash_charset);
- return NULL;
- }
-
- tmp_list = size_info->xlfds;
- while (tmp_list)
- {
- char *tmp_xlfd = tmp_list->data;
-
- if (match_end (tmp_xlfd, dash_charset))
- {
- int font_size = pango_x_get_size (xfontmap, tmp_xlfd);
-
- if (size != -1)
- {
- int new_distance = (font_size == 0) ? 0 : abs (font_size - size);
-
- if (!closest_match ||
- new_distance < match_distance ||
- (new_distance < PANGO_SCALE && match_scaleable && font_size != 0))
- {
- closest_match = tmp_xlfd;
- match_scaleable = (font_size == 0);
- match_distance = new_distance;
- }
- }
- }
-
- tmp_list = tmp_list->next;
- }
-
- if (closest_match)
- {
- if (match_scaleable)
- {
- char *prefix_end, *p;
- int n_dashes = 0;
- int target_size;
- char *prefix;
-
- /* OK, we have a match; let's modify it to fit this size and charset */
-
- p = closest_match;
- while (n_dashes < 6)
- {
- if (*p == '-')
- n_dashes++;
- p++;
- }
-
- prefix_end = p - 1;
-
- while (n_dashes < 9)
- {
- if (*p == '-')
- n_dashes++;
- p++;
- }
-
- target_size = (int)((double)size / xfontmap->resolution + 0.5);
- prefix = g_strndup (closest_match, prefix_end - closest_match);
- result = g_strdup_printf ("%s--%d-*-*-*-*-*-%s", prefix, target_size, charset);
- g_free (prefix);
- }
- else
- {
- result = g_strdup (closest_match);
- }
- }
-
- g_free (dash_charset);
-
- return result;
-}
-
-/**
- * pango_x_font_map_get_font_cache:
- * @font_map: a #PangoXFontMap.
- *
- * Obtains the font cache associated with the given font map.
- *
- * Return value: the #PangoXFontCache of @font_map.
- **/
-PangoXFontCache *
-pango_x_font_map_get_font_cache (PangoFontMap *font_map)
-{
- g_return_val_if_fail (font_map != NULL, NULL);
- g_return_val_if_fail (PANGO_X_IS_FONT_MAP (font_map), NULL);
-
- return PANGO_X_FONT_MAP (font_map)->font_cache;
-}
-
-Display *
-pango_x_fontmap_get_display (PangoFontMap *fontmap)
-{
- g_return_val_if_fail (fontmap != NULL, NULL);
- g_return_val_if_fail (PANGO_X_IS_FONT_MAP (fontmap), NULL);
-
- return PANGO_X_FONT_MAP (fontmap)->display;
-}
-
-void
-pango_x_fontmap_cache_add (PangoFontMap *fontmap,
- PangoXFont *xfont)
-{
- PangoXFontMap *xfontmap = PANGO_X_FONT_MAP (fontmap);
-
- if (xfontmap->freed_fonts->length == MAX_FREED_FONTS)
- {
- PangoXFont *old_font = g_queue_pop_tail (xfontmap->freed_fonts);
- g_object_unref (old_font);
- }
-
- g_object_ref (xfont);
- g_queue_push_head (xfontmap->freed_fonts, xfont);
- xfont->in_cache = TRUE;
-}
-
-void
-pango_x_fontmap_cache_remove (PangoFontMap *fontmap,
- PangoXFont *xfont)
-{
- PangoXFontMap *xfontmap = PANGO_X_FONT_MAP (fontmap);
-
- GList *link = g_list_find (xfontmap->freed_fonts->head, xfont);
- if (link == xfontmap->freed_fonts->tail)
- {
- xfontmap->freed_fonts->tail = xfontmap->freed_fonts->tail->prev;
- if (xfontmap->freed_fonts->tail)
- xfontmap->freed_fonts->tail->next = NULL;
- }
-
- xfontmap->freed_fonts->head = g_list_delete_link (xfontmap->freed_fonts->head, link);
- xfontmap->freed_fonts->length--;
- xfont->in_cache = FALSE;
-
- g_object_unref (xfont);
-}
-
-static void
-pango_x_fontmap_cache_clear (PangoXFontMap *xfontmap)
-{
- g_list_foreach (xfontmap->freed_fonts->head, (GFunc)g_object_unref, NULL);
- g_list_free (xfontmap->freed_fonts->head);
- xfontmap->freed_fonts->head = NULL;
- xfontmap->freed_fonts->tail = NULL;
- xfontmap->freed_fonts->length = 0;
-}
-
-
-Atom
-pango_x_fontmap_atom_from_name (PangoFontMap *fontmap,
- const char *atomname)
-{
- PangoXFontMap *xfm = PANGO_X_FONT_MAP(fontmap);
- gpointer found;
- Atom atom;
-
- found = g_hash_table_lookup (xfm->to_atom_cache, atomname);
-
- if (found)
- return (Atom)(GPOINTER_TO_UINT(found));
-
- atom = XInternAtom (xfm->display, atomname, FALSE);
- g_hash_table_insert (xfm->to_atom_cache, g_strdup (atomname),
- (gpointer)atom);
-
- return atom;
-}
-
-
-const char *
-pango_x_fontmap_name_from_atom (PangoFontMap *fontmap,
- Atom atom)
-{
- PangoXFontMap *xfm = PANGO_X_FONT_MAP(fontmap);
- gpointer found;
- char *name, *name2;
-
- found = g_hash_table_lookup (xfm->from_atom_cache, GUINT_TO_POINTER(atom));
-
- if (found)
- return (const char *)found;
-
- name = XGetAtomName (xfm->display, atom);
- name2 = g_strdup (name);
- XFree (name);
-
- g_hash_table_insert (xfm->from_atom_cache, (gpointer)atom, name2);
-
- return name2;
-}
-
-/*
- * PangoXFace
- */
-
-static PangoFontDescription *
-pango_x_face_describe (PangoFontFace *face)
-{
- PangoXFace *xface = PANGO_X_FACE (face);
-
- return pango_font_description_copy (xface->description);
-}
-
-static const char *
-pango_x_face_get_face_name (PangoFontFace *face)
-{
- PangoXFace *xface = PANGO_X_FACE (face);
-
- if (!xface->face_name)
- {
- PangoFontDescription *desc = pango_font_face_describe (face);
-
- pango_font_description_unset_fields (desc,
- PANGO_FONT_MASK_FAMILY | PANGO_FONT_MASK_SIZE);
-
- xface->face_name = pango_font_description_to_string (desc);
- pango_font_description_free (desc);
- }
-
- return xface->face_name;
-}
-
-typedef PangoFontFaceClass PangoXFaceClass;
-G_DEFINE_TYPE (PangoXFace, pango_x_face, PANGO_TYPE_FONT_FACE);
-
-static void
-pango_x_face_class_init (PangoXFaceClass *class)
-{
- class->describe = pango_x_face_describe;
- class->get_face_name = pango_x_face_get_face_name;
-}
-
-static void
-pango_x_face_init (PangoXFace *self)
-{
-}
-
-/* Cut and paste here to avoid an inter-module dependency */
-static PangoCoverageLevel
-engine_shape_covers (PangoEngineShape *engine,
- PangoFont *font,
- PangoLanguage *language,
- gunichar wc)
-{
- g_return_val_if_fail (PANGO_IS_ENGINE_SHAPE (engine), PANGO_COVERAGE_NONE);
- g_return_val_if_fail (PANGO_IS_FONT (font), PANGO_COVERAGE_NONE);
-
- return PANGO_ENGINE_SHAPE_GET_CLASS (engine)->covers (engine,
- font,
- language,
- wc);
-}
-
-PangoCoverage *
-pango_x_face_get_coverage (PangoXFace *xface,
- PangoFont *font,
- PangoLanguage *language)
-{
- PangoXFont *xfont;
- PangoXFontMap *xfontmap = NULL; /* Quiet gcc */
- PangoCoverage *result = NULL;
- Atom atom = None;
-
- if (xface)
- {
- if (xface->coverage)
- {
- pango_coverage_ref (xface->coverage);
- return xface->coverage;
- }
-
- xfont = (PangoXFont *)font;
-
- xfontmap = (PangoXFontMap *)pango_x_font_map_for_display (xfont->display);
- if (xface->xlfd)
- {
- const char *lang_str = language ? pango_language_to_string (language) : "*";
-
- char *str = g_strconcat (lang_str, "|", xface->xlfd, NULL);
- result = pango_x_get_cached_coverage (xfontmap, str, &atom);
- g_free (str);
- }
- }
-
- if (!result)
- {
- PangoMap *shape_map;
- PangoEngineShape *engine;
- gunichar wc;
-
- result = pango_coverage_new ();
-
- shape_map = pango_x_get_shaper_map (language);
- engine = (PangoEngineShape *)pango_map_get_engine (shape_map, PANGO_SCRIPT_COMMON);
-
- for (wc = 0; wc < 65536; wc++)
- {
- PangoCoverageLevel level;
-
- level = engine_shape_covers (engine, font, language, wc);
- if (level != PANGO_COVERAGE_NONE)
- pango_coverage_set (result, wc, level);
- }
-
- if (atom)
- pango_x_store_cached_coverage (xfontmap, atom, result);
- }
-
- if (xface)
- {
- xface->coverage = result;
- pango_coverage_ref (result);
- }
-
- return result;
-}
-
-void
-pango_x_face_remove (PangoXFace *xface,
- PangoFont *font)
-{
- xface->cached_fonts = g_slist_remove (xface->cached_fonts, font);
-}
-
-/*
- * PangoXFontFamily
- */
-
-static void
-pango_x_family_list_faces (PangoFontFamily *family,
- PangoFontFace ***faces,
- int *n_faces)
-{
- PangoXFamily *xfamily = PANGO_X_FAMILY (family);
-
- *n_faces = g_slist_length (xfamily->font_entries);
- if (faces)
- {
- GSList *tmp_list;
- int i = 0;
-
- *faces = g_new (PangoFontFace *, *n_faces);
-
- tmp_list = xfamily->font_entries;
- while (tmp_list)
- {
- (*faces)[i++] = tmp_list->data;
- tmp_list = tmp_list->next;
- }
- }
-}
-
-static const char *
-pango_x_family_get_name (PangoFontFamily *family)
-{
- PangoXFamily *xfamily = PANGO_X_FAMILY (family);
-
- return xfamily->family_name;
-}
-
-G_DEFINE_TYPE (PangoXFamily, pango_x_family, PANGO_TYPE_FONT_FAMILY);
-
-static void
-pango_x_family_class_init (PangoXFamilyClass *klass)
-{
- PangoFontFamilyClass *font_family_class = PANGO_FONT_FAMILY_CLASS (klass);
-
- font_family_class->list_faces = pango_x_family_list_faces;
- font_family_class->get_name = pango_x_family_get_name;
-}
-
-static void
-pango_x_family_init (PangoXFamily *self)
-{
-}
diff --git a/pango/pangox-private.h b/pango/pangox-private.h
deleted file mode 100644
index e28ab8b7..00000000
--- a/pango/pangox-private.h
+++ /dev/null
@@ -1,127 +0,0 @@
-/* Pango
- * pangox-private.h:
- *
- * Copyright (C) 1999 Red Hat Software
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __PANGOX_PRIVATE_H__
-#define __PANGOX_PRIVATE_H__
-
-#include <pango/pangox.h>
-#include <pango/pango-modules.h>
-
-typedef struct _PangoXFace PangoXFace;
-typedef struct _PangoXFont PangoXFont;
-typedef struct _PangoXSubfontInfo PangoXSubfontInfo;
-
-struct _PangoXFont
-{
- PangoFont font;
- Display *display;
-
- char **fonts;
- int n_fonts;
- int size;
-
- /* hash table mapping from charset-name to array of PangoXSubfont ids,
- * of length n_fonts
- */
- GHashTable *subfonts_by_charset;
-
- PangoXSubfontInfo **subfonts;
-
- int n_subfonts;
- int max_subfonts;
-
- GSList *metrics_by_lang;
-
- PangoFontMap *fontmap;
- /* If TRUE, font is in cache of recently unused fonts and not otherwise
- * in use.
- */
- gboolean in_cache;
-
- PangoXFace *xface; /* Used to remove cached fonts */
-};
-
-
-#define PANGO_TYPE_X_FONT_MAP (pango_x_font_map_get_type ())
-#define PANGO_X_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_X_FONT_MAP, PangoXFontMap))
-#define PANGO_X_FONT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_X_FONT_MAP, PangoXFontMapClass))
-#define PANGO_X_IS_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_X_FONT_MAP))
-#define PANGO_X_IS_FONT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_X_FONT_MAP))
-#define PANGO_X_FONT_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_X_FONT_MAP, PangoXFontMapClass))
-
-typedef struct _PangoXFontMap PangoXFontMap;
-typedef struct _PangoXFontMapClass PangoXFontMapClass;
-
-struct _PangoXFontMap
-{
- PangoFontMap parent_instance;
-
- Display *display;
-
- PangoXFontCache *font_cache;
- GQueue *freed_fonts;
-
- GHashTable *families;
- GHashTable *size_infos;
-
- GHashTable *to_atom_cache;
- GHashTable *from_atom_cache;
-
- int n_fonts;
-
- double resolution; /* (points / pixel) * PANGO_SCALE */
-
- Window coverage_win;
-};
-
-struct _PangoXFontMapClass
-{
- PangoFontMapClass parent_class;
-};
-
-GType pango_x_font_map_get_type (void) G_GNUC_CONST;
-
-PangoXFont * pango_x_font_new (PangoFontMap *fontmap,
- const char *spec,
- int size);
-PangoMap * pango_x_get_shaper_map (PangoLanguage *language);
-char * pango_x_make_matching_xlfd (PangoFontMap *fontmap,
- char *xlfd,
- const char *charset,
- int size);
-PangoCoverage *pango_x_face_get_coverage (PangoXFace *xface,
- PangoFont *font,
- PangoLanguage *language);
-void pango_x_face_remove (PangoXFace *xface,
- PangoFont *font);
-
-Display * pango_x_fontmap_get_display (PangoFontMap *fontmap);
-void pango_x_fontmap_cache_add (PangoFontMap *fontmap,
- PangoXFont *xfont);
-void pango_x_fontmap_cache_remove (PangoFontMap *fontmap,
- PangoXFont *xfont);
-
-Atom pango_x_fontmap_atom_from_name (PangoFontMap *fontmap,
- const char *atomname);
-const char *pango_x_fontmap_name_from_atom (PangoFontMap *fontmap,
- Atom atom);
-
-#endif /* __PANGOX_PRIVATE_H__ */
diff --git a/pango/pangox.aliases b/pango/pangox.aliases
deleted file mode 100644
index 9b41aa75..00000000
--- a/pango/pangox.aliases
+++ /dev/null
@@ -1,220 +0,0 @@
-# File defining aliases of PangoFontDescription to X font set
-#
-# family style variant weight stretch XLFD
-
-sans normal normal normal normal \
- "-*-helvetica-medium-r-normal--*-*-*-*-*-*-*-*,\
- -*-gulim-medium-r-normal--*-*-*-*-*-*-ksc5601.1987-0,\
- -*-clearlyu-medium-r-normal--*-*-*-*-*-*-iso10646-1,\
- -*-fixed-medium-r-normal--*-*-*-*-*-*-*-*,\
- -kaist-iyagi-bold-r-normal--*-*-*-*-*-*-johab-1,\
- -*-song ti-medium-r-normal--*-*-*-*-*-*-*-*,\
- -freetype-unitamil-medium-r-normal--*-*-*-*-*-*-iso10646-tam,\
- -*-devanagari-medium-r-normal--*-*-*-*-*-*-iso10646-dev,\
- -*-gujarati-medium-r-normal--*-*-*-*-*-*-iso10646-guj,\
- -*-gurmukhi-medium-r-normal--*-*-*-*-*-*-iso10646-gur,\
- -*-bengali-medium-r-normal--*-*-*-*-*-*-iso10646-bng,\
- -*-kannada-medium-r-normal--*-*-*-*-*-*-iso10646-kan,\
- -*-burmese-medium-r-normal--*-*-*-*-*-*-iso10646-brm,\
- -*-buginese-medium-r-normal--*-*-*-*-*-*-iso10646-bgn,\
- -*-oriya-medium-r-normal--*-*-*-*-*-*-iso10646-ori,\
- -daewoo-mincho-medium-r-normal--*-*-*-*-*-*-ksc5601.1987-0"
-
-sans italic normal normal normal \
- "-*-helvetica-medium-o-normal--*-*-*-*-*-*-*-*,\
- -*-gulim-medium-o-normal--*-*-*-*-*-*-ksc5601.1987-0,\
- -*-clearlyu-medium-r-normal--*-*-*-*-*-*-iso10646-1,\
- -*-fixed-medium-r-normal--*-*-*-*-*-*-*-*,\
- -kaist-iyagi-bold-r-normal--*-*-*-*-*-*-johab-1,\
- -*-song ti-medium-r-normal--*-*-*-*-*-*-*-*,\
- -freetype-unitamil-medium-r-normal--*-*-*-*-*-*-iso10646-tam,\
- -*-devanagari-medium-r-normal--*-*-*-*-*-*-iso10646-dev,\
- -*-gujarati-medium-r-normal--*-*-*-*-*-*-iso10646-guj,\
- -*-gurmukhi-medium-r-normal--*-*-*-*-*-*-iso10646-gur,\
- -*-bengali-medium-r-normal--*-*-*-*-*-*-iso10646-bng,\
- -*-kannada-medium-r-normal--*-*-*-*-*-*-iso10646-kan,\
- -*-burmese-medium-r-normal--*-*-*-*-*-*-iso10646-brm,\
- -*-buginese-medium-r-normal--*-*-*-*-*-*-iso10646-bgn,\
- -*-oriya-medium-r-normal--*-*-*-*-*-*-iso10646-ori,\
- -daewoo-mincho-medium-r-normal--*-*-*-*-*-*-ksc5601.1987-0"
-
-sans normal normal bold normal \
- "-*-helvetica-bold-r-normal--*-*-*-*-*-*-*-*,\
- -*-gulim-bold-r-normal--*-*-*-*-*-*-ksc5601.1987-0,\
- -*-clearlyu-medium-r-normal--*-*-*-*-*-*-iso10646-1,\
- -*-fixed-medium-r-normal--*-*-*-*-*-*-*-*,\
- -kaist-iyagi-bold-r-normal--*-*-*-*-*-*-johab-1,\
- -*-song ti-medium-r-normal--*-*-*-*-*-*-*-*,\
- -freetype-unitamil-medium-r-normal--*-*-*-*-*-*-iso10646-tam,\
- -*-devanagari-medium-r-normal--*-*-*-*-*-*-iso10646-dev,\
- -*-gujarati-medium-r-normal--*-*-*-*-*-*-iso10646-guj,\
- -*-gurmukhi-medium-r-normal--*-*-*-*-*-*-iso10646-gur,\
- -*-bengali-medium-r-normal--*-*-*-*-*-*-iso10646-bng,\
- -*-kannada-medium-r-normal--*-*-*-*-*-*-iso10646-kan,\
- -*-burmese-medium-r-normal--*-*-*-*-*-*-iso10646-brm,\
- -*-buginese-medium-r-normal--*-*-*-*-*-*-iso10646-bgn,\
- -*-oriya-medium-r-normal--*-*-*-*-*-*-iso10646-ori,\
- -daewoo-mincho-medium-r-normal--*-*-*-*-*-*-ksc5601.1987-0"
-
-sans italic normal bold normal \
- "-*-helvetica-bold-o-normal--*-*-*-*-*-*-*-*,\
- -*-gulim-bold-o-normal--*-*-*-*-*-*-ksc5601.1987-0,\
- -*-clearlyu-medium-r-normal--*-*-*-*-*-*-iso10646-1,\
- -*-fixed-medium-r-normal--*-*-*-*-*-*-*-*,\
- -kaist-iyagi-bold-r-normal--*-*-*-*-*-*-johab-1,\
- -*-song ti-medium-r-normal--*-*-*-*-*-*-*-*,\
- -freetype-unitamil-medium-r-normal--*-*-*-*-*-*-iso10646-tam,\
- -*-devanagari-medium-r-normal--*-*-*-*-*-*-iso10646-dev,\
- -*-gujarati-medium-r-normal--*-*-*-*-*-*-iso10646-guj,\
- -*-gurmukhi-medium-r-normal--*-*-*-*-*-*-iso10646-gur,\
- -*-bengali-medium-r-normal--*-*-*-*-*-*-iso10646-bng,\
- -*-kannada-medium-r-normal--*-*-*-*-*-*-iso10646-kan,\
- -*-burmese-medium-r-normal--*-*-*-*-*-*-iso10646-brm,\
- -*-buginese-medium-r-normal--*-*-*-*-*-*-iso10646-bgn,\
- -*-oriya-medium-r-normal--*-*-*-*-*-*-iso10646-ori,\
- -daewoo-mincho-medium-r-normal--*-*-*-*-*-*-ksc5601.1987-0"
-
-
-serif normal normal normal normal \
- "-*-times-medium-r-normal--*-*-*-*-*-*-*-*,\
- -*-batang-medium-r-normal--*-*-*-*-*-*-ksc5601.1987-0,\
- -*-clearlyu-medium-r-normal--*-*-*-*-*-*-iso10646-1,\
- -*-fixed-medium-r-normal--*-*-*-*-*-*-*-*,\
- -kaist-iyagi-bold-r-normal--*-*-*-*-*-*-johab-1,\
- -*-song ti-medium-r-normal--*-*-*-*-*-*-*-*,\
- -freetype-unitamil-medium-r-normal--*-*-*-*-*-*-iso10646-tam,\
- -*-devanagari-medium-r-normal--*-*-*-*-*-*-iso10646-dev,\
- -*-gujarati-medium-r-normal--*-*-*-*-*-*-iso10646-guj,\
- -*-gurmukhi-medium-r-normal--*-*-*-*-*-*-iso10646-gur,\
- -*-bengali-medium-r-normal--*-*-*-*-*-*-iso10646-bng,\
- -*-kannada-medium-r-normal--*-*-*-*-*-*-iso10646-kan,\
- -*-burmese-medium-r-normal--*-*-*-*-*-*-iso10646-brm,\
- -*-buginese-medium-r-normal--*-*-*-*-*-*-iso10646-bgn,\
- -*-oriya-medium-r-normal--*-*-*-*-*-*-iso10646-ori,\
- -daewoo-mincho-medium-r-normal--*-*-*-*-*-*-ksc5601.1987-0"
-
-serif italic normal normal normal \
- "-*-times-medium-i-normal--*-*-*-*-*-*-*-*,\
- -*-batang-medium-r-normal--*-*-*-*-*-*-ksc5601.1987-0,\
- -*-clearlyu-medium-r-normal--*-*-*-*-*-*-iso10646-1,\
- -*-fixed-medium-r-normal--*-*-*-*-*-*-*-*,\
- -kaist-iyagi-bold-r-normal--*-*-*-*-*-*-johab-1,\
- -*-song ti-medium-r-normal--*-*-*-*-*-*-*-*,\
- -freetype-unitamil-medium-r-normal--*-*-*-*-*-*-iso10646-tam,\
- -*-devanagari-medium-r-normal--*-*-*-*-*-*-iso10646-dev,\
- -*-gujarati-medium-r-normal--*-*-*-*-*-*-iso10646-guj,\
- -*-gurmukhi-medium-r-normal--*-*-*-*-*-*-iso10646-gur,\
- -*-bengali-medium-r-normal--*-*-*-*-*-*-iso10646-bng,\
- -*-kannada-medium-r-normal--*-*-*-*-*-*-iso10646-kan,\
- -*-burmese-medium-r-normal--*-*-*-*-*-*-iso10646-brm,\
- -*-buginese-medium-r-normal--*-*-*-*-*-*-iso10646-bgn,\
- -*-oriya-medium-r-normal--*-*-*-*-*-*-iso10646-ori,\
- -daewoo-mincho-medium-r-normal--*-*-*-*-*-*-ksc5601.1987-0"
-
-serif normal normal bold normal \
- "-*-times-bold-r-normal--*-*-*-*-*-*-*-*,\
- -*-batang-bold-r-normal--*-*-*-*-*-*-ksc5601.1987-0,\
- -*-clearlyu-medium-r-normal--*-*-*-*-*-*-iso10646-1,\
- -*-fixed-medium-r-normal--*-*-*-*-*-*-*-*,\
- -kaist-iyagi-bold-r-normal--*-*-*-*-*-*-johab-1,\
- -*-song ti-medium-r-normal--*-*-*-*-*-*-*-*,\
- -freetype-unitamil-medium-r-normal--*-*-*-*-*-*-iso10646-tam,\
- -*-devanagari-medium-r-normal--*-*-*-*-*-*-iso10646-dev,\
- -*-gujarati-medium-r-normal--*-*-*-*-*-*-iso10646-guj,\
- -*-gurmukhi-medium-r-normal--*-*-*-*-*-*-iso10646-gur,\
- -*-bengali-medium-r-normal--*-*-*-*-*-*-iso10646-bng,\
- -*-kannada-medium-r-normal--*-*-*-*-*-*-iso10646-kan,\
- -*-burmese-medium-r-normal--*-*-*-*-*-*-iso10646-brm,\
- -*-buginese-medium-r-normal--*-*-*-*-*-*-iso10646-bgn,\
- -*-oriya-medium-r-normal--*-*-*-*-*-*-iso10646-ori,\
- -daewoo-mincho-medium-r-normal--*-*-*-*-*-*-ksc5601.1987-0"
-
-serif italic normal bold normal \
- "-*-times-bold-i-normal--*-*-*-*-*-*-*-*,\
- -*-batang-bold-r-normal--*-*-*-*-*-*-ksc5601.1987-0,\
- -*-clearlyu-medium-r-normal--*-*-*-*-*-*-iso10646-1,\
- -*-fixed-medium-r-normal--*-*-*-*-*-*-*-*,\
- -kaist-iyagi-bold-r-normal--*-*-*-*-*-*-johab-1,\
- -*-song ti-medium-r-normal--*-*-*-*-*-*-*-*,\
- -freetype-unitamil-medium-r-normal--*-*-*-*-*-*-iso10646-tam,\
- -*-devanagari-medium-r-normal--*-*-*-*-*-*-iso10646-dev,\
- -*-gujarati-medium-r-normal--*-*-*-*-*-*-iso10646-guj,\
- -*-gurmukhi-medium-r-normal--*-*-*-*-*-*-iso10646-gur,\
- -*-bengali-medium-r-normal--*-*-*-*-*-*-iso10646-bng,\
- -*-kannada-medium-r-normal--*-*-*-*-*-*-iso10646-kan,\
- -*-burmese-medium-r-normal--*-*-*-*-*-*-iso10646-brm,\
- -*-buginese-medium-r-normal--*-*-*-*-*-*-iso10646-bgn,\
- -*-oriya-medium-r-normal--*-*-*-*-*-*-iso10646-ori,\
- -daewoo-mincho-medium-r-normal--*-*-*-*-*-*-ksc5601.1987-0"
-
-monospace normal normal normal normal \
- "-*-fixed-medium-r-normal--*-*-*-*-*-*-*-*,\
- -*-dotum-medium-r-normal--*-*-*-*-*-*-ksc5601.1987-0,\
- -*-clearlyu-medium-r-normal--*-*-*-*-*-*-iso10646-1,\
- -*-fixed-medium-r-normal--*-*-*-*-*-*-*-*,\
- -kaist-iyagi-bold-r-normal--*-*-*-*-*-*-johab-1,\
- -*-song ti-medium-r-normal--*-*-*-*-*-*-*-*,\
- -freetype-unitamil-medium-r-normal--*-*-*-*-*-*-iso10646-tam,\
- -*-devanagari-medium-r-normal--*-*-*-*-*-*-iso10646-dev,\
- -*-gujarati-medium-r-normal--*-*-*-*-*-*-iso10646-guj,\
- -*-gurmukhi-medium-r-normal--*-*-*-*-*-*-iso10646-gur,\
- -*-bengali-medium-r-normal--*-*-*-*-*-*-iso10646-bng,\
- -*-kannada-medium-r-normal--*-*-*-*-*-*-iso10646-kan,\
- -*-burmese-medium-r-normal--*-*-*-*-*-*-iso10646-brm,\
- -*-buginese-medium-r-normal--*-*-*-*-*-*-iso10646-bgn,\
- -*-oriya-medium-r-normal--*-*-*-*-*-*-iso10646-ori,\
- -daewoo-mincho-medium-r-normal--*-*-*-*-*-*-ksc5601.1987-0"
-
-monospace italic normal normal normal \
- "-*-fixed-medium-i-normal--*-*-*-*-*-*-*-*,\
- -*-dotum-medium-r-normal--*-*-*-*-*-*-ksc5601.1987-0,\
- -*-clearlyu-medium-r-normal--*-*-*-*-*-*-iso10646-1,\
- -*-fixed-medium-r-normal--*-*-*-*-*-*-*-*,\
- -kaist-iyagi-bold-r-normal--*-*-*-*-*-*-johab-1,\
- -*-song ti-medium-r-normal--*-*-*-*-*-*-*-*,\
- -freetype-unitamil-medium-r-normal--*-*-*-*-*-*-iso10646-tam,\
- -*-devanagari-medium-r-normal--*-*-*-*-*-*-iso10646-dev,\
- -*-gujarati-medium-r-normal--*-*-*-*-*-*-iso10646-guj,\
- -*-gurmukhi-medium-r-normal--*-*-*-*-*-*-iso10646-gur,\
- -*-bengali-medium-r-normal--*-*-*-*-*-*-iso10646-bng,\
- -*-kannada-medium-r-normal--*-*-*-*-*-*-iso10646-kan,\
- -*-burmese-medium-r-normal--*-*-*-*-*-*-iso10646-brm,\
- -*-buginese-medium-r-normal--*-*-*-*-*-*-iso10646-bgn,\
- -*-oriya-medium-r-normal--*-*-*-*-*-*-iso10646-ori,\
- -daewoo-mincho-medium-r-normal--*-*-*-*-*-*-ksc5601.1987-0"
-
-monospace normal normal bold normal \
- "-*-fixed-bold-r-normal--*-*-*-*-*-*-*-*,\
- -*-dotum-bold-r-normal--*-*-*-*-*-*-ksc5601.1987-0,\
- -*-clearlyu-medium-r-normal--*-*-*-*-*-*-iso10646-1,\
- -*-fixed-medium-r-normal--*-*-*-*-*-*-*-*,\
- -kaist-iyagi-bold-r-normal--*-*-*-*-*-*-johab-1,\
- -*-song ti-medium-r-normal--*-*-*-*-*-*-*-*,\
- -freetype-unitamil-medium-r-normal--*-*-*-*-*-*-iso10646-tam,\
- -*-devanagari-medium-r-normal--*-*-*-*-*-*-iso10646-dev,\
- -*-gujarati-medium-r-normal--*-*-*-*-*-*-iso10646-guj,\
- -*-gurmukhi-medium-r-normal--*-*-*-*-*-*-iso10646-gur,\
- -*-bengali-medium-r-normal--*-*-*-*-*-*-iso10646-bng,\
- -*-kannada-medium-r-normal--*-*-*-*-*-*-iso10646-kan,\
- -*-burmese-medium-r-normal--*-*-*-*-*-*-iso10646-brm,\
- -*-buginese-medium-r-normal--*-*-*-*-*-*-iso10646-bgn,\
- -*-oriya-medium-r-normal--*-*-*-*-*-*-iso10646-ori,\
- -daewoo-mincho-medium-r-normal--*-*-*-*-*-*-ksc5601.1987-0"
-
-monospace italic normal bold normal \
- "-*-fixed-bold-i-normal--*-*-*-*-*-*-*-*,\
- -*-dotum-bold-r-normal--*-*-*-*-*-*-ksc5601.1987-0,\
- -*-clearlyu-medium-r-normal--*-*-*-*-*-*-iso10646-1,\
- -*-fixed-medium-r-normal--*-*-*-*-*-*-*-*,\
- -kaist-iyagi-bold-r-normal--*-*-*-*-*-*-johab-1,\
- -*-song ti-medium-r-normal--*-*-*-*-*-*-*-*,\
- -freetype-unitamil-medium-r-normal--*-*-*-*-*-*-iso10646-tam,\
- -*-devanagari-medium-r-normal--*-*-*-*-*-*-iso10646-dev,\
- -*-gujarati-medium-r-normal--*-*-*-*-*-*-iso10646-guj,\
- -*-gurmukhi-medium-r-normal--*-*-*-*-*-*-iso10646-gur,\
- -*-bengali-medium-r-normal--*-*-*-*-*-*-iso10646-bng,\
- -*-kannada-medium-r-normal--*-*-*-*-*-*-iso10646-kan,\
- -*-burmese-medium-r-normal--*-*-*-*-*-*-iso10646-brm,\
- -*-buginese-medium-r-normal--*-*-*-*-*-*-iso10646-bgn,\
- -*-oriya-medium-r-normal--*-*-*-*-*-*-iso10646-ori,\
- -daewoo-mincho-medium-r-normal--*-*-*-*-*-*-ksc5601.1987-0"
diff --git a/pango/pangox.c b/pango/pangox.c
deleted file mode 100644
index 24bca5ea..00000000
--- a/pango/pangox.c
+++ /dev/null
@@ -1,1790 +0,0 @@
-/* pangox.c: Routines for handling X fonts
- *
- * Copyright (C) 1999 Red Hat Software
- * Copyright (C) 2000 SuSE Linux Ltd
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include "config.h"
-#include <string.h>
-#include <stdlib.h>
-#include <math.h>
-
-#include <X11/Xlib.h>
-#include "pango-impl-utils.h"
-
-#undef PANGO_DISABLE_DEPRECATED
-
-#include "pangox.h"
-#include "pangox-private.h"
-
-#define PANGO_TYPE_X_FONT (pango_x_font_get_type ())
-#define PANGO_X_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_X_FONT, PangoXFont))
-#define PANGO_X_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_X_FONT, PangoXFontClass))
-#define PANGO_X_IS_FONT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_X_FONT))
-#define PANGO_X_IS_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_X_FONT))
-#define PANGO_X_FONT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_X_FONT, PangoXFontClass))
-
-typedef struct _PangoXFontClass PangoXFontClass;
-typedef struct _PangoXMetricsInfo PangoXMetricsInfo;
-typedef struct _PangoXContextInfo PangoXContextInfo;
-
-struct _PangoXSubfontInfo
-{
- char *xlfd;
- XFontStruct *font_struct;
- gboolean is_1byte;
- int range_byte1;
- int range_byte2;
-};
-
-struct _PangoXMetricsInfo
-{
- const char *sample_str;
- PangoFontMetrics *metrics;
-};
-
-struct _PangoXContextInfo
-{
- PangoGetGCFunc get_gc_func;
- PangoFreeGCFunc free_gc_func;
-};
-
-struct _PangoXFontClass
-{
- PangoFontClass parent_class;
-};
-
-static void pango_x_font_dispose (GObject *object);
-static void pango_x_font_finalize (GObject *object);
-
-static PangoFontDescription *pango_x_font_describe (PangoFont *font);
-static PangoCoverage * pango_x_font_get_coverage (PangoFont *font,
- PangoLanguage *language);
-static PangoEngineShape * pango_x_font_find_shaper (PangoFont *font,
- PangoLanguage *language,
- guint32 ch);
-static void pango_x_font_get_glyph_extents (PangoFont *font,
- PangoGlyph glyph,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect);
-static PangoFontMetrics * pango_x_font_get_metrics (PangoFont *font,
- PangoLanguage *language);
-static PangoFontMap * pango_x_font_get_font_map (PangoFont *font);
-
-static PangoXSubfontInfo * pango_x_find_subfont (PangoFont *font,
- PangoXSubfont subfont_index);
-static XCharStruct * pango_x_get_per_char (PangoFont *font,
- PangoXSubfontInfo *subfont,
- guint16 char_index);
-static gboolean pango_x_find_glyph (PangoFont *font,
- PangoGlyph glyph,
- PangoXSubfontInfo **subfont_return,
- XCharStruct **charstruct_return);
-static XFontStruct * pango_x_get_font_struct (PangoFont *font,
- PangoXSubfontInfo *info);
-
-static void pango_x_get_item_properties (PangoItem *item,
- PangoUnderline *uline,
- PangoAttrColor *fg_color,
- gboolean *fg_set,
- PangoAttrColor *bg_color,
- gboolean *bg_set);
-
-static inline PangoXSubfontInfo *
-pango_x_find_subfont (PangoFont *font,
- PangoXSubfont subfont_index)
-{
- PangoXFont *xfont = (PangoXFont *)font;
-
- if (subfont_index < 1 || subfont_index > xfont->n_subfonts)
- return NULL;
-
- return xfont->subfonts[subfont_index-1];
-}
-
-static void
-pango_x_make_font_struct (PangoFont *font, PangoXSubfontInfo *info)
-{
- PangoXFont *xfont = (PangoXFont *)font;
- PangoXFontCache *cache;
-
- cache = pango_x_font_map_get_font_cache (xfont->fontmap);
-
- info->font_struct = pango_x_font_cache_load (cache, info->xlfd);
- if (!info->font_struct)
- {
- g_warning ("Cannot load font for XLFD '%s\n", info->xlfd);
-
- /* Prevent a segfault, but probably not much more */
- info->font_struct = pango_x_font_cache_load (cache, "fixed");
- }
-
- info->is_1byte = (info->font_struct->min_byte1 == 0 && info->font_struct->max_byte1 == 0);
- info->range_byte1 = info->font_struct->max_byte1 - info->font_struct->min_byte1 + 1;
- info->range_byte2 = info->font_struct->max_char_or_byte2 - info->font_struct->min_char_or_byte2 + 1;
-}
-
-static inline XFontStruct *
-pango_x_get_font_struct (PangoFont *font, PangoXSubfontInfo *info)
-{
- if (!info->font_struct)
- pango_x_make_font_struct (font, info);
-
- return info->font_struct;
-}
-
-static void
-free_context_info (PangoXContextInfo *info)
-{
- g_slice_free (PangoXContextInfo, info);
-}
-
-static PangoXContextInfo *
-get_context_info (PangoContext *context)
-{
- PangoXContextInfo *info;
- static GQuark quark = 0;
-
- if (G_UNLIKELY (!quark))
- quark = g_quark_from_static_string ("pango-x-info");
-
- info = g_object_get_qdata (G_OBJECT (context), quark);
-
- if (G_UNLIKELY (!info))
- {
- info = g_slice_new (PangoXContextInfo);
- info->get_gc_func = NULL;
- info->free_gc_func = NULL;
- g_object_set_qdata_full (G_OBJECT (context),
- quark,
- info, (GDestroyNotify)free_context_info);
- }
-
- return info;
-}
-
-/**
- * pango_x_get_context:
- * @display: an X display (As returned by XOpenDisplay().)
- *
- * Retrieves a #PangoContext appropriate for rendering with X fonts on the
- * given display.
- *
- * Return value: the new #PangoContext.
- *
- * Deprecated: 1.22: Use pango_x_font_map_for_display() followed by
- * pango_font_map_create_context() instead.
- **/
-PangoContext *
-pango_x_get_context (Display *display)
-{
- return pango_font_map_create_context (pango_x_font_map_for_display (display));
-}
-
-/**
- * pango_x_context_set_funcs:
- * @context: a #PangoContext.
- * @get_gc_func: function called to create a new GC for a given color.
- * @free_gc_func: function called to free a GC created with @get_gc_func.
- *
- * Sets the functions that will be used to get GC's in various colors when
- * rendering layouts with this context.
- **/
-void
-pango_x_context_set_funcs (PangoContext *context,
- PangoGetGCFunc get_gc_func,
- PangoFreeGCFunc free_gc_func)
-{
- PangoXContextInfo *info;
-
- g_return_if_fail (context != NULL);
-
- info = get_context_info (context);
-
- info->get_gc_func = get_gc_func;
- info->free_gc_func = free_gc_func;
-}
-
-G_DEFINE_TYPE (PangoXFont, pango_x_font, PANGO_TYPE_FONT);
-
-static void
-pango_x_font_init (PangoXFont *xfont)
-{
- xfont->subfonts_by_charset = g_hash_table_new (g_str_hash, g_str_equal);
-
- xfont->n_subfonts = 0;
- xfont->max_subfonts = 1;
-
- xfont->subfonts = g_new (PangoXSubfontInfo *, xfont->max_subfonts);
-
- xfont->metrics_by_lang = NULL;
-
- xfont->size = -1;
- xfont->xface = NULL;
-}
-
-static void
-pango_x_font_class_init (PangoXFontClass *class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (class);
- PangoFontClass *font_class = PANGO_FONT_CLASS (class);
-
- object_class->finalize = pango_x_font_finalize;
- object_class->dispose = pango_x_font_dispose;
-
- font_class->describe = pango_x_font_describe;
- font_class->get_coverage = pango_x_font_get_coverage;
- font_class->find_shaper = pango_x_font_find_shaper;
- font_class->get_glyph_extents = pango_x_font_get_glyph_extents;
- font_class->get_metrics = pango_x_font_get_metrics;
- font_class->get_font_map = pango_x_font_get_font_map;
-}
-
-PangoXFont *
-pango_x_font_new (PangoFontMap *fontmap, const char *spec, int size)
-{
- PangoXFont *result;
-
- g_return_val_if_fail (fontmap != NULL, NULL);
- g_return_val_if_fail (spec != NULL, NULL);
-
- result = g_object_new (PANGO_TYPE_X_FONT, NULL);
-
- g_assert (result->fontmap == NULL);
- result->fontmap = fontmap;
- g_object_add_weak_pointer (G_OBJECT (result->fontmap), (gpointer *) (gpointer) &result->fontmap);
-
- result->display = pango_x_fontmap_get_display (fontmap);
-
- result->fonts = g_strsplit(spec, ",", -1);
- for (result->n_fonts = 0; result->fonts[result->n_fonts]; result->n_fonts++)
- ; /* Nothing */
-
- result->size = size;
-
- return result;
-}
-
-/**
- * pango_x_load_font:
- * @display: the X display.
- * @spec: a comma-separated list of XLFD's.
- *
- * Loads up a logical font based on a "fontset" style text
- * specification. This is not remotely useful (Pango API's generally
- * work in terms of #PangoFontDescription) and the result may not
- * work correctly in all circumstances. Use of this function should
- * be avoided.
- *
- * Returns: a new #PangoFont.
- */
-PangoFont *
-pango_x_load_font (Display *display,
- const char *spec)
-{
- PangoXFont *result;
-
- g_return_val_if_fail (display != NULL, NULL);
- g_return_val_if_fail (spec != NULL, NULL);
-
- result = pango_x_font_new (pango_x_font_map_for_display (display), spec, -1);
-
- return (PangoFont *)result;
-}
-
-
-#define FLUSH \
- G_STMT_START { \
- if (charcount) \
- { \
- XDrawString16 (display, d, gc, \
- glyph_x0, glyph_y0, \
- xcharbuffer, charcount); \
- charcount = 0; \
- } \
- } G_STMT_END
-
-
-/**
- * pango_x_render:
- * @display: the X display.
- * @d: the drawable on which to draw string.
- * @gc: the graphics context.
- * @font: the font in which to draw the string.
- * @glyphs: the glyph string to draw.
- * @x: the x position of start of string (in pixels).
- * @y: the y position of baseline (in pixels).
- *
- * Renders a #PangoGlyphString onto an X drawable.
- */
-void
-pango_x_render (Display *display,
- Drawable d,
- GC gc,
- PangoFont *font,
- PangoGlyphString *glyphs,
- int x,
- int y)
-{
- Font old_fid = None;
- XFontStruct *fs;
- int i;
- int x_off = 0;
-
- /*
- * We collect the characters in this buffer as long as the font does not
- * change. At that time, or when the buffer runs full, or at the end,
- * then we empty the buffer.
- */
- XChar2b xcharbuffer[1000];
- int glyph_x0 = 0, expected_x = 0; /* x/y initializations are to quiet GCC */
- int glyph_y0 = 0;
- int charcount = 0;
-
- g_return_if_fail (display != NULL);
- g_return_if_fail (glyphs != NULL);
-
- for (i=0; i<glyphs->num_glyphs; i++)
- {
- PangoGlyph glyph = glyphs->glyphs[i].glyph;
- int glyph_x = x + PANGO_PIXELS (x_off + glyphs->glyphs[i].geometry.x_offset);
- int glyph_y = y + PANGO_PIXELS (glyphs->glyphs[i].geometry.y_offset);
-
- /* Clip glyphs into the X coordinate range; we really
- * want to clip glyphs with an ink rect outside the
- * [0,32767] x [0,32767] rectangle but looking up
- * the ink rect here would be a noticeable speed hit.
- * This is close enough.
- */
- if (!(glyph != PANGO_GLYPH_EMPTY &&
- glyph_x >= -16384 && glyph_x <= 32767 &&
- glyph_y >= -16384 && glyph_y <= 32767))
- goto next_glyph;
-
- if (G_LIKELY ((glyph & PANGO_GLYPH_UNKNOWN_FLAG) == 0))
- {
- guint16 index = PANGO_X_GLYPH_INDEX (glyph);
- guint16 subfont_index = PANGO_X_GLYPH_SUBFONT (glyph);
- PangoXSubfontInfo *subfont;
-
- subfont = pango_x_find_subfont (font, subfont_index);
- if (subfont)
- {
- fs = pango_x_get_font_struct (font, subfont);
- if (!fs)
- continue;
-
- if (fs->fid != old_fid)
- {
- FLUSH;
- XSetFont (display, gc, fs->fid);
- old_fid = fs->fid;
- }
-
- if (charcount == G_N_ELEMENTS (xcharbuffer) ||
- (charcount > 0 && (glyph_y != glyph_y0 ||
- glyph_x != expected_x)))
- FLUSH;
-
- if (charcount == 0)
- {
- glyph_x0 = glyph_x;
- glyph_y0 = glyph_y;
- }
- xcharbuffer[charcount].byte1 = index / 256;
- xcharbuffer[charcount].byte2 = index % 256;
-
- expected_x = glyph_x + XTextWidth16 (fs, &xcharbuffer[charcount], 1);
-
- charcount++;
- } else
- goto unknown_glyph;
- } else {
- PangoFontMetrics *metrics;
- int x1, y1, x2, y2; /* rectangle the character should go inside. */
- int baseline;
- int stroke_thick;
- gunichar wc;
- gboolean invalid_input;
-
- unknown_glyph:
- FLUSH;
-
- if (font)
- metrics = pango_font_get_metrics (font, NULL);
- else
- metrics = NULL;
-
- if (metrics)
- {
- y1 = glyph_y - PANGO_PIXELS (metrics->ascent);
- y2 = y1 + PANGO_PIXELS (metrics->ascent + metrics->descent);
- }
- else
- {
- y2 = glyph_y;
- y1 = y2 - PANGO_UNKNOWN_GLYPH_HEIGHT;
- }
-
- x1 = glyph_x;
- x2 = x1 + PANGO_PIXELS (glyphs->glyphs[i].geometry.width);
-
- baseline = glyph_y;
- stroke_thick = MAX ((int) (0.5 + 0.025 * (y2 - y1)), 1);
-
- if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
- wc = glyph & ~PANGO_GLYPH_UNKNOWN_FLAG;
- else
- wc = 0;
- invalid_input = glyph == PANGO_GLYPH_INVALID_INPUT || wc > 0x10FFFF;
-
- switch (wc)
- {
- case '\n':
- case '\r':
- case 0x2028: /* Line separator */
- case 0x2029: /* Paragraph separator */
- {
- /* Draw a carriage-return thingy */
- PangoRectangle up_stroke;
- PangoRectangle across_stroke;
-
- int hborder = (x2 - x1) * 0.1;
- int arrow_height = 0.25 * (y2 - y1);
- int top_border = (y2 - y1) * 0.25;
-
- int arrow_x, arrow_width, tmp_height;
-
- /* Draw the arrow-head */
-
- tmp_height = (stroke_thick % 2 == 0) ? 2 : 1; /* Starting height */
- arrow_height = 2 * ((1 + arrow_height - tmp_height) / 2) + tmp_height; /* Force symmetry */
- arrow_width = 2 + arrow_height - tmp_height;
-
- for (arrow_x = x1 + hborder; arrow_x < x1 + hborder + arrow_width; arrow_x++)
- {
- XDrawLine (display, d, gc,
- arrow_x,
- baseline - stroke_thick + (stroke_thick - tmp_height) / 2,
- arrow_x,
- baseline - stroke_thick + (stroke_thick - tmp_height) / 2 + tmp_height - 1);
-
- if ((arrow_x - x1 - hborder) % 2 == 1)
- tmp_height += 2;
- }
-
- across_stroke.x = arrow_x;
- across_stroke.width = x2 - hborder - arrow_x - stroke_thick;
- across_stroke.y = baseline - stroke_thick;
- across_stroke.height = stroke_thick;
-
- XFillRectangle (display, d, gc,
- across_stroke.x, across_stroke.y,
- across_stroke.width, across_stroke.height);
-
- up_stroke.x = across_stroke.x + across_stroke.width;
- up_stroke.width = stroke_thick;
- up_stroke.y = y1 + top_border;
- up_stroke.height = baseline - up_stroke.y;
-
- XFillRectangle (display, d, gc,
- up_stroke.x, up_stroke.y,
- up_stroke.width, up_stroke.height);
- }
- break;
-
- default:
- {
- /* Perhaps we should draw the box-with-numbers as in the
- * other backends, though we have no guarantee of having
- * an appropriate size of font. Right now, we just
- * draw an empty box. (To draw the box-with-numbers.
- * the backends would have to be changed to use
- * pango_x_font_get_unknown_glyph() rather than
- * pango_x_get_unknown_glyph().
- */
-
- int xspace = MAX ((int) (0.5 + 0.1 * (x2 - x1)), 1);
- int yspace = MAX ((int) (0.5 + 0.1 * (y2 - y1)), 1);
-
- x1 += xspace;
- x2 -= xspace;
- y1 += yspace;
- y2 -= yspace;
-
- XFillRectangle (display, d, gc,
- x1, y1,
- x2 - x1, stroke_thick);
- XFillRectangle (display, d, gc,
- x1, y1 + stroke_thick,
- stroke_thick, y2 - y1 - 2 * stroke_thick);
- XFillRectangle (display, d, gc,
- x2 - stroke_thick, y1 + stroke_thick,
- stroke_thick, y2 - y1 - 2 * stroke_thick);
- XFillRectangle (display, d, gc,
- x1, y2 - stroke_thick,
- x2 - x1, stroke_thick);
- if (invalid_input)
- {
- XDrawLine (display, d, gc,
- x1, y1,
- x2-1, y2-1);
- XDrawLine (display, d, gc,
- x2-1, y1,
- x1, y2-1);
- }
-
- break;
- }
- }
-
- pango_font_metrics_unref (metrics);
- }
-
- next_glyph:
- x_off += glyphs->glyphs[i].geometry.width;
- }
- FLUSH;
-}
-
-#undef FLUSH
-
-static void
-pango_x_font_get_glyph_extents (PangoFont *font,
- PangoGlyph glyph,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
-{
- XCharStruct *cs;
- PangoXSubfontInfo *subfont;
-
- if (glyph == PANGO_GLYPH_EMPTY)
- {
- if (ink_rect)
- ink_rect->x = ink_rect->width = ink_rect->y = ink_rect->height = 0;
- if (logical_rect)
- logical_rect->x = logical_rect->width = logical_rect->y = logical_rect->height = 0;
- return;
- }
- if ((glyph & PANGO_GLYPH_UNKNOWN_FLAG) == 0 && pango_x_find_glyph (font, glyph, &subfont, &cs))
- {
- if (ink_rect)
- {
- ink_rect->x = PANGO_SCALE * cs->lbearing;
- ink_rect->width = PANGO_SCALE * (cs->rbearing - cs->lbearing);
- ink_rect->y = PANGO_SCALE * -cs->ascent;
- ink_rect->height = PANGO_SCALE * (cs->ascent + cs->descent);
- }
- if (logical_rect)
- {
- logical_rect->x = 0;
- logical_rect->width = PANGO_SCALE * cs->width;
- logical_rect->y = - PANGO_SCALE * subfont->font_struct->ascent;
- logical_rect->height = PANGO_SCALE * (subfont->font_struct->ascent + subfont->font_struct->descent);
- }
- }
- else
- {
- PangoFontMetrics *metrics;
- gunichar wc;
- gdouble width_factor;
- int w;
-
- if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
- wc = glyph & (~PANGO_GLYPH_UNKNOWN_FLAG);
- else
- wc = 0;
-
- switch (wc)
- {
- case '\n':
- case '\r':
- case 0x2028: /* Line separator */
- case 0x2029: /* Paragraph separator */
- {
-#define MAGIC_FACTOR 1.2
-
- /* carriage-return thingy */
- width_factor = MAGIC_FACTOR;
- break;
- }
- default:
- {
- /* Unknown glyph square */
- width_factor = 1.0;
- }
- }
-
- metrics = pango_font_get_metrics (font, NULL);
-
- if (metrics)
- {
- w = metrics->approximate_char_width * width_factor;
- w = PANGO_SCALE * PANGO_PIXELS (w);
-
- if (ink_rect)
- {
- ink_rect->x = PANGO_SCALE;
- ink_rect->width = w - 2 * PANGO_SCALE;
- ink_rect->y = - (metrics->ascent - PANGO_SCALE);
- ink_rect->height = metrics->ascent + metrics->descent - 2 * PANGO_SCALE;
- }
- if (logical_rect)
- {
- logical_rect->x = 0;
- logical_rect->width = w;
- logical_rect->y = - metrics->ascent;
- logical_rect->height = metrics->ascent + metrics->descent;
- }
-
- pango_font_metrics_unref (metrics);
- }
- else
- {
- if (ink_rect)
- ink_rect->x = ink_rect->y = ink_rect->height = ink_rect->width = 0;
- if (logical_rect)
- logical_rect->x = logical_rect->y = logical_rect->height = logical_rect->width = 0;
- }
- }
-}
-
-static gboolean
-get_int_prop (Atom atom,
- XFontStruct *fs,
- int *val)
-{
- int i;
-
- *val = 0;
-
- i = 0;
- while (i < fs->n_properties)
- {
- if (fs->properties[i].name == atom)
- {
- *val = fs->properties[i].card32;
- return TRUE;
- }
-
- ++i;
- }
-
- return FALSE;
-}
-
-/* Call @func with each glyph resulting from shaping @string with each
- * glyph. This duplicates quite a bit of code from pango_itemize. This
- * function should die and we should simply add the ability to specify
- * particular fonts when itemizing.
- */
-static void
-itemize_string_foreach (PangoFont *font,
- PangoLanguage *language,
- const char *str,
- void (*func) (PangoFont *font,
- PangoGlyphInfo *glyph_info,
- gpointer data),
- gpointer data)
-{
- const char *start, *p;
- PangoGlyphString *glyph_str = pango_glyph_string_new ();
- PangoEngineShape *shaper, *last_shaper;
- int last_level;
- int i;
- guint8 *embedding_levels;
- PangoDirection base_dir = PANGO_DIRECTION_LTR;
- gboolean finished = FALSE;
-
- embedding_levels = pango_log2vis_get_embedding_levels (str, -1, &base_dir);
-
- last_shaper = NULL;
- last_level = 0;
-
- i = 0;
- p = start = str;
- while (*p || !finished)
- {
- gunichar wc;
-
- if (*p)
- {
- wc = g_utf8_get_char (p);
- shaper = pango_font_find_shaper (font, language, wc);
- }
- else
- {
- finished = TRUE;
- shaper = NULL;
- }
-
- if (p > start &&
- (finished ||
- (shaper != last_shaper || last_level != embedding_levels[i])))
- {
- PangoAnalysis analysis = { NULL };
- int j;
-
- analysis.shape_engine = last_shaper;
- analysis.font = font;
- analysis.language = language;
- analysis.level = last_level;
-
- pango_shape (start, p - start, &analysis, glyph_str);
-
- for (j = 0; j < glyph_str->num_glyphs; j++)
- (*func) (font, &glyph_str->glyphs[j], data);
-
- start = p;
- }
-
- if (!finished)
- {
- p = g_utf8_next_char (p);
-
- last_shaper = shaper;
- last_level = embedding_levels[i];
- i++;
- }
- }
-
- pango_glyph_string_free (glyph_str);
- g_free (embedding_levels);
-}
-
-/* Get composite font metrics for all subfonts in list
- */
-static void
-get_font_metrics_from_subfonts (PangoFont *font,
- GSList *subfonts,
- PangoFontMetrics *metrics)
-{
- PangoXFont *xfont = (PangoXFont *)font;
- GSList *tmp_list = subfonts;
- gboolean first = TRUE;
- int total_avg_widths = 0;
- int n_avg_widths = 0;
- Atom avg_width_atom;
-
- avg_width_atom = pango_x_fontmap_atom_from_name (xfont->fontmap,
- "AVERAGE_WIDTH");
-
- metrics->ascent = 0;
- metrics->descent = 0;
-
- while (tmp_list)
- {
- PangoXSubfontInfo *subfont = pango_x_find_subfont (font, GPOINTER_TO_UINT (tmp_list->data));
-
- if (subfont)
- {
- XFontStruct *fs = pango_x_get_font_struct (font, subfont);
- gint avg_width = 0;
-
- if (fs)
- {
- if (first)
- {
- metrics->ascent = fs->ascent * PANGO_SCALE;
- metrics->descent = fs->descent * PANGO_SCALE;
- first = FALSE;
- }
- else
- {
- metrics->ascent = MAX (fs->ascent * PANGO_SCALE, metrics->ascent);
- metrics->descent = MAX (fs->descent * PANGO_SCALE, metrics->descent);
- }
-
- if (get_int_prop (avg_width_atom, fs, &avg_width))
- {
- /* convert decipoints --> Pango units.
- * Resolution is in (points * PANGO_SCALE) / pixel,
- * avg_width in decipoints.
- * We want pixels * PANGO_SCALE
- */
-
- /* Convert to points * PANGO_SCALE */
- avg_width *= PANGO_SCALE / (double) 10.0;
- /* Convert to pixels * PANGO_SCALE */
- avg_width *= (PANGO_SCALE / PANGO_X_FONT_MAP (PANGO_X_FONT (font)->fontmap)->resolution);
- }
- else
- {
- avg_width = PANGO_SCALE * ((fs->min_bounds.width + fs->max_bounds.width) / 2);
- }
- }
-
- if (avg_width)
- {
- total_avg_widths += avg_width;
- n_avg_widths += 1;
- }
- }
- else
- g_warning ("Invalid subfont %d in get_font_metrics_from_subfonts", GPOINTER_TO_UINT (tmp_list->data));
-
- tmp_list = tmp_list->next;
- }
-
- /* This is pretty darn bogus. */
- if (n_avg_widths)
- metrics->approximate_char_width = total_avg_widths / n_avg_widths;
- else
- metrics->approximate_char_width = PANGO_UNKNOWN_GLYPH_WIDTH * PANGO_SCALE;
- if (metrics->ascent + metrics->descent == 0)
- {
- metrics->ascent = PANGO_UNKNOWN_GLYPH_HEIGHT * PANGO_SCALE;
- metrics->descent = 0;
- }
-}
-
-static void
-get_subfonts_foreach (PangoFont *font,
- PangoGlyphInfo *glyph_info,
- gpointer data)
-{
- GSList **subfonts = data;
- PangoGlyph glyph = glyph_info->glyph;
- PangoXSubfont subfont;
-
- if (glyph == PANGO_GLYPH_EMPTY)
- return;
-
- /* Use an arbitrary subfont for unknown glyphs...*/
- if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
- {
- if (((PangoXFont *)font)->n_subfonts > 0)
- glyph = PANGO_X_MAKE_GLYPH (1, 0);
- else
- return;
- }
-
- subfont = PANGO_X_GLYPH_SUBFONT (glyph);
- if (!g_slist_find (*subfonts, GUINT_TO_POINTER ((guint)subfont)))
- *subfonts = g_slist_prepend (*subfonts, GUINT_TO_POINTER ((guint)subfont));
-}
-
-/* Get composite font metrics for all subfonts resulting from shaping
- * string str with the given font
- */
-static void
-get_font_metrics_from_string (PangoFont *font,
- PangoLanguage *language,
- const char *str,
- PangoFontMetrics *metrics)
-{
- GSList *subfonts = NULL;
-
- itemize_string_foreach (font, language, str, get_subfonts_foreach, &subfonts);
- get_font_metrics_from_subfonts (font, subfonts, metrics);
- g_slist_free (subfonts);
-}
-
-static void
-average_width_foreach (PangoFont *font G_GNUC_UNUSED,
- PangoGlyphInfo *glyph_info,
- gpointer data)
-{
- int *width = data;
-
- *width += glyph_info->geometry.width;
-}
-
-/* Get composite font metrics for all subfonts resulting from shaping
- * string str with the given font
- */
-static gdouble
-get_total_width_for_string (PangoFont *font,
- PangoLanguage *language,
- const char *str)
-{
- int width = 0;
-
- itemize_string_foreach (font, language, str, average_width_foreach, &width);
-
- return width;
-}
-
-static PangoFontMetrics *
-pango_x_font_get_metrics (PangoFont *font,
- PangoLanguage *language)
-{
- PangoXMetricsInfo *info = NULL; /* Quiet gcc */
- PangoXFont *xfont = (PangoXFont *)font;
- GSList *tmp_list;
-
- const char *sample_str = pango_language_get_sample_string (language);
-
- tmp_list = xfont->metrics_by_lang;
- while (tmp_list)
- {
- info = tmp_list->data;
-
- if (info->sample_str == sample_str) /* We _don't_ need strcmp */
- break;
-
- tmp_list = tmp_list->next;
- }
-
- if (!tmp_list)
- {
- PangoFontMetrics *metrics;
-
- info = g_slice_new0 (PangoXMetricsInfo);
-
- xfont->metrics_by_lang = g_slist_prepend (xfont->metrics_by_lang, info);
-
- info->sample_str = sample_str;
- metrics = pango_font_metrics_new ();
-
- get_font_metrics_from_string (font, language, sample_str, metrics);
-
- metrics->approximate_digit_width = get_total_width_for_string (font, language, "0123456789") / 10;
-
- info->metrics = metrics;
- }
-
- return pango_font_metrics_ref (info->metrics);
-}
-
-static PangoFontMap *
-pango_x_font_get_font_map (PangoFont *font)
-{
- PangoXFont *xfont = (PangoXFont *)font;
-
- return xfont->fontmap;
-}
-
-/* Compare the tail of a to b */
-static gboolean
-match_end (const char *a, const char *b)
-{
- size_t len_a = strlen (a);
- size_t len_b = strlen (b);
-
- if (len_b > len_a)
- return FALSE;
- else
- return (strcmp (a + len_a - len_b, b) == 0);
-}
-
-/* Substitute in a charset into an XLFD. Return the
- * (g_malloc'd) new name, or %NULL if the XLFD cannot
- * match the charset
- */
-static char *
-name_for_charset (char *xlfd, char *charset)
-{
- char *p;
- char *dash_charset = g_strconcat ("-", charset, NULL);
- char *result = NULL;
- int ndashes = 0;
-
- for (p = xlfd; *p; p++)
- if (*p == '-')
- ndashes++;
-
- if (ndashes == 14) /* Complete XLFD */
- {
- if (match_end (xlfd, "-*-*"))
- {
- result = g_malloc (strlen (xlfd) - 4 + strlen (dash_charset) + 1);
- strncpy (result, xlfd, strlen (xlfd) - 4);
- strcpy (result + strlen (xlfd) - 4, dash_charset);
- }
- if (match_end (xlfd, dash_charset))
- result = g_strdup (xlfd);
- }
- else if (ndashes == 13)
- {
- if (match_end (xlfd, "-*"))
- {
- result = g_malloc (strlen (xlfd) - 2 + strlen (dash_charset) + 1);
- strncpy (result, xlfd, strlen (xlfd) - 2);
- strcpy (result + strlen (xlfd) - 2, dash_charset);
- }
- if (match_end (xlfd, dash_charset))
- result = g_strdup (xlfd);
- }
- else
- {
- if (match_end (xlfd, "*"))
- {
- result = g_malloc (strlen (xlfd) + strlen (dash_charset) + 1);
- strcpy (result, xlfd);
- strcpy (result + strlen (xlfd), dash_charset);
- }
- if (match_end (xlfd, dash_charset))
- result = g_strdup (xlfd);
- }
-
- g_free (dash_charset);
- return result;
-}
-
-static PangoXSubfont
-pango_x_insert_subfont (PangoFont *font, const char *xlfd)
-{
- PangoXFont *xfont = (PangoXFont *)font;
- PangoXSubfontInfo *info;
-
- info = g_slice_new (PangoXSubfontInfo);
-
- info->xlfd = g_strdup (xlfd);
- info->font_struct = NULL;
-
- xfont->n_subfonts++;
-
- if (xfont->n_subfonts > xfont->max_subfonts)
- {
- xfont->max_subfonts *= 2;
- xfont->subfonts = g_renew (PangoXSubfontInfo *, xfont->subfonts, xfont->max_subfonts);
- }
-
- xfont->subfonts[xfont->n_subfonts - 1] = info;
-
- return xfont->n_subfonts;
-}
-
-/**
- * pango_x_list_subfonts:
- * @font: a #PangoFont.
- * @charsets: the charsets to list subfonts for.
- * @n_charsets: the number of charsets in @charsets.
- * @subfont_ids: location to store a pointer to an array of subfont IDs for each found subfont;
- * the result must be freed using g_free().
- * @subfont_charsets: location to store a pointer to an array of subfont IDs for each found subfont;
- * the result must be freed using g_free().
- *
- * Lists the subfonts of a given font. The result is ordered first by charset,
- * and then within each charset, by the order of fonts in the font specification.
- *
- * Return value: length of the arrays stored in @subfont_ids and
- * @subfont_charsets.
- **/
-int
-pango_x_list_subfonts (PangoFont *font,
- char **charsets,
- int n_charsets,
- PangoXSubfont **subfont_ids,
- int **subfont_charsets)
-{
- PangoXFont *xfont = (PangoXFont *)font;
- PangoXSubfont **subfont_lists;
- PangoFontMap *fontmap;
- int i, j;
- int n_subfonts = 0;
-
- g_return_val_if_fail (font != NULL, 0);
- g_return_val_if_fail (n_charsets == 0 || charsets != NULL, 0);
-
- fontmap = pango_x_font_map_for_display (xfont->display);
-
- subfont_lists = g_new (PangoXSubfont *, n_charsets);
-
- for (j=0; j<n_charsets; j++)
- {
- subfont_lists[j] = g_hash_table_lookup (xfont->subfonts_by_charset, charsets[j]);
- if (!subfont_lists[j])
- {
- subfont_lists[j] = g_new (PangoXSubfont, xfont->n_fonts);
-
- for (i = 0; i < xfont->n_fonts; i++)
- {
- PangoXSubfont subfont = 0;
- char *xlfd;
-
- if (xfont->size == -1)
- {
- xlfd = name_for_charset (xfont->fonts[i], charsets[j]);
-
- if (xlfd)
- {
- int count;
- char **names = XListFonts (xfont->display, xlfd, 1, &count);
- if (count > 0)
- subfont = pango_x_insert_subfont (font, names[0]);
-
- XFreeFontNames (names);
- g_free (xlfd);
- }
- }
- else
- {
- xlfd = pango_x_make_matching_xlfd (fontmap, xfont->fonts[i], charsets[j], xfont->size);
- if (xlfd)
- {
- subfont = pango_x_insert_subfont (font, xlfd);
- g_free (xlfd);
- }
- }
-
- subfont_lists[j][i] = subfont;
- }
-
- g_hash_table_insert (xfont->subfonts_by_charset, g_strdup (charsets[j]), subfont_lists[j]);
- }
-
- for (i = 0; i < xfont->n_fonts; i++)
- if (subfont_lists[j][i])
- n_subfonts++;
- }
-
- *subfont_ids = g_new (PangoXSubfont, n_subfonts);
- *subfont_charsets = g_new (int, n_subfonts);
-
- n_subfonts = 0;
-
- for (j=0; j<n_charsets; j++)
- for (i=0; i<xfont->n_fonts; i++)
- if (subfont_lists[j][i])
- {
- (*subfont_ids)[n_subfonts] = subfont_lists[j][i];
- (*subfont_charsets)[n_subfonts] = j;
- n_subfonts++;
- }
-
- g_free (subfont_lists);
-
- return n_subfonts;
-}
-
-/**
- * pango_x_has_glyph:
- * @font: a #PangoFont which must be from the X backend.
- * @glyph: the index of a glyph in the font. (Formed
- * using the #PANGO_X_MAKE_GLYPH macro)
- *
- * Checks if the given glyph is present in a X font.
- *
- * Return value: %TRUE if the glyph is present.
- **/
-gboolean
-pango_x_has_glyph (PangoFont *font,
- PangoGlyph glyph)
-{
- PangoXSubfontInfo *subfont;
- XCharStruct *cs;
-
- guint16 char_index = PANGO_X_GLYPH_INDEX (glyph);
- guint16 subfont_index = PANGO_X_GLYPH_SUBFONT (glyph);
-
- subfont = pango_x_find_subfont (font, subfont_index);
- if (!subfont)
- return FALSE;
-
- cs = pango_x_get_per_char (font, subfont, char_index);
-
- if (cs && (cs->lbearing != cs->rbearing || cs->width != 0))
- return TRUE;
- else
- return FALSE;
-}
-
-/**
- * pango_x_font_subfont_xlfd:
- * @font: a #PangoFont which must be from the X backend.
- * @subfont_id: the id of a subfont within the font.
- *
- * Determines the X Logical Font Description for the specified
- * subfont.
- *
- * Return value: A newly-allocated string containing the XLFD for the
- * subfont. This string must be freed with g_free().
- **/
-char *
-pango_x_font_subfont_xlfd (PangoFont *font,
- PangoXSubfont subfont_id)
-{
- PangoXSubfontInfo *subfont;
-
- g_return_val_if_fail (font != NULL, NULL);
- g_return_val_if_fail (PANGO_X_IS_FONT (font), NULL);
-
- subfont = pango_x_find_subfont (font, subfont_id);
- if (!subfont)
- {
- g_warning ("pango_x_font_subfont_xlfd: Invalid subfont_id specified");
- return NULL;
- }
-
- return g_strdup (subfont->xlfd);
-}
-
-static void
-pango_x_font_dispose (GObject *object)
-{
- PangoXFont *xfont = PANGO_X_FONT (object);
-
- /* If the font is not already in the freed-fonts cache, add it,
- * if it is already there, do nothing and the font will be
- * freed.
- */
- if (!xfont->in_cache && xfont->fontmap)
- pango_x_fontmap_cache_add (xfont->fontmap, xfont);
-
- G_OBJECT_CLASS (pango_x_font_parent_class)->dispose (object);
-}
-
-
-static void
-subfonts_foreach (gpointer key, gpointer value, gpointer data G_GNUC_UNUSED)
-{
- g_free (key);
- g_free (value);
-}
-
-static void
-free_metrics_info (PangoXMetricsInfo *info)
-{
- pango_font_metrics_unref (info->metrics);
- g_slice_free (PangoXMetricsInfo, info);
-}
-
-static void
-pango_x_font_finalize (GObject *object)
-{
- PangoXFont *xfont = (PangoXFont *)object;
- PangoXFontCache *cache = pango_x_font_map_get_font_cache (xfont->fontmap);
-
- int i;
-
- for (i=0; i<xfont->n_subfonts; i++)
- {
- PangoXSubfontInfo *info = xfont->subfonts[i];
-
- g_free (info->xlfd);
-
- if (info->font_struct)
- pango_x_font_cache_unload (cache, info->font_struct);
-
- g_slice_free (PangoXSubfontInfo, info);
- }
-
- g_free (xfont->subfonts);
-
- g_hash_table_foreach (xfont->subfonts_by_charset, subfonts_foreach, NULL);
- g_hash_table_destroy (xfont->subfonts_by_charset);
-
- g_slist_foreach (xfont->metrics_by_lang, (GFunc)free_metrics_info, NULL);
- g_slist_free (xfont->metrics_by_lang);
-
- if (xfont->xface)
- pango_x_face_remove (xfont->xface, (PangoFont *)xfont);
-
- g_assert (xfont->fontmap != NULL);
- g_object_remove_weak_pointer (G_OBJECT (xfont->fontmap), (gpointer *) (gpointer) &xfont->fontmap);
- xfont->fontmap = NULL;
-
- g_strfreev (xfont->fonts);
-
- G_OBJECT_CLASS (pango_x_font_parent_class)->finalize (object);
-}
-
-static PangoFontDescription *
-pango_x_font_describe (PangoFont *font)
-{
- /* FIXME: this doesn't work for fonts from pango_x_font_load()
- */
- PangoXFont *xfont = (PangoXFont *)font;
-
- if (xfont->xface)
- {
- PangoFontDescription *desc = pango_font_face_describe (PANGO_FONT_FACE (xfont->xface));
- pango_font_description_set_size (desc, xfont->size);
-
- return desc;
- }
- else
- return NULL;
-}
-
-PangoMap *
-pango_x_get_shaper_map (PangoLanguage *language)
-{
- static guint engine_type_id = 0;
- static guint render_type_id = 0;
-
- if (engine_type_id == 0)
- {
- engine_type_id = g_quark_from_static_string (PANGO_ENGINE_TYPE_SHAPE);
- render_type_id = g_quark_from_static_string (PANGO_RENDER_TYPE_X);
- }
-
- return pango_find_map (language, engine_type_id, render_type_id);
-}
-
-static PangoCoverage *
-pango_x_font_get_coverage (PangoFont *font,
- PangoLanguage *language)
-{
- PangoXFont *xfont = (PangoXFont *)font;
-
- return pango_x_face_get_coverage (xfont->xface, font, language);
-}
-
-static PangoEngineShape *
-pango_x_font_find_shaper (PangoFont *font G_GNUC_UNUSED,
- PangoLanguage *language,
- guint32 ch)
-{
- PangoMap *shape_map = NULL;
- PangoScript script;
-
- shape_map = pango_x_get_shaper_map (language);
- script = pango_script_for_unichar (ch);
- return (PangoEngineShape *)pango_map_get_engine (shape_map, script);
-}
-
-/* Utility functions */
-
-static XCharStruct *
-pango_x_get_per_char (PangoFont *font,
- PangoXSubfontInfo *subfont,
- guint16 char_index)
-{
- XFontStruct *fs;
-
- int index;
- int byte1;
- int byte2;
-
- fs = pango_x_get_font_struct (font, subfont);
- if (!fs)
- return NULL;
-
- if (subfont->is_1byte)
- {
- index = (int)char_index - fs->min_char_or_byte2;
- if (index < 0 || index >= subfont->range_byte2)
- return NULL;
- }
- else
- {
- byte1 = (int)(char_index / 256) - fs->min_byte1;
- if (byte1 < 0 || byte1 >= subfont->range_byte1)
- return NULL;
-
- byte2 = (int)(char_index % 256) - fs->min_char_or_byte2;
- if (byte2 < 0 || byte2 >= subfont->range_byte2)
- return NULL;
-
- index = byte1 * subfont->range_byte2 + byte2;
- }
-
- if (fs->per_char)
- return &fs->per_char[index];
- else
- return &fs->min_bounds;
-}
-
-static gboolean
-pango_x_find_glyph (PangoFont *font,
- PangoGlyph glyph,
- PangoXSubfontInfo **subfont_return,
- XCharStruct **charstruct_return)
-{
- PangoXSubfontInfo *subfont;
- XCharStruct *cs;
-
- guint16 char_index = PANGO_X_GLYPH_INDEX (glyph);
- guint16 subfont_index = PANGO_X_GLYPH_SUBFONT (glyph);
-
- subfont = pango_x_find_subfont (font, subfont_index);
- if (!subfont)
- return FALSE;
-
- cs = pango_x_get_per_char (font, subfont, char_index);
-
- if (cs && (cs->lbearing != cs->rbearing || cs->width != 0))
- {
- if (subfont_return)
- *subfont_return = subfont;
-
- if (charstruct_return)
- *charstruct_return = cs;
-
- return TRUE;
- }
- else
- return FALSE;
-}
-
-/**
- * pango_x_get_unknown_glyph:
- * @font: a #PangoFont.
- *
- * Returns the index of a glyph suitable for drawing unknown characters;
- * you should generally use PANGO_GET_UNKNOWN_GLYPH() instead,
- * since that may return a glyph that provides a better representation
- * of a particular char. (E.g., by showing hex digits, or a glyph
- * representative of a certain Unicode range.)
- *
- * Return value: a glyph index into @font.
- **/
-PangoGlyph
-pango_x_get_unknown_glyph (PangoFont *font G_GNUC_UNUSED)
-{
- return PANGO_GET_UNKNOWN_GLYPH (0);
-}
-
-/**
- * pango_x_render_layout_line:
- * @display: the X display.
- * @drawable: the drawable on which to draw.
- * @gc: GC to use for uncolored drawing.
- * @line: a #PangoLayoutLine.
- * @x: the x position of start of string (in pixels).
- * @y: the y position of baseline (in pixels).
- *
- * Renders a #PangoLayoutLine onto an X drawable.
- */
-void
-pango_x_render_layout_line (Display *display,
- Drawable drawable,
- GC gc,
- PangoLayoutLine *line,
- int x,
- int y)
-{
- GSList *tmp_list = line->runs;
- PangoRectangle overall_rect;
- PangoRectangle logical_rect;
- PangoRectangle ink_rect;
- PangoContext *context = pango_layout_get_context (line->layout);
- PangoXContextInfo *info = get_context_info (context);
-
- int x_off = 0;
-
- pango_layout_line_get_extents (line,NULL, &overall_rect);
-
- while (tmp_list)
- {
- PangoUnderline uline = PANGO_UNDERLINE_NONE;
- PangoLayoutRun *run = tmp_list->data;
- PangoAttrColor fg_color, bg_color;
- gboolean fg_set, bg_set;
- GC fg_gc;
-
- tmp_list = tmp_list->next;
-
- pango_x_get_item_properties (run->item, &uline, &fg_color, &fg_set, &bg_color, &bg_set);
-
- if (fg_set && info->get_gc_func)
- fg_gc = info->get_gc_func (context, &fg_color.color, gc);
- else
- fg_gc = gc;
-
- if (uline == PANGO_UNDERLINE_NONE)
- pango_glyph_string_extents (run->glyphs, run->item->analysis.font,
- NULL, &logical_rect);
- else
- pango_glyph_string_extents (run->glyphs, run->item->analysis.font,
- &ink_rect, &logical_rect);
-
- if (bg_set && info->get_gc_func)
- {
- GC bg_gc = info->get_gc_func (context, &bg_color.color, gc);
-
- XFillRectangle (display, drawable, bg_gc,
- x + (x_off + logical_rect.x) / PANGO_SCALE,
- y + overall_rect.y / PANGO_SCALE,
- logical_rect.width / PANGO_SCALE,
- overall_rect.height / PANGO_SCALE);
-
- if (info->free_gc_func)
- info->free_gc_func (context, bg_gc);
- }
-
- pango_x_render (display, drawable, fg_gc, run->item->analysis.font, run->glyphs,
- x + x_off / PANGO_SCALE, y);
-
- switch (uline)
- {
- case PANGO_UNDERLINE_NONE:
- break;
- case PANGO_UNDERLINE_DOUBLE:
- XDrawLine (display, drawable, fg_gc,
- x + (x_off + ink_rect.x) / PANGO_SCALE - 1, y + 4,
- x + (x_off + ink_rect.x + ink_rect.width) / PANGO_SCALE, y + 4);
- /* Fall through */
- case PANGO_UNDERLINE_SINGLE:
- XDrawLine (display, drawable, fg_gc,
- x + (x_off + ink_rect.x) / PANGO_SCALE - 1, y + 2,
- x + (x_off + ink_rect.x + ink_rect.width) / PANGO_SCALE, y + 2);
- break;
- case PANGO_UNDERLINE_ERROR:
- {
- int point_x;
- int counter = 0;
- int end_x = x + (x_off + ink_rect.x + ink_rect.width) / PANGO_SCALE;
-
- for (point_x = x + PANGO_PIXELS (x_off + ink_rect.x) - 1;
- point_x <= end_x;
- point_x += 2)
- {
- if (counter)
- XDrawLine (display, drawable, gc,
- point_x, y + 2, MIN (point_x + 1, end_x), y + 2);
- else
- XDrawLine (display, drawable, gc,
- point_x, y + 3, MIN (point_x + 1, end_x), y + 3);
-
- counter = (counter + 1) % 2;
- }
- }
- break;
- case PANGO_UNDERLINE_LOW:
- XDrawLine (display, drawable, fg_gc,
- x + (x_off + ink_rect.x) / PANGO_SCALE - 1, y + (ink_rect.y + ink_rect.height) / PANGO_SCALE + 2,
- x + (x_off + ink_rect.x + ink_rect.width) / PANGO_SCALE, y + (ink_rect.y + ink_rect.height) / PANGO_SCALE + 2);
- break;
- }
-
- if (fg_set && info->get_gc_func && info->free_gc_func)
- info->free_gc_func (context, fg_gc);
-
- x_off += logical_rect.width;
- }
-}
-
-/**
- * pango_x_render_layout:
- * @display: the X display.
- * @drawable: the drawable on which to draw.
- * @gc: GC to use for uncolored drawing.
- * @layout: a #PangoLayout.
- * @x: the x position of the left of the layout (in pixels).
- * @y: the y position of the top of the layout (in pixels).
- *
- * Renders a #PangoLayout onto an X drawable.
- */
-void
-pango_x_render_layout (Display *display,
- Drawable drawable,
- GC gc,
- PangoLayout *layout,
- int x,
- int y)
-{
- PangoLayoutIter *iter;
-
- g_return_if_fail (display != NULL);
- g_return_if_fail (PANGO_IS_LAYOUT (layout));
-
- iter = pango_layout_get_iter (layout);
-
- do
- {
- PangoRectangle logical_rect;
- PangoLayoutLine *line;
- int baseline;
-
- line = pango_layout_iter_get_line_readonly (iter);
-
- pango_layout_iter_get_line_extents (iter, NULL, &logical_rect);
- baseline = pango_layout_iter_get_baseline (iter);
-
- pango_x_render_layout_line (display, drawable, gc,
- line,
- x + PANGO_PIXELS (logical_rect.x),
- y + PANGO_PIXELS (baseline));
- }
- while (pango_layout_iter_next_line (iter));
-
- pango_layout_iter_free (iter);
-}
-
-/* This utility function is duplicated here and in pango-layout.c; should it be
- * public? Trouble is - what is the appropriate set of properties?
- */
-static void
-pango_x_get_item_properties (PangoItem *item,
- PangoUnderline *uline,
- PangoAttrColor *fg_color,
- gboolean *fg_set,
- PangoAttrColor *bg_color,
- gboolean *bg_set)
-{
- GSList *tmp_list = item->analysis.extra_attrs;
-
- if (fg_set)
- *fg_set = FALSE;
-
- if (bg_set)
- *bg_set = FALSE;
-
- while (tmp_list)
- {
- PangoAttribute *attr = tmp_list->data;
-
- switch ((int) attr->klass->type)
- {
- case PANGO_ATTR_UNDERLINE:
- if (uline)
- *uline = ((PangoAttrInt *)attr)->value;
- break;
-
- case PANGO_ATTR_FOREGROUND:
- if (fg_color)
- *fg_color = *((PangoAttrColor *)attr);
- if (fg_set)
- *fg_set = TRUE;
-
- break;
-
- case PANGO_ATTR_BACKGROUND:
- if (bg_color)
- *bg_color = *((PangoAttrColor *)attr);
- if (bg_set)
- *bg_set = TRUE;
-
- break;
-
- default:
- break;
- }
- tmp_list = tmp_list->next;
- }
-}
-
-/**
- * pango_x_apply_ligatures:
- * @font: unused
- * @subfont: unused
- * @glyphs: unused
- * @n_glyphs: unused
- * @clusters: unused
- *
- * Previously did subfont-specific ligation. Now a no-op.
- *
- * Return value: %FALSE, always.
- */
-gboolean
-pango_x_apply_ligatures (PangoFont *font G_GNUC_UNUSED,
- PangoXSubfont subfont_id G_GNUC_UNUSED,
- gunichar **glyphs G_GNUC_UNUSED,
- int *n_glyphs G_GNUC_UNUSED,
- int **clusters G_GNUC_UNUSED)
-{
- return FALSE;
-}
-
-/**
- * pango_x_find_first_subfont:
- * @font: A #PangoFont.
- * @rfont: A pointer to a #PangoXSubfont.
- * @charsets: An array of charsets.
- * @n_charsets: The number of charsets in @charsets.
- *
- * Looks for subfonts with the @charset charset,
- * in @font, and puts the first one in *@rfont.
- *
- * Return value: %TRUE if *@rfont now contains a font.
- */
-gboolean
-pango_x_find_first_subfont (PangoFont *font,
- char **charsets,
- int n_charsets,
- PangoXSubfont *rfont)
-{
- int n_subfonts;
- gboolean result = FALSE;
- PangoXSubfont *subfonts;
- int *subfont_charsets;
-
- g_return_val_if_fail (font, 0);
- g_return_val_if_fail (charsets, 0);
- g_return_val_if_fail (rfont, 0);
-
- n_subfonts = pango_x_list_subfonts (font, charsets, n_charsets,
- &subfonts, &subfont_charsets);
-
- if (n_subfonts > 0)
- {
- *rfont = subfonts[0];
- result = TRUE;
- }
-
- g_free (subfonts);
- g_free (subfont_charsets);
- return result;
-}
-
-/**
- * pango_x_fallback_shape:
- * @font: A #PangoFont.
- * @glyphs: A pointer to a #PangoGlyphString.
- * @text: UTF-8 string.
- * @n_chars: Number of UTF-8 seqs in @text.
- *
- * This is a simple fallback shaper, that can be used
- * if no subfont that supports a given script is found.
- * For every character in @text, it puts the unknown glyph.
- */
-void
-pango_x_fallback_shape (PangoFont *font,
- PangoGlyphString *glyphs,
- const char *text,
- int n_chars)
-{
- PangoGlyph unknown_glyph = pango_x_get_unknown_glyph (font);
- PangoRectangle logical_rect;
- const char *p;
- int i;
-
- g_return_if_fail (font);
- g_return_if_fail (glyphs);
- g_return_if_fail (text);
- g_return_if_fail (n_chars >= 0);
-
- pango_font_get_glyph_extents (font, unknown_glyph, NULL, &logical_rect);
- pango_glyph_string_set_size (glyphs, n_chars);
- p = text;
- for (i = 0; i < n_chars; i++)
- {
- glyphs->glyphs[i].glyph = unknown_glyph;
-
- glyphs->glyphs[i].geometry.x_offset = 0;
- glyphs->glyphs[i].geometry.y_offset = 0;
- glyphs->glyphs[i].geometry.width = logical_rect.width;
-
- glyphs->log_clusters[i] = p - text;
-
- p = g_utf8_next_char (p);
- }
-}
-
-/**
- * pango_x_font_get_unknown_glyph:
- * @font: a #PangoFont.
- * @wc: the Unicode character for which a glyph is needed.
- *
- * Returns the index of a glyph suitable for drawing @wc as an
- * unknown character.
- *
- * Use PANGO_GET_UNKNOWN_GLYPH() instead.
- *
- * Return value: a glyph index into @font.
- */
-PangoGlyph
-pango_x_font_get_unknown_glyph (PangoFont *font G_GNUC_UNUSED,
- gunichar wc)
-{
- return PANGO_GET_UNKNOWN_GLYPH (wc);
-}
diff --git a/pango/pangox.def b/pango/pangox.def
deleted file mode 100644
index 36d7e3f4..00000000
--- a/pango/pangox.def
+++ /dev/null
@@ -1,36 +0,0 @@
-EXPORTS
-pango_x_apply_ligatures
-pango_x_context_set_funcs
-pango_x_face_get_coverage
-pango_x_face_get_type
-pango_x_face_remove
-pango_x_fallback_shape
-pango_x_family_get_type
-pango_x_find_first_subfont
-pango_x_font_cache_free
-pango_x_font_cache_load
-pango_x_font_cache_new
-pango_x_font_cache_unload
-pango_x_font_get_type
-pango_x_font_get_unknown_glyph
-pango_x_font_map_for_display
-pango_x_font_map_get_font_cache
-pango_x_font_map_get_type
-pango_x_font_new
-pango_x_font_subfont_xlfd
-pango_x_fontmap_atom_from_name
-pango_x_fontmap_cache_add
-pango_x_fontmap_cache_remove
-pango_x_fontmap_get_display
-pango_x_fontmap_name_from_atom
-pango_x_get_context
-pango_x_get_shaper_map
-pango_x_get_unknown_glyph
-pango_x_has_glyph
-pango_x_list_subfonts
-pango_x_load_font
-pango_x_make_matching_xlfd
-pango_x_render
-pango_x_render_layout
-pango_x_render_layout_line
-pango_x_shutdown_display
diff --git a/pango/pangox.h b/pango/pangox.h
deleted file mode 100644
index f708ed1f..00000000
--- a/pango/pangox.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/* Pango
- * pangox.h:
- *
- * Copyright (C) 1999 Red Hat Software
- * Copyright (C) 2000 SuSE Linux Ltd
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#ifndef __PANGOX_H__
-#define __PANGOX_H__
-
-#include <glib.h>
-#include <pango/pango-layout.h>
-
-G_BEGIN_DECLS
-
-#include <X11/Xlib.h>
-
-#ifndef PANGO_DISABLE_DEPRECATED
-
-#define PANGO_RENDER_TYPE_X "PangoRenderX"
-
-typedef GC (*PangoGetGCFunc) (PangoContext *context, PangoColor *color, GC base_gc);
-typedef void (*PangoFreeGCFunc) (PangoContext *context, GC gc);
-
-/* Calls for applications
- */
-G_DEPRECATED
-PangoContext * pango_x_get_context (Display *display);
-G_DEPRECATED
-void pango_x_context_set_funcs (PangoContext *context,
- PangoGetGCFunc get_gc_func,
- PangoFreeGCFunc free_gc_func);
-
-G_DEPRECATED
-PangoFont * pango_x_load_font (Display *display,
- const gchar *spec);
-G_DEPRECATED
-void pango_x_render (Display *display,
- Drawable d,
- GC gc,
- PangoFont *font,
- PangoGlyphString *glyphs,
- gint x,
- gint y);
-G_DEPRECATED
-void pango_x_render_layout_line (Display *display,
- Drawable drawable,
- GC gc,
- PangoLayoutLine *line,
- int x,
- int y);
-G_DEPRECATED
-void pango_x_render_layout (Display *display,
- Drawable drawable,
- GC gc,
- PangoLayout *layout,
- int x,
- int y);
-
-/* API for rendering modules
- */
-typedef guint16 PangoXSubfont;
-
-#define PANGO_X_MAKE_GLYPH(subfont,index_) ((subfont)<<16 | (index_))
-#define PANGO_X_GLYPH_SUBFONT(glyph) ((glyph)>>16)
-#define PANGO_X_GLYPH_INDEX(glyph) ((glyph) & 0xffff)
-
-G_DEPRECATED
-int pango_x_list_subfonts (PangoFont *font,
- char **charsets,
- int n_charsets,
- PangoXSubfont **subfont_ids,
- int **subfont_charsets);
-G_DEPRECATED
-gboolean pango_x_has_glyph (PangoFont *font,
- PangoGlyph glyph);
-G_DEPRECATED
-PangoGlyph pango_x_get_unknown_glyph (PangoFont *font);
-
-#ifdef PANGO_ENABLE_ENGINE
-G_DEPRECATED
-PangoGlyph pango_x_font_get_unknown_glyph (PangoFont *font,
- gunichar wc);
-#endif /* PANGO_ENABLE_ENGINE */
-
-/* API for libraries that want to use PangoX mixed with classic X fonts.
- */
-typedef struct _PangoXFontCache PangoXFontCache;
-
-G_DEPRECATED
-PangoXFontCache *pango_x_font_cache_new (Display *display);
-G_DEPRECATED
-void pango_x_font_cache_free (PangoXFontCache *cache);
-
-G_DEPRECATED
-XFontStruct * pango_x_font_cache_load (PangoXFontCache *cache,
- const char *xlfd);
-G_DEPRECATED
-void pango_x_font_cache_unload (PangoXFontCache *cache,
- XFontStruct *fs);
-
-G_DEPRECATED
-PangoFontMap * pango_x_font_map_for_display (Display *display);
-G_DEPRECATED
-void pango_x_shutdown_display (Display *display);
-G_DEPRECATED
-PangoXFontCache *pango_x_font_map_get_font_cache (PangoFontMap *font_map);
-
-G_DEPRECATED
-char *pango_x_font_subfont_xlfd (PangoFont *font,
- PangoXSubfont subfont_id);
-
-
-G_DEPRECATED
-gboolean pango_x_find_first_subfont (PangoFont *font,
- char **charsets,
- int n_charsets,
- PangoXSubfont *rfont);
-
-G_DEPRECATED
-void pango_x_fallback_shape (PangoFont *font,
- PangoGlyphString *glyphs,
- const char *text,
- int n_chars);
-
-G_DEPRECATED
-gboolean pango_x_apply_ligatures (PangoFont *font,
- PangoXSubfont subfont,
- gunichar **glyphs,
- int *n_glyphs,
- int **clusters);
-
-#endif /* PANGO_DISABLE_DEPRECATED */
-
-G_END_DECLS
-
-#endif /* __PANGOX_H__ */
diff --git a/pango/pangox.rc.in b/pango/pangox.rc.in
deleted file mode 100644
index c259393c..00000000
--- a/pango/pangox.rc.in
+++ /dev/null
@@ -1,30 +0,0 @@
-#include <winver.h>
-
-VS_VERSION_INFO VERSIONINFO
- FILEVERSION @PANGO_VERSION_MAJOR@,@PANGO_VERSION_MINOR@,@PANGO_VERSION_MICRO@,0
- PRODUCTVERSION @PANGO_VERSION_MAJOR@,@PANGO_VERSION_MINOR@,@PANGO_VERSION_MICRO@,0
- FILEFLAGSMASK 0
- FILEFLAGS 0
- FILEOS VOS__WINDOWS32
- FILETYPE VFT_DLL
- FILESUBTYPE VFT2_UNKNOWN
- BEGIN
- BLOCK "StringFileInfo"
- BEGIN
- BLOCK "040904B0"
- BEGIN
- VALUE "CompanyName", "Red Hat Software"
- VALUE "FileDescription", "Pangox"
- VALUE "FileVersion", "@PANGO_VERSION_MAJOR@.@PANGO_VERSION_MINOR@.@PANGO_VERSION_MICRO@.0"
- VALUE "InternalName", "pangox-@PANGO_API_VERSION@-@PANGO_CURRENT_MINUS_AGE@"
- VALUE "LegalCopyright", "Copyright © 1999 Red Hat Software."
- VALUE "OriginalFilename", "pangox-@PANGO_API_VERSION@-@PANGO_CURRENT_MINUS_AGE@.dll"
- VALUE "ProductName", "Pangox"
- VALUE "ProductVersion", "@PANGO_VERSION_MAJOR@.@PANGO_VERSION_MINOR@.@PANGO_VERSION_MICRO@"
- END
- END
- BLOCK "VarFileInfo"
- BEGIN
- VALUE "Translation", 0x409, 1200
- END
- END
diff --git a/pangox.pc.in b/pangox.pc.in
deleted file mode 100644
index 95f1c261..00000000
--- a/pangox.pc.in
+++ /dev/null
@@ -1,11 +0,0 @@
-prefix=@prefix@
-exec_prefix=@exec_prefix@
-libdir=@libdir@
-includedir=@includedir@
-
-Name: Pango X
-Description: X Window System font support for Pango
-Version: @VERSION@
-Requires: pango
-Libs: -L${libdir} -lpangox-@PANGO_API_VERSION@ @X_LIBS@
-Cflags: -I${includedir}/pango-1.0 @X_CFLAGS@