summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2022-02-12 08:07:07 -0500
committerMatthias Clasen <mclasen@redhat.com>2022-02-17 14:01:43 -0600
commit05fb268ea10f662967ab56a6e425d81261dcbe12 (patch)
tree70025eeff4fd1d7eebe65fea427b464e2c3c0cc0
parent6ffb825d3724630926b8f2f1e1aa61f07da38795 (diff)
downloadpango-05fb268ea10f662967ab56a6e425d81261dcbe12.tar.gz
Drop PangoXft
-rw-r--r--meson.build10
-rw-r--r--meson_options.txt4
-rw-r--r--pango/meson.build69
-rw-r--r--pango/pangoxft-font.c481
-rw-r--r--pango/pangoxft-fontmap.c332
-rw-r--r--pango/pangoxft-private.h63
-rw-r--r--pango/pangoxft-render.c965
-rw-r--r--pango/pangoxft-render.h159
-rw-r--r--pango/pangoxft.h97
-rw-r--r--pango/pangoxft.rc.in30
-rw-r--r--tests/meson.build4
-rw-r--r--utils/meson.build16
-rw-r--r--utils/pango-view.c4
-rw-r--r--utils/viewer-cairo.c10
-rw-r--r--utils/viewer-x.c4
-rw-r--r--utils/viewer-x.h2
16 files changed, 18 insertions, 2232 deletions
diff --git a/meson.build b/meson.build
index fcff9ea7..10d76bc9 100644
--- a/meson.build
+++ b/meson.build
@@ -230,7 +230,6 @@ fribidi_req_version = '>= 1.0.6'
libthai_req_version = '>= 0.1.9'
harfbuzz_req_version = '>= 2.6.0'
fontconfig_req_version = '>= 2.13.0'
-xft_req_version = '>= 2.0.0'
cairo_req_version = '>= 1.12.10'
# libm
@@ -397,14 +396,7 @@ if build_pangoft2
pango_deps += freetype_dep
endif
-build_pangoxft = false
-xft_dep = dependency('xft', version: xft_req_version, required: get_option('xft'))
-if xft_dep.found() and fontconfig_dep.found() and freetype_dep.found()
- pango_conf.set('HAVE_XFT', 1)
- pango_deps += dependency('xrender', required: false)
- pango_deps += xft_dep
- build_pangoxft = true
-endif
+x11_dep = dependency('x11', required: false)
has_core_text = false
if host_system == 'darwin'
diff --git a/meson_options.txt b/meson_options.txt
index 58200e00..fc18fcc2 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -27,10 +27,6 @@ option('cairo',
type : 'feature',
value : 'enabled',
description : 'Build with cairo support')
-option('xft',
- type : 'feature',
- value : 'auto',
- description : 'Build with xft support')
option('freetype',
type : 'feature',
value : 'auto',
diff --git a/pango/meson.build b/pango/meson.build
index d8ecb64e..f53418a7 100644
--- a/pango/meson.build
+++ b/pango/meson.build
@@ -348,75 +348,6 @@ else
pangoft2_gir = [[]]
endif
-# Xft
-if xft_dep.found() and fontconfig_dep.found()
- pangoxft_headers = [
- 'pangoxft.h',
- 'pangoxft-render.h',
- ]
-
- pangoxft_sources = [
- 'pangoxft-font.c',
- 'pangoxft-fontmap.c',
- 'pangoxft-render.c',
- ]
-
- install_headers(pangoxft_headers, subdir: pango_api_path)
-
- libpangoxft = library(
- 'pangoxft-@0@'.format(pango_api_version),
- sources: pangoxft_sources,
- version: pango_libversion,
- soversion: pango_soversion,
- darwin_versions : pango_osxversion,
- install: true,
- dependencies: pango_deps + [ libpango_dep, libpangoft2_dep ],
- include_directories: [ root_inc, pango_inc ],
- c_args: common_cflags + pango_debug_cflags + pango_cflags + [
- '-DPANGO_DISABLE_DEPRECATION_WARNINGS',
- ],
- link_args: common_ldflags,
- )
- pangoxft_dep_sources = []
-
- if build_gir
- pangoxft_gir = gnome.generate_gir(
- libpangoxft,
- sources: pangoxft_headers + pangoxft_sources,
- dependencies: [ libpango_dep, libpangoft2_dep, pango_gir_dep, pangoot_gir_dep, pangoft2_gir_dep ],
- namespace: 'PangoXft',
- nsversion: pango_api_version,
- identifier_prefix: 'PangoXft',
- symbol_prefix: 'pango_xft',
- export_packages: 'pangoxft',
- includes: [ pango_gir[0], pangoot_gir[0], pangoft2_gir[0], 'GObject-2.0', 'xft-2.0', 'xlib-2.0' ],
- header: 'pango/pangoxft.h',
- install: true,
- extra_args: gir_args,
- )
- pangoxft_dep_sources += pangoxft_gir
- endif
-
- libpangoxft_dep = declare_dependency(
- link_with: libpangoxft,
- include_directories: root_inc,
- dependencies: pango_deps + [ libpango_dep, libpangoft2_dep ],
- sources: pangoxft_dep_sources,
- )
- meson.override_dependency('pangoxft', libpangoxft_dep)
-
- pkgconfig.generate(libpangoxft,
- name: 'Pango Xft',
- description: 'Xft font support for Pango',
- filebase: 'pangoxft',
- subdirs: pango_api_name,
- requires: [ 'pangoft2', 'xft' ],
- )
-else
- # For usage as a subproject
- libpangoxft_dep = dependency('', required: false)
-endif
-
# Win32
if host_system == 'windows'
pangowin32_headers = [
diff --git a/pango/pangoxft-font.c b/pango/pangoxft-font.c
deleted file mode 100644
index 2b45e18c..00000000
--- a/pango/pangoxft-font.c
+++ /dev/null
@@ -1,481 +0,0 @@
-/* Pango
- * pangoxft-font.c: Routines for handling X fonts
- *
- * 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 <stdlib.h>
-
-#include "pangofc-fontmap.h"
-#include "pangoxft-private.h"
-#include "pangofc-private.h"
-
-#define PANGO_TYPE_XFT_FONT PANGO_XFT_TYPE_FONT
-
-#define PANGO_XFT_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_XFT_FONT, PangoXftFontClass))
-#define PANGO_XFT_IS_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_XFT_FONT))
-#define PANGO_XFT_FONT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_XFT_FONT, PangoXftFontClass))
-
-typedef struct _PangoXftFontClass PangoXftFontClass;
-
-struct _PangoXftFontClass
-{
- PangoFcFontClass parent_class;
-};
-
-static void pango_xft_font_finalize (GObject *object);
-
-static void pango_xft_font_get_glyph_extents (PangoFont *font,
- PangoGlyph glyph,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect);
-
-static FT_Face pango_xft_font_real_lock_face (PangoFcFont *font);
-static void pango_xft_font_real_unlock_face (PangoFcFont *font);
-static gboolean pango_xft_font_real_has_char (PangoFcFont *font,
- gunichar wc);
-static guint pango_xft_font_real_get_glyph (PangoFcFont *font,
- gunichar wc);
-static void pango_xft_font_real_shutdown (PangoFcFont *font);
-
-static XftFont *xft_font_get_font (PangoFont *font);
-
-G_DEFINE_TYPE (PangoXftFont, pango_xft_font, PANGO_TYPE_FC_FONT)
-
-static void
-pango_xft_font_class_init (PangoXftFontClass *class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (class);
- PangoFontClass *font_class = PANGO_FONT_CLASS (class);
- PangoFcFontClass *fc_font_class = PANGO_FC_FONT_CLASS (class);
-
- object_class->finalize = pango_xft_font_finalize;
-
- font_class->get_glyph_extents = pango_xft_font_get_glyph_extents;
-
- fc_font_class->lock_face = pango_xft_font_real_lock_face;
- fc_font_class->unlock_face = pango_xft_font_real_unlock_face;
- fc_font_class->has_char = pango_xft_font_real_has_char;
- fc_font_class->get_glyph = pango_xft_font_real_get_glyph;
- fc_font_class->shutdown = pango_xft_font_real_shutdown;
-}
-
-static void
-pango_xft_font_init (PangoXftFont *xftfont G_GNUC_UNUSED)
-{
-}
-
-PangoXftFont *
-_pango_xft_font_new (PangoXftFontMap *xftfontmap,
- FcPattern *pattern)
-{
- PangoFontMap *fontmap = PANGO_FONT_MAP (xftfontmap);
- PangoXftFont *xfont;
-
- g_return_val_if_fail (fontmap != NULL, NULL);
- g_return_val_if_fail (pattern != NULL, NULL);
-
- xfont = (PangoXftFont *)g_object_new (PANGO_TYPE_XFT_FONT,
- "pattern", pattern,
- "fontmap", fontmap,
- NULL);
-
- /* Hack to force hinting of vertical metrics; hinting off for
- * a Xft font just means to not hint outlines, but we still
- * want integer line spacing, underline positions, etc
- */
- PANGO_FC_FONT (xfont)->is_hinted = TRUE;
-
- xfont->xft_font = NULL;
-
- return xfont;
-}
-
-/**
- * _pango_xft_font_get_mini_font:
- * @xfont: a `PangoXftFont`
- *
- * Gets the font used for drawing the digits in the
- * missing-character hex squares
- *
- * Return value: the `PangoFont` used for the digits; this
- * value is associated with the main font and will be freed
- * along with the main font.
- */
-PangoFont *
-_pango_xft_font_get_mini_font (PangoXftFont *xfont)
-{
- PangoFcFont *fcfont = (PangoFcFont *)xfont;
-
- if (!fcfont || !fcfont->fontmap)
- return NULL;
-
- if (!xfont->mini_font)
- {
- Display *display;
- int screen;
- PangoFontDescription *desc = pango_font_description_new ();
- PangoContext *context;
- int i;
- int width = 0, height = 0;
- XGlyphInfo extents;
- XftFont *mini_xft;
- int new_size;
-
- _pango_xft_font_map_get_info (fcfont->fontmap, &display, &screen);
-
- context = pango_font_map_create_context (pango_xft_get_font_map (display, screen));
- pango_context_set_language (context, pango_language_from_string ("en"));
-
- pango_font_description_set_family_static (desc, "monospace");
-
- new_size = pango_font_description_get_size (fcfont->description) / 2;
-
- if (pango_font_description_get_size_is_absolute (fcfont->description))
- pango_font_description_set_absolute_size (desc, new_size);
- else
- pango_font_description_set_size (desc, new_size);
-
- xfont->mini_font = pango_font_map_load_font (fcfont->fontmap, context, desc);
- pango_font_description_free (desc);
- g_object_unref (context);
-
- if (!xfont->mini_font)
- return NULL;
-
- mini_xft = xft_font_get_font (xfont->mini_font);
-
- for (i = 0 ; i < 16 ; i++)
- {
- char c = i < 10 ? '0' + i : 'A' + i - 10;
- XftTextExtents8 (display, mini_xft, (FcChar8 *) &c, 1, &extents);
- width = MAX (width, extents.width);
- height = MAX (height, extents.height);
- }
-
- xfont->mini_width = PANGO_SCALE * width;
- xfont->mini_height = PANGO_SCALE * height;
- xfont->mini_pad = PANGO_SCALE * MIN (height / 2, MAX ((int)(2.2 * height + 27) / 28, 1));
- }
-
- return xfont->mini_font;
-}
-
-static void
-pango_xft_font_finalize (GObject *object)
-{
- PangoXftFont *xfont = (PangoXftFont *)object;
- PangoFcFont *fcfont = (PangoFcFont *)object;
-
- if (xfont->mini_font)
- g_object_unref (xfont->mini_font);
-
- if (xfont->xft_font)
- {
- Display *display;
-
- _pango_xft_font_map_get_info (fcfont->fontmap, &display, NULL);
- XftFontClose (display, xfont->xft_font);
- }
-
- if (xfont->glyph_info)
- g_hash_table_destroy (xfont->glyph_info);
-
- G_OBJECT_CLASS (pango_xft_font_parent_class)->finalize (object);
-}
-
-static void
-get_glyph_extents_missing (PangoXftFont *xfont,
- PangoGlyph glyph,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
-
-{
- PangoFont *font = PANGO_FONT (xfont);
- XftFont *xft_font = xft_font_get_font (font);
- gunichar ch;
- gint cols;
-
- ch = glyph & ~PANGO_GLYPH_UNKNOWN_FLAG;
-
- if (G_UNLIKELY (glyph == PANGO_GLYPH_INVALID_INPUT || ch > 0x10FFFF))
- cols = 1;
- else
- cols = ch > 0xffff ? 3 : 2;
-
- _pango_xft_font_get_mini_font (xfont);
-
- if (ink_rect)
- {
- ink_rect->x = 0;
- ink_rect->y = - PANGO_SCALE * xft_font->ascent + PANGO_SCALE * (((xft_font->ascent + xft_font->descent) - (xfont->mini_height * 2 + xfont->mini_pad * 5 + PANGO_SCALE / 2) / PANGO_SCALE) / 2);
- ink_rect->width = xfont->mini_width * cols + xfont->mini_pad * (2 * cols + 1);
- ink_rect->height = xfont->mini_height * 2 + xfont->mini_pad * 5;
- }
-
- if (logical_rect)
- {
- logical_rect->x = 0;
- logical_rect->y = - PANGO_SCALE * xft_font->ascent;
- logical_rect->width = xfont->mini_width * cols + xfont->mini_pad * (2 * cols + 2);
- logical_rect->height = (xft_font->ascent + xft_font->descent) * PANGO_SCALE;
- }
-}
-
-static void
-get_glyph_extents_xft (PangoFcFont *fcfont,
- PangoGlyph glyph,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
-{
- XftFont *xft_font = xft_font_get_font ((PangoFont *)fcfont);
- XGlyphInfo extents;
- Display *display;
- FT_UInt ft_glyph = glyph;
-
- _pango_xft_font_map_get_info (fcfont->fontmap, &display, NULL);
-
- XftGlyphExtents (display, xft_font, &ft_glyph, 1, &extents);
-
- if (ink_rect)
- {
- ink_rect->x = - extents.x * PANGO_SCALE; /* Xft crack-rock sign choice */
- ink_rect->y = - extents.y * PANGO_SCALE; /* " */
- ink_rect->width = extents.width * PANGO_SCALE;
- ink_rect->height = extents.height * PANGO_SCALE;
- }
-
- if (logical_rect)
- {
- logical_rect->x = 0;
- logical_rect->y = - xft_font->ascent * PANGO_SCALE;
- logical_rect->width = extents.xOff * PANGO_SCALE;
- logical_rect->height = (xft_font->ascent + xft_font->descent) * PANGO_SCALE;
- }
-}
-
-typedef struct
-{
- PangoRectangle ink_rect;
- PangoRectangle logical_rect;
-} Extents;
-
-static void
-extents_free (Extents *ext)
-{
- g_slice_free (Extents, ext);
-}
-
-static void
-get_glyph_extents_raw (PangoXftFont *xfont,
- PangoGlyph glyph,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
-{
- Extents *extents;
-
- if (!xfont->glyph_info)
- xfont->glyph_info = g_hash_table_new_full (NULL, NULL,
- NULL, (GDestroyNotify)extents_free);
-
- extents = g_hash_table_lookup (xfont->glyph_info,
- GUINT_TO_POINTER (glyph));
-
- if (!extents)
- {
- extents = g_slice_new (Extents);
-
- pango_fc_font_get_raw_extents (PANGO_FC_FONT (xfont),
- glyph,
- &extents->ink_rect,
- &extents->logical_rect);
-
- g_hash_table_insert (xfont->glyph_info,
- GUINT_TO_POINTER (glyph),
- extents);
- }
-
- if (ink_rect)
- *ink_rect = extents->ink_rect;
-
- if (logical_rect)
- *logical_rect = extents->logical_rect;
-}
-
-static void
-pango_xft_font_get_glyph_extents (PangoFont *font,
- PangoGlyph glyph,
- PangoRectangle *ink_rect,
- PangoRectangle *logical_rect)
-{
- PangoXftFont *xfont = (PangoXftFont *)font;
- PangoFcFont *fcfont = PANGO_FC_FONT (font);
- gboolean empty = FALSE;
-
- if (G_UNLIKELY (!fcfont->fontmap)) /* Display closed */
- {
- 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_EMPTY)
- {
- glyph = pango_fc_font_get_glyph (fcfont, ' ');
- empty = TRUE;
- }
-
- if (glyph & PANGO_GLYPH_UNKNOWN_FLAG)
- {
- get_glyph_extents_missing (xfont, glyph, ink_rect, logical_rect);
- }
- else
- {
- if (!fcfont->is_transformed)
- get_glyph_extents_xft (fcfont, glyph, ink_rect, logical_rect);
- else
- get_glyph_extents_raw (xfont, glyph, ink_rect, logical_rect);
- }
-
- if (empty)
- {
- if (ink_rect)
- ink_rect->x = ink_rect->y = ink_rect->height = ink_rect->width = 0;
- if (logical_rect)
- logical_rect->x = logical_rect->width = 0;
- return;
- }
-}
-
-static void
-load_fallback_font (PangoXftFont *xfont)
-{
- PangoFcFont *fcfont = PANGO_FC_FONT (xfont);
- Display *display;
- int screen;
- XftFont *xft_font;
- gboolean size_is_absolute;
- double size;
-
- _pango_xft_font_map_get_info (fcfont->fontmap, &display, &screen);
-
- size_is_absolute = pango_font_description_get_size_is_absolute (fcfont->description);
- size = pango_font_description_get_size (fcfont->description) / PANGO_SCALE;
-
- xft_font = XftFontOpen (display, screen,
- FC_FAMILY, FcTypeString, "sans",
- size_is_absolute ? FC_PIXEL_SIZE : FC_SIZE, FcTypeDouble, size,
- NULL);
-
- xfont->xft_font = xft_font;
-}
-
-static XftFont *
-xft_font_get_font (PangoFont *font)
-{
- PangoXftFont *xfont;
- PangoFcFont *fcfont;
- Display *display;
- int screen;
-
- xfont = (PangoXftFont *)font;
- fcfont = (PangoFcFont *)font;
-
- if (G_UNLIKELY (xfont->xft_font == NULL))
- {
- FcPattern *pattern = FcPatternDuplicate (fcfont->font_pattern);
- FcPatternDel (pattern, FC_SPACING);
-
- _pango_xft_font_map_get_info (fcfont->fontmap, &display, &screen);
-
- xfont->xft_font = XftFontOpenPattern (display, pattern);
- if (!xfont->xft_font)
- {
- gchar *name = pango_font_description_to_string (fcfont->description);
- g_warning ("Cannot open font file for font %s", name);
- g_free (name);
-
- load_fallback_font (xfont);
- }
- }
-
- return xfont->xft_font;
-}
-
-static FT_Face
-pango_xft_font_real_lock_face (PangoFcFont *font)
-{
- XftFont *xft_font = xft_font_get_font ((PangoFont *)font);
-
- return XftLockFace (xft_font);
-}
-
-static void
-pango_xft_font_real_unlock_face (PangoFcFont *font)
-{
- XftFont *xft_font = xft_font_get_font ((PangoFont *)font);
-
- XftUnlockFace (xft_font);
-}
-
-static gboolean
-pango_xft_font_real_has_char (PangoFcFont *font,
- gunichar wc)
-{
- XftFont *xft_font = xft_font_get_font ((PangoFont *)font);
-
- return XftCharExists (NULL, xft_font, wc);
-}
-
-static guint
-pango_xft_font_real_get_glyph (PangoFcFont *font,
- gunichar wc)
-{
- XftFont *xft_font = xft_font_get_font ((PangoFont *)font);
-
- return XftCharIndex (NULL, xft_font, wc);
-}
-
-static void
-pango_xft_font_real_shutdown (PangoFcFont *fcfont)
-{
- PangoXftFont *xfont = PANGO_XFT_FONT (fcfont);
-
- if (xfont->xft_font)
- {
- Display *display;
-
- _pango_xft_font_map_get_info (fcfont->fontmap, &display, NULL);
- XftFontClose (display, xfont->xft_font);
- xfont->xft_font = NULL;
- }
-}
-
-XftFont *
-pango_xft_font_get_font (PangoFont *font)
-{
- if (G_UNLIKELY (!font))
- return NULL;
-
- return xft_font_get_font (font);
-}
-
diff --git a/pango/pangoxft-fontmap.c b/pango/pangoxft-fontmap.c
deleted file mode 100644
index 3b0a4c2b..00000000
--- a/pango/pangoxft-fontmap.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/* Pango
- * pangoxft-fontmap.c: Xft font handling
- *
- * Copyright (C) 2000-2003 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 <stdlib.h>
-#include <string.h>
-
-#include "pangofc-fontmap-private.h"
-#include "pangoxft.h"
-#include "pangoxft-private.h"
-
-/* For XExtSetCloseDisplay */
-#include <X11/Xlibint.h>
-
-typedef struct _PangoXftFamily PangoXftFamily;
-typedef struct _PangoXftFontMapClass PangoXftFontMapClass;
-
-#define PANGO_TYPE_XFT_FONT_MAP (pango_xft_font_map_get_type ())
-#define PANGO_XFT_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_XFT_FONT_MAP, PangoXftFontMap))
-#define PANGO_XFT_IS_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_XFT_FONT_MAP))
-
-struct _PangoXftFontMap
-{
- PangoFcFontMap parent_instance;
-
- guint serial;
-
- Display *display;
- int screen;
-
- PangoRenderer *renderer;
-};
-
-struct _PangoXftFontMapClass
-{
- PangoFcFontMapClass parent_class;
-};
-
-static guint pango_xft_font_map_get_serial (PangoFontMap *fontmap);
-static void pango_xft_font_map_changed (PangoFontMap *fontmap);
-static void pango_xft_font_map_default_substitute (PangoFcFontMap *fcfontmap,
- FcPattern *pattern);
-static PangoFcFont * pango_xft_font_map_new_font (PangoFcFontMap *fcfontmap,
- FcPattern *pattern);
-static void pango_xft_font_map_finalize (GObject *object);
-
-G_LOCK_DEFINE_STATIC (fontmaps);
-static GSList *fontmaps = NULL; /* MT-safe */
-
-G_DEFINE_TYPE (PangoXftFontMap, pango_xft_font_map, PANGO_TYPE_FC_FONT_MAP)
-
-static void
-pango_xft_font_map_class_init (PangoXftFontMapClass *class)
-{
- GObjectClass *gobject_class = G_OBJECT_CLASS (class);
- PangoFontMapClass *fontmap_class = PANGO_FONT_MAP_CLASS (class);
- PangoFcFontMapClass *fcfontmap_class = PANGO_FC_FONT_MAP_CLASS (class);
-
- gobject_class->finalize = pango_xft_font_map_finalize;
-
- fontmap_class->get_serial = pango_xft_font_map_get_serial;
- fontmap_class->changed = pango_xft_font_map_changed;
-
- fcfontmap_class->default_substitute = pango_xft_font_map_default_substitute;
- fcfontmap_class->new_font = pango_xft_font_map_new_font;
-}
-
-static void
-pango_xft_font_map_init (PangoXftFontMap *xftfontmap)
-{
- xftfontmap->serial = 1;
-}
-
-static void
-pango_xft_font_map_finalize (GObject *object)
-{
- PangoXftFontMap *xftfontmap = PANGO_XFT_FONT_MAP (object);
-
- if (xftfontmap->renderer)
- g_object_unref (xftfontmap->renderer);
-
- G_LOCK (fontmaps);
- fontmaps = g_slist_remove (fontmaps, object);
- G_UNLOCK (fontmaps);
-
- G_OBJECT_CLASS (pango_xft_font_map_parent_class)->finalize (object);
-}
-
-
-static guint
-pango_xft_font_map_get_serial (PangoFontMap *fontmap)
-{
- PangoXftFontMap *xftfontmap = PANGO_XFT_FONT_MAP (fontmap);
-
- return xftfontmap->serial;
-}
-
-static void
-pango_xft_font_map_changed (PangoFontMap *fontmap)
-{
- PangoXftFontMap *xftfontmap = PANGO_XFT_FONT_MAP (fontmap);
-
- xftfontmap->serial++;
- if (xftfontmap->serial == 0)
- xftfontmap->serial++;
-}
-
-static PangoFontMap *
-pango_xft_find_font_map (Display *display,
- int screen)
-{
- GSList *tmp_list;
-
- G_LOCK (fontmaps);
- tmp_list = fontmaps;
- while (tmp_list)
- {
- PangoXftFontMap *xftfontmap = tmp_list->data;
-
- if (xftfontmap->display == display &&
- xftfontmap->screen == screen)
- {
- G_UNLOCK (fontmaps);
- return PANGO_FONT_MAP (xftfontmap);
- }
-
- tmp_list = tmp_list->next;
- }
- G_UNLOCK (fontmaps);
-
- return NULL;
-}
-
-/*
- * Hackery to set up notification when a Display is closed
- */
-static GSList *registered_displays; /* MT-safe, protected by fontmaps lock */
-
-static int
-close_display_cb (Display *display,
- XExtCodes *extcodes G_GNUC_UNUSED)
-{
- GSList *tmp_list;
-
- G_LOCK (fontmaps);
- tmp_list = g_slist_copy (fontmaps);
- G_UNLOCK (fontmaps);
-
- while (tmp_list)
- {
- PangoXftFontMap *xftfontmap = tmp_list->data;
- tmp_list = tmp_list->next;
-
- if (xftfontmap->display == display)
- pango_xft_shutdown_display (display, xftfontmap->screen);
- }
-
- g_slist_free (tmp_list);
-
- 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);
-}
-
-/**
- * pango_xft_get_font_map:
- * @display: an X display
- * @screen: the screen number of a screen within @display
- *
- * Returns the `PangoXftFontMap` for the given display and screen.
- * The fontmap is owned by Pango and will be valid until
- * the display is closed.
- *
- * Return value: (transfer none): a `PangoFontMap` object, owned by Pango.
- *
- * Since: 1.2
- **/
-PangoFontMap *
-pango_xft_get_font_map (Display *display,
- int screen)
-{
- PangoFontMap *fontmap;
- PangoXftFontMap *xftfontmap;
-
- g_return_val_if_fail (display != NULL, NULL);
-
- fontmap = pango_xft_find_font_map (display, screen);
- if (fontmap)
- return fontmap;
-
- xftfontmap = (PangoXftFontMap *)g_object_new (PANGO_TYPE_XFT_FONT_MAP, NULL);
-
- xftfontmap->display = display;
- xftfontmap->screen = screen;
-
- G_LOCK (fontmaps);
-
- register_display (display);
-
- fontmaps = g_slist_prepend (fontmaps, xftfontmap);
-
- G_UNLOCK (fontmaps);
-
- return PANGO_FONT_MAP (xftfontmap);
-}
-
-/**
- * pango_xft_shutdown_display:
- * @display: an X display
- * @screen: the screen number of a screen within @display
- *
- * Release any resources that have been cached for the
- * combination of @display and @screen. Note that when the
- * X display is closed, resources are released automatically,
- * without needing to call this function.
- *
- * Since: 1.2
- **/
-void
-pango_xft_shutdown_display (Display *display,
- int screen)
-{
- PangoFontMap *fontmap;
-
- fontmap = pango_xft_find_font_map (display, screen);
- if (fontmap)
- {
- PangoXftFontMap *xftfontmap = PANGO_XFT_FONT_MAP (fontmap);
-
- G_LOCK (fontmaps);
- fontmaps = g_slist_remove (fontmaps, fontmap);
- G_UNLOCK (fontmaps);
- pango_fc_font_map_shutdown (PANGO_FC_FONT_MAP (fontmap));
-
- xftfontmap->display = NULL;
- g_object_unref (fontmap);
- }
-}
-
-void
-_pango_xft_font_map_get_info (PangoFontMap *fontmap,
- Display **display,
- int *screen)
-{
- PangoXftFontMap *xftfontmap = (PangoXftFontMap *)fontmap;
-
- if (display)
- *display = xftfontmap->display;
- if (screen)
- *screen = xftfontmap->screen;
-}
-
-/**
- * _pango_xft_font_map_get_renderer:
- * @fontmap: a `PangoXftFontMap`
- *
- * Gets the singleton `PangoXFTRenderer` for this fontmap.
- *
- * Return value: the renderer.
- **/
-PangoRenderer *
-_pango_xft_font_map_get_renderer (PangoXftFontMap *xftfontmap)
-{
- if (!xftfontmap->renderer)
- xftfontmap->renderer = pango_xft_renderer_new (xftfontmap->display,
- xftfontmap->screen);
-
- return xftfontmap->renderer;
-}
-
-static void
-pango_xft_font_map_default_substitute (PangoFcFontMap *fcfontmap,
- FcPattern *pattern)
-{
- PangoXftFontMap *xftfontmap = PANGO_XFT_FONT_MAP (fcfontmap);
- double d;
-
- FcConfigSubstitute (NULL, pattern, FcMatchPattern);
- if (fcfontmap->substitute_func)
- fcfontmap->substitute_func (pattern, fcfontmap->substitute_data);
- XftDefaultSubstitute (xftfontmap->display, xftfontmap->screen, pattern);
- if (FcPatternGetDouble (pattern, FC_PIXEL_SIZE, 0, &d) == FcResultMatch && d == 0.0)
- {
- FcValue v;
- v.type = FcTypeDouble;
- v.u.d = 1.0;
- FcPatternAdd (pattern, FC_PIXEL_SIZE, v, FcFalse);
- }
-}
-
-static PangoFcFont *
-pango_xft_font_map_new_font (PangoFcFontMap *fcfontmap,
- FcPattern *pattern)
-{
- return (PangoFcFont *)_pango_xft_font_new (PANGO_XFT_FONT_MAP (fcfontmap), pattern);
-}
diff --git a/pango/pangoxft-private.h b/pango/pangoxft-private.h
deleted file mode 100644
index f9b8a84b..00000000
--- a/pango/pangoxft-private.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Pango
- * pangox-private.h:
- *
- * 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.
- */
-
-#ifndef __PANGOXFT_PRIVATE_H__
-#define __PANGOXFT_PRIVATE_H__
-
-#include <pango/pangoxft.h>
-#include <pango/pangofc-font-private.h>
-#include <pango/pango-renderer.h>
-
-G_BEGIN_DECLS
-
-struct _PangoXftFont
-{
- PangoFcFont parent_instance;
-
- XftFont *xft_font; /* created on demand */
- PangoFont *mini_font; /* font used to display missing glyphs */
-
- guint mini_width; /* metrics for missing glyph drawing */
- guint mini_height;
- guint mini_pad;
-
- GHashTable *glyph_info; /* Used only when we can't get
- * glyph extents out of Xft because
- * we have a transformation in effect
- */
-};
-
-PangoXftFont *_pango_xft_font_new (PangoXftFontMap *xftfontmap,
- FcPattern *pattern);
-
-void _pango_xft_font_map_get_info (PangoFontMap *fontmap,
- Display **display,
- int *screen);
-
-PangoRenderer *_pango_xft_font_map_get_renderer (PangoXftFontMap *xftfontmap);
-
-PangoFont *_pango_xft_font_get_mini_font (PangoXftFont *xfont);
-
-XftFont * pango_xft_font_get_font (PangoFont *font);
-
-G_END_DECLS
-
-#endif /* __PANGOXFT_PRIVATE_H__ */
diff --git a/pango/pangoxft-render.c b/pango/pangoxft-render.c
deleted file mode 100644
index 9228a5c5..00000000
--- a/pango/pangoxft-render.c
+++ /dev/null
@@ -1,965 +0,0 @@
-/* Pango
- * pangoxft-render.c: Rendering routines for the Xft library
- *
- * Copyright (C) 2004 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 <math.h>
-
-#include "pangoxft-render.h"
-#include "pangoxft-private.h"
-
-enum {
- PROP_0,
- PROP_DISPLAY,
- PROP_SCREEN
-};
-
-struct _PangoXftRendererPrivate
-{
- PangoColor default_color;
- guint16 alpha;
-
- Picture src_picture;
- Picture dest_picture;
-
- XRenderPictFormat *mask_format;
-
- GArray *trapezoids;
- PangoRenderPart trapezoid_part;
-
- GArray *glyphs;
- PangoFont *glyph_font;
-};
-
-static void pango_xft_renderer_finalize (GObject *object);
-static void pango_xft_renderer_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-
-static void pango_xft_renderer_real_composite_trapezoids (PangoXftRenderer *xftrenderer,
- PangoRenderPart part,
- XTrapezoid *trapezoids,
- int n_trapezoids);
-static void pango_xft_renderer_real_composite_glyphs (PangoXftRenderer *xftrenderer,
- XftFont *xft_font,
- XftGlyphSpec *glyphs,
- int n_glyphs);
-
-static void pango_xft_renderer_draw_glyphs (PangoRenderer *renderer,
- PangoFont *font,
- PangoGlyphString *glyphs,
- int x,
- int y);
-static void pango_xft_renderer_draw_trapezoid (PangoRenderer *renderer,
- PangoRenderPart part,
- double y1,
- double x11,
- double x21,
- double y2,
- double x12,
- double x22);
-static void pango_xft_renderer_part_changed (PangoRenderer *renderer,
- PangoRenderPart part);
-static void pango_xft_renderer_end (PangoRenderer *renderer);
-
-static void flush_trapezoids (PangoXftRenderer *xftrenderer);
-static void flush_glyphs (PangoXftRenderer *xftrenderer);
-
-G_DEFINE_TYPE_WITH_PRIVATE (PangoXftRenderer, pango_xft_renderer, PANGO_TYPE_RENDERER)
-
-static void
-pango_xft_renderer_init (PangoXftRenderer *xftrenderer)
-{
- xftrenderer->priv = pango_xft_renderer_get_instance_private (xftrenderer);
- xftrenderer->priv->alpha = 0xffff;
-}
-
-static void
-pango_xft_renderer_class_init (PangoXftRendererClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
- PangoRendererClass *renderer_class = PANGO_RENDERER_CLASS (klass);
-
- klass->composite_glyphs = pango_xft_renderer_real_composite_glyphs;
- klass->composite_trapezoids = pango_xft_renderer_real_composite_trapezoids;
-
- renderer_class->draw_glyphs = pango_xft_renderer_draw_glyphs;
- renderer_class->draw_trapezoid = pango_xft_renderer_draw_trapezoid;
- renderer_class->part_changed = pango_xft_renderer_part_changed;
- renderer_class->end = pango_xft_renderer_end;
-
- object_class->finalize = pango_xft_renderer_finalize;
- object_class->set_property = pango_xft_renderer_set_property;
-
- g_object_class_install_property (object_class, PROP_DISPLAY,
- g_param_spec_pointer ("display",
- "Display",
- "The display being rendered to",
- G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
- g_object_class_install_property (object_class, PROP_SCREEN,
- g_param_spec_int ("screen",
- "Screen",
- "The screen being rendered to",
- 0, G_MAXINT, 0,
- G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
-}
-
-static void
-pango_xft_renderer_finalize (GObject *object)
-{
- PangoXftRenderer *renderer = PANGO_XFT_RENDERER (object);
-
- if (renderer->priv->glyphs)
- g_array_free (renderer->priv->glyphs, TRUE);
- if (renderer->priv->trapezoids)
- g_array_free (renderer->priv->trapezoids, TRUE);
-
- G_OBJECT_CLASS (pango_xft_renderer_parent_class)->finalize (object);
-}
-
-static void
-pango_xft_renderer_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- PangoXftRenderer *xftrenderer = PANGO_XFT_RENDERER (object);
-
- switch (prop_id)
- {
- case PROP_DISPLAY:
- xftrenderer->display = g_value_get_pointer (value);
- /* We possibly should use ARGB format when subpixel-AA is turned
- * on for the fontmap; we could discover that using the technique
- * for FC_DPI in pango_fc_face_list_sizes.
- */
- xftrenderer->priv->mask_format = XRenderFindStandardFormat (xftrenderer->display,
- PictStandardA8);
- break;
- case PROP_SCREEN:
- xftrenderer->screen = g_value_get_int (value);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-pango_xft_renderer_set_pictures (PangoXftRenderer *renderer,
- Picture src_picture,
- Picture dest_picture)
-{
- renderer->priv->src_picture = src_picture;
- renderer->priv->dest_picture = dest_picture;
-}
-
-static void
-flush_glyphs (PangoXftRenderer *xftrenderer)
-{
- XftFont *xft_font;
-
- if (!xftrenderer->priv->glyphs ||
- xftrenderer->priv->glyphs->len == 0)
- return;
-
- xft_font = pango_xft_font_get_font (xftrenderer->priv->glyph_font);
-
- PANGO_XFT_RENDERER_GET_CLASS (xftrenderer)->composite_glyphs (xftrenderer,
- xft_font,
- (XftGlyphSpec *)(void*)xftrenderer->priv->glyphs->data,
- xftrenderer->priv->glyphs->len);
-
- g_array_set_size (xftrenderer->priv->glyphs, 0);
- g_object_unref (xftrenderer->priv->glyph_font);
- xftrenderer->priv->glyph_font = NULL;
-}
-
-#define MAX_GLYPHS 1024
-
-static void
-draw_glyph (PangoRenderer *renderer,
- PangoFont *font,
- FT_UInt glyph,
- int x,
- int y)
-{
- PangoXftRenderer *xftrenderer = PANGO_XFT_RENDERER (renderer);
- XftGlyphSpec gs;
- int pixel_x, pixel_y;
-
- if (renderer->matrix)
- {
- pixel_x = floor (0.5 + (x * renderer->matrix->xx + y * renderer->matrix->xy) / PANGO_SCALE + renderer->matrix->x0);
- pixel_y = floor (0.5 + (x * renderer->matrix->yx + y * renderer->matrix->yy) / PANGO_SCALE + renderer->matrix->y0);
- }
- else
- {
- pixel_x = PANGO_PIXELS (x);
- pixel_y = PANGO_PIXELS (y);
- }
-
- /* 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 (pixel_x < -32768 || pixel_x > 32767 ||
- pixel_y < -32768 || pixel_y > 32767)
- return;
-
- flush_trapezoids (xftrenderer);
-
- if (!xftrenderer->priv->glyphs)
- xftrenderer->priv->glyphs = g_array_new (FALSE, FALSE,
- sizeof (XftGlyphSpec));
-
- if (xftrenderer->priv->glyph_font != font ||
- xftrenderer->priv->glyphs->len == MAX_GLYPHS)
- {
- flush_glyphs (xftrenderer);
-
- xftrenderer->priv->glyph_font = g_object_ref (font);
- }
-
- gs.x = pixel_x;
- gs.y = pixel_y;
- gs.glyph = glyph;
-
- g_array_append_val (xftrenderer->priv->glyphs, gs);
-}
-
-static gboolean
-point_in_bounds (PangoRenderer *renderer,
- gint x,
- gint y)
-{
- gdouble pixel_x = (x * renderer->matrix->xx + y * renderer->matrix->xy) / PANGO_SCALE + renderer->matrix->x0;
- gdouble pixel_y = (x * renderer->matrix->yx + y * renderer->matrix->yy) / PANGO_SCALE + renderer->matrix->y0;
-
- return (pixel_x >= -32768. && pixel_x < 32768. &&
- pixel_y >= -32768. && pixel_y < 32768.);
-}
-
-static gboolean
-box_in_bounds (PangoRenderer *renderer,
- gint x,
- gint y,
- gint width,
- gint height)
-{
- if (!renderer->matrix)
- {
-#define COORD_MIN (PANGO_SCALE * -16384 - PANGO_SCALE / 2)
-#define COORD_MAX (PANGO_SCALE * 32767 + PANGO_SCALE / 2 - 1)
- return (x >= COORD_MIN && x + width <= COORD_MAX &&
- y >= COORD_MIN && y + width <= COORD_MAX);
-#undef COORD_MIN
-#undef COORD_MAX
- }
- else
- {
- return (point_in_bounds (renderer, x, y) &&
- point_in_bounds (renderer, x + width, y) &&
- point_in_bounds (renderer, x + width, y + height) &&
- point_in_bounds (renderer, x, y + height));
- }
-}
-
-static void
-get_total_matrix (PangoMatrix *total,
- const PangoMatrix *global,
- double x,
- double y,
- double width,
- double height)
-{
- PangoMatrix local = PANGO_MATRIX_INIT;
- gdouble angle = atan2 (height, width);
-
- pango_matrix_translate (&local, x, y);
- pango_matrix_rotate (&local, -angle * (180. / G_PI));
-
- *total = *global;
- pango_matrix_concat (total, &local);
-}
-
-static void
-draw_box (PangoRenderer *renderer,
- gint line_width,
- gint x,
- gint y,
- gint width,
- gint height,
- gboolean invalid)
-{
- pango_renderer_draw_rectangle (renderer, PANGO_RENDER_PART_FOREGROUND,
- x, y, width, line_width);
- pango_renderer_draw_rectangle (renderer, PANGO_RENDER_PART_FOREGROUND,
- x, y + line_width, line_width, height - line_width * 2);
- pango_renderer_draw_rectangle (renderer, PANGO_RENDER_PART_FOREGROUND,
- x + width - line_width, y + line_width, line_width, height - line_width * 2);
- pango_renderer_draw_rectangle (renderer, PANGO_RENDER_PART_FOREGROUND,
- x, y + height - line_width, width, line_width);
-
- if (invalid)
- {
- int length;
- double in_width, in_height;
- PangoMatrix orig_matrix = PANGO_MATRIX_INIT, new_matrix;
- const PangoMatrix *porig_matrix;
-
- in_width = pango_units_to_double (width - 2 * line_width);
- in_height = pango_units_to_double (height - 2 * line_width);
- length = PANGO_SCALE * sqrt (in_width*in_width + in_height*in_height);
-
- porig_matrix = pango_renderer_get_matrix (renderer);
- if (porig_matrix)
- {
- orig_matrix = *porig_matrix;
- porig_matrix = &orig_matrix;
- }
-
- get_total_matrix (&new_matrix, &orig_matrix,
- pango_units_to_double (x + line_width), pango_units_to_double (y + line_width),
- in_width, in_height);
- pango_renderer_set_matrix (renderer, &new_matrix);
- pango_renderer_draw_rectangle (renderer, PANGO_RENDER_PART_FOREGROUND,
- 0, -line_width / 2, length, line_width);
-
- get_total_matrix (&new_matrix, &orig_matrix,
- pango_units_to_double (x + line_width), pango_units_to_double (y + height - line_width),
- in_width, -in_height);
- pango_renderer_set_matrix (renderer, &new_matrix);
- pango_renderer_draw_rectangle (renderer, PANGO_RENDER_PART_FOREGROUND,
- 0, -line_width / 2, length, line_width);
-
- pango_renderer_set_matrix (renderer, porig_matrix);
- }
-}
-
-static void
-_pango_xft_renderer_draw_box_glyph (PangoRenderer *renderer,
- PangoGlyphInfo *gi,
- int glyph_x,
- int glyph_y,
- gboolean invalid)
-{
- int x = glyph_x + PANGO_SCALE;
- int y = glyph_y - PANGO_SCALE * (PANGO_UNKNOWN_GLYPH_HEIGHT - 1);
- int width = gi->geometry.width - PANGO_SCALE * 2;
- int height = PANGO_SCALE * (PANGO_UNKNOWN_GLYPH_HEIGHT - 2);
-
- if (box_in_bounds (renderer, x, y, width, height))
- draw_box (renderer, PANGO_SCALE, x, y, width, height, invalid);
-}
-
-static void
-_pango_xft_renderer_draw_unknown_glyph (PangoRenderer *renderer,
- PangoXftFont *xfont,
- XftFont *xft_font,
- PangoGlyphInfo *gi,
- int glyph_x,
- int glyph_y)
-{
- char buf[7];
- int ys[3];
- int xs[4];
- int row, col;
- int cols;
- gunichar ch;
- gboolean invalid_input;
-
- PangoFont *mini_font;
- XftFont *mini_xft_font;
-
- ch = gi->glyph & ~PANGO_GLYPH_UNKNOWN_FLAG;
- if (G_UNLIKELY (gi->glyph == PANGO_GLYPH_INVALID_INPUT || ch > 0x10FFFF))
- {
- invalid_input = TRUE;
- cols = 1;
- }
- else
- {
- invalid_input = FALSE;
- cols = ch > 0xffff ? 3 : 2;
- g_snprintf (buf, sizeof(buf), (ch > 0xffff) ? "%06X" : "%04X", ch);
- }
-
- mini_font = _pango_xft_font_get_mini_font (xfont);
- mini_xft_font = pango_xft_font_get_font (mini_font);
- if (!mini_xft_font)
- {
- _pango_xft_renderer_draw_box_glyph (renderer, gi, glyph_x, glyph_y, invalid_input);
- return;
- }
-
-
- ys[0] = glyph_y - PANGO_SCALE * xft_font->ascent + PANGO_SCALE * (((xft_font->ascent + xft_font->descent) - (xfont->mini_height * 2 + xfont->mini_pad * 5 + PANGO_SCALE / 2) / PANGO_SCALE) / 2);
- ys[1] = ys[0] + 2 * xfont->mini_pad + xfont->mini_height;
- ys[2] = ys[1] + xfont->mini_height + xfont->mini_pad;
-
- xs[0] = glyph_x;
- xs[1] = xs[0] + 2 * xfont->mini_pad;
- xs[2] = xs[1] + xfont->mini_width + xfont->mini_pad;
- xs[3] = xs[2] + xfont->mini_width + xfont->mini_pad;
-
- if (box_in_bounds (renderer,
- xs[0], ys[0],
- xfont->mini_width * cols + xfont->mini_pad * (2 * cols + 1),
- xfont->mini_height * 2 + xfont->mini_pad * 5))
- {
- if (xfont->mini_pad)
- draw_box (renderer, xfont->mini_pad,
- xs[0], ys[0],
- xfont->mini_width * cols + xfont->mini_pad * (2 * cols + 1),
- xfont->mini_height * 2 + xfont->mini_pad * 5,
- invalid_input);
-
- if (invalid_input)
- return;
-
- for (row = 0; row < 2; row++)
- for (col = 0; col < cols; col++)
- {
- draw_glyph (renderer, mini_font,
- XftCharIndex (NULL, mini_xft_font,
- buf[row * cols + col] & 0xff),
- xs[col+1],
- ys[row+1]);
- }
- }
-}
-
-static void
-pango_xft_renderer_draw_glyphs (PangoRenderer *renderer,
- PangoFont *font,
- PangoGlyphString *glyphs,
- int x,
- int y)
-{
- PangoXftFont *xfont = PANGO_XFT_FONT (font);
- PangoFcFont *fcfont = PANGO_FC_FONT (font);
- XftFont *xft_font = pango_xft_font_get_font (font);
- int i;
- int x_off = 0;
-
- if (!fcfont)
- {
- for (i=0; i<glyphs->num_glyphs; i++)
- {
- PangoGlyphInfo *gi = &glyphs->glyphs[i];
-
- if (gi->glyph != PANGO_GLYPH_EMPTY)
- {
- int glyph_x = x + x_off + gi->geometry.x_offset;
- int glyph_y = y + gi->geometry.y_offset;
-
- _pango_xft_renderer_draw_unknown_glyph (renderer,
- xfont,
- xft_font,
- gi,
- glyph_x,
- glyph_y);
- }
-
- x_off += gi->geometry.width;
- }
- return;
- }
-
- if (!fcfont->fontmap) /* Display closed */
- return;
-
- for (i=0; i<glyphs->num_glyphs; i++)
- {
- PangoGlyphInfo *gi = &glyphs->glyphs[i];
-
- if (gi->glyph != PANGO_GLYPH_EMPTY)
- {
- int glyph_x = x + x_off + gi->geometry.x_offset;
- int glyph_y = y + gi->geometry.y_offset;
-
- if (gi->glyph & PANGO_GLYPH_UNKNOWN_FLAG)
- {
- _pango_xft_renderer_draw_unknown_glyph (renderer,
- xfont,
- xft_font,
- gi,
- glyph_x,
- glyph_y);
- }
- else
- {
- draw_glyph (renderer, font, gi->glyph, glyph_x, glyph_y);
- }
- }
-
- x_off += gi->geometry.width;
- }
-}
-
-static void
-flush_trapezoids (PangoXftRenderer *xftrenderer)
-{
- if (!xftrenderer->priv->trapezoids ||
- xftrenderer->priv->trapezoids->len == 0)
- return;
-
- PANGO_XFT_RENDERER_GET_CLASS (xftrenderer)->composite_trapezoids (xftrenderer,
- xftrenderer->priv->trapezoid_part,
- (XTrapezoid *)(void *)xftrenderer->priv->trapezoids->data,
- xftrenderer->priv->trapezoids->len);
-
- g_array_set_size (xftrenderer->priv->trapezoids, 0);
-}
-
-static void
-pango_xft_renderer_draw_trapezoid (PangoRenderer *renderer,
- PangoRenderPart part,
- double y1,
- double x11,
- double x21,
- double y2,
- double x12,
- double x22)
-{
- PangoXftRenderer *xftrenderer = PANGO_XFT_RENDERER (renderer);
- XTrapezoid trap;
-
- flush_glyphs (xftrenderer);
-
- if (!xftrenderer->priv->trapezoids)
- xftrenderer->priv->trapezoids = g_array_new (FALSE, FALSE,
- sizeof (XTrapezoid));
-
- if (xftrenderer->draw)
- {
- if (xftrenderer->priv->trapezoids->len > 0 &&
- xftrenderer->priv->trapezoid_part != part)
- flush_trapezoids (xftrenderer);
-
- xftrenderer->priv->trapezoid_part = part;
- }
-
- trap.top = XDoubleToFixed (y1);
- trap.bottom = XDoubleToFixed (y2);
- trap.left.p1.x = XDoubleToFixed (x11);
- trap.left.p1.y = XDoubleToFixed (y1);
- trap.left.p2.x = XDoubleToFixed (x12);
- trap.left.p2.y = XDoubleToFixed (y2);
- trap.right.p1.x = XDoubleToFixed (x21);
- trap.right.p1.y = XDoubleToFixed (y1);
- trap.right.p2.x = XDoubleToFixed (x22);
- trap.right.p2.y = XDoubleToFixed (y2);
-
- g_array_append_val (xftrenderer->priv->trapezoids, trap);
-}
-
-static void
-pango_xft_renderer_part_changed (PangoRenderer *renderer,
- PangoRenderPart part)
-{
- PangoXftRenderer *xftrenderer = PANGO_XFT_RENDERER (renderer);
-
- if (part == PANGO_RENDER_PART_FOREGROUND)
- flush_glyphs (xftrenderer);
-
- if (part == xftrenderer->priv->trapezoid_part)
- flush_trapezoids (xftrenderer);
-}
-
-static void
-pango_xft_renderer_end (PangoRenderer *renderer)
-{
- PangoXftRenderer *xftrenderer = PANGO_XFT_RENDERER (renderer);
-
- flush_glyphs (xftrenderer);
- flush_trapezoids (xftrenderer);
-}
-
-static void
-pango_xft_renderer_real_composite_trapezoids (PangoXftRenderer *xftrenderer,
- PangoRenderPart part,
- XTrapezoid *trapezoids,
- int n_trapezoids)
-{
- Picture src_picture;
- Picture dest_picture;
-
- if (!XftDefaultHasRender (xftrenderer->display))
- return;
-
- if (xftrenderer->priv->src_picture != None)
- {
- src_picture = xftrenderer->priv->src_picture;
- dest_picture = xftrenderer->priv->dest_picture;
- }
- else
- {
- XftColor xft_color;
- PangoColor *color = pango_renderer_get_color (PANGO_RENDERER (xftrenderer),
- part);
- if (!color)
- color = &xftrenderer->priv->default_color;
-
- xft_color.color.red = color->red;
- xft_color.color.green = color->green;
- xft_color.color.blue = color->blue;
- xft_color.color.alpha = xftrenderer->priv->alpha;
-
- src_picture = XftDrawSrcPicture (xftrenderer->draw, &xft_color);
- dest_picture = XftDrawPicture (xftrenderer->draw);
- }
-
- XRenderCompositeTrapezoids (xftrenderer->display,
- PictOpOver,
- src_picture, dest_picture,
- xftrenderer->priv->mask_format,
- 0, 0,
- trapezoids, n_trapezoids);
-}
-
-static void
-pango_xft_renderer_real_composite_glyphs (PangoXftRenderer *xftrenderer,
- XftFont *xft_font,
- XftGlyphSpec *glyphs,
- int n_glyphs)
-{
- if (xftrenderer->priv->src_picture != None)
- {
- XftGlyphSpecRender (xftrenderer->display, PictOpOver,
- xftrenderer->priv->src_picture,
- xft_font,
- xftrenderer->priv->dest_picture, 0, 0,
- glyphs, n_glyphs);
- }
- else
- {
- XftColor xft_color;
- PangoColor *color = pango_renderer_get_color (PANGO_RENDERER (xftrenderer),
- PANGO_RENDER_PART_FOREGROUND);
- if (!color)
- color = &xftrenderer->priv->default_color;
-
- xft_color.color.red = color->red;
- xft_color.color.green = color->green;
- xft_color.color.blue = color->blue;
- xft_color.color.alpha = xftrenderer->priv->alpha;
-
- XftDrawGlyphSpec (xftrenderer->draw, &xft_color,
- xft_font,
- glyphs, n_glyphs);
- }
-}
-
-static PangoRenderer *
-get_renderer (PangoFontMap *fontmap,
- XftDraw *draw,
- XftColor *color)
-{
- PangoRenderer *renderer;
- PangoXftRenderer *xftrenderer;
- PangoColor pango_color;
-
- renderer = _pango_xft_font_map_get_renderer (PANGO_XFT_FONT_MAP (fontmap));
- xftrenderer = PANGO_XFT_RENDERER (renderer);
-
- pango_xft_renderer_set_draw (xftrenderer, draw);
-
- pango_color.red = color->color.red;
- pango_color.green = color->color.green;
- pango_color.blue = color->color.blue;
- pango_xft_renderer_set_default_color (xftrenderer, &pango_color);
- xftrenderer->priv->alpha = color->color.alpha;
-
- return renderer;
-}
-
-static void
-release_renderer (PangoRenderer *renderer)
-{
- PangoXftRenderer *xftrenderer = PANGO_XFT_RENDERER (renderer);
-
- xftrenderer->priv->alpha = 0xffff;
-}
-
-/**
- * pango_xft_render_layout:
- * @draw: an XftDraw
- * @color: the foreground color in which to draw the layout
- * (may be overridden by color attributes)
- * @layout: a `PangoLayout`
- * @x: the X position of the left of the layout (in Pango units)
- * @y: the Y position of the top of the layout (in Pango units)
- *
- * Render a `PangoLayout` onto a XftDraw
- *
- * Since: 1.8
- */
-void
-pango_xft_render_layout (XftDraw *draw,
- XftColor *color,
- PangoLayout *layout,
- int x,
- int y)
-{
- PangoContext *context;
- PangoFontMap *fontmap;
- PangoRenderer *renderer;
-
- g_return_if_fail (draw != NULL);
- g_return_if_fail (color != NULL);
- g_return_if_fail (PANGO_IS_LAYOUT (layout));
-
- context = pango_layout_get_context (layout);
- fontmap = pango_context_get_font_map (context);
- renderer = get_renderer (fontmap, draw, color);
-
- pango_renderer_draw_layout (renderer, layout, x, y);
-
- release_renderer (renderer);
-}
-
-/**
- * pango_xft_render_layout_line:
- * @draw: an XftDraw
- * @color: the foreground color in which to draw the layout line
- * (may be overridden by color attributes)
- * @line: a `PangoLayoutLine`
- * @x: the x position of start of string (in Pango units)
- * @y: the y position of baseline (in Pango units)
- *
- * Render a `PangoLayoutLine` onto a XftDraw
- *
- * Since: 1.8
- */
-void
-pango_xft_render_layout_line (XftDraw *draw,
- XftColor *color,
- PangoLayoutLine *line,
- int x,
- int y)
-{
- PangoContext *context;
- PangoFontMap *fontmap;
- PangoRenderer *renderer;
-
- g_return_if_fail (draw != NULL);
- g_return_if_fail (color != NULL);
- g_return_if_fail (line != NULL);
-
- context = pango_layout_get_context (line->layout);
- fontmap = pango_context_get_font_map (context);
- renderer = get_renderer (fontmap, draw, color);
-
- pango_renderer_draw_layout_line (renderer, line, x, y);
-
- release_renderer (renderer);
-}
-
-/**
- * pango_xft_render_transformed:
- * @draw: an XftDraw
- * @color: the color in which to draw the glyphs
- * @font: the font in which to draw the string
- * @matrix: (nullable): a `PangoMatrix`
- * @glyphs: the glyph string to draw
- * @x: the x position of the start of the string (in Pango
- * units in user space coordinates)
- * @y: the y position of the baseline (in Pango units
- * in user space coordinates)
- *
- * Renders a `PangoGlyphString` onto a XftDraw, possibly
- * transforming the layed-out coordinates through a transformation
- * matrix.
- *
- * Note that the transformation matrix for @font is not
- * changed, so to produce correct rendering results, the @font
- * must have been loaded using a `PangoContext` with an identical
- * transformation matrix to that passed in to this function.
- *
- * Since: 1.8
- **/
-void
-pango_xft_render_transformed (XftDraw *draw,
- XftColor *color,
- PangoMatrix *matrix,
- PangoFont *font,
- PangoGlyphString *glyphs,
- int x,
- int y)
-{
- PangoFontMap *fontmap;
- PangoRenderer *renderer;
-
- g_return_if_fail (draw != NULL);
- g_return_if_fail (color != NULL);
- g_return_if_fail (PANGO_XFT_IS_FONT (font));
- g_return_if_fail (glyphs != NULL);
-
- fontmap = PANGO_FC_FONT (font)->fontmap;
- renderer = get_renderer (fontmap, draw, color);
-
- pango_renderer_set_matrix (renderer, matrix);
-
- pango_renderer_draw_glyphs (renderer, font, glyphs, x, y);
-
- release_renderer (renderer);
-}
-
-/**
- * pango_xft_render:
- * @draw: the XftDraw object.
- * @color: the color in which to draw the string
- * @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 XftDraw object wrapping an X drawable.
- */
-void
-pango_xft_render (XftDraw *draw,
- XftColor *color,
- PangoFont *font,
- PangoGlyphString *glyphs,
- gint x,
- gint y)
-{
- g_return_if_fail (draw != NULL);
- g_return_if_fail (color != NULL);
- g_return_if_fail (PANGO_XFT_IS_FONT (font));
- g_return_if_fail (glyphs != NULL);
-
- pango_xft_render_transformed (draw, color, NULL, font, glyphs,
- x * PANGO_SCALE, y * PANGO_SCALE);
-}
-
-/**
- * pango_xft_picture_render:
- * @display: an X display
- * @src_picture: the source picture to draw the string with
- * @dest_picture: the destination picture to draw the string onto
- * @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 Xrender Picture object.
- */
-void
-pango_xft_picture_render (Display *display,
- Picture src_picture,
- Picture dest_picture,
- PangoFont *font,
- PangoGlyphString *glyphs,
- gint x,
- gint y)
-{
- PangoFontMap *fontmap;
- PangoRenderer *renderer;
-
- g_return_if_fail (display != NULL);
- g_return_if_fail (src_picture != None);
- g_return_if_fail (dest_picture != None);
- g_return_if_fail (PANGO_XFT_IS_FONT (font));
- g_return_if_fail (glyphs != NULL);
-
- fontmap = PANGO_FC_FONT (font)->fontmap;
- renderer = _pango_xft_font_map_get_renderer (PANGO_XFT_FONT_MAP (fontmap));
-
- pango_xft_renderer_set_pictures (PANGO_XFT_RENDERER (renderer),
- src_picture, dest_picture);
- pango_renderer_set_matrix (renderer, NULL);
-
- pango_renderer_draw_glyphs (renderer, font, glyphs, x * PANGO_SCALE, y * PANGO_SCALE);
-
- pango_xft_renderer_set_pictures (PANGO_XFT_RENDERER (renderer),
- None, None);
-}
-
-/**
- * pango_xft_renderer_new:
- * @display: an X display
- * @screen: the index of the screen for @display to which rendering will be done
- *
- * Create a new `PangoXftRenderer` to allow rendering Pango objects
- * with the Xft library.
- *
- * You must call pango_xft_renderer_set_draw() before
- * using the renderer.
- *
- * Return value: the newly created `PangoXftRenderer`
- *
- * Since: 1.8
- */
-PangoRenderer *
-pango_xft_renderer_new (Display *display,
- int screen)
-{
- PangoXftRenderer *xftrenderer;
-
- xftrenderer = g_object_new (PANGO_TYPE_XFT_RENDERER,
- "display", display,
- "screen", screen,
- NULL);
-
- return PANGO_RENDERER (xftrenderer);
-}
-
-/**
- * pango_xft_renderer_set_draw:
- * @xftrenderer: a `PangoXftRenderer`
- * @draw: a XftDraw
- *
- * Sets the XftDraw object that the renderer is drawing to.
- * The renderer must not be currently active.
- *
- * Since: 1.8
- */
-void
-pango_xft_renderer_set_draw (PangoXftRenderer *xftrenderer,
- XftDraw *draw)
-{
- g_return_if_fail (PANGO_IS_XFT_RENDERER (xftrenderer));
-
- xftrenderer->draw = draw;
-}
-
-/**
- * pango_xft_renderer_set_default_color:
- * @xftrenderer: a XftRenderer
- * @default_color: the default foreground color
- *
- * Sets the default foreground color for a XftRenderer.
- *
- * Since: 1.8
- */
-void
-pango_xft_renderer_set_default_color (PangoXftRenderer *xftrenderer,
- PangoColor *default_color)
-{
- g_return_if_fail (PANGO_IS_XFT_RENDERER (xftrenderer));
-
- xftrenderer->priv->default_color = *default_color;
-}
diff --git a/pango/pangoxft-render.h b/pango/pangoxft-render.h
deleted file mode 100644
index bf4b33e9..00000000
--- a/pango/pangoxft-render.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/* Pango
- * pangoxft-render.h: Rendering routines for the Xft library
- *
- * Copyright (C) 2004 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 __PANGOXFT_RENDER_H__
-#define __PANGOXFT_RENDER_H__
-
-#include <pango/pango-renderer.h>
-
-G_BEGIN_DECLS
-
-#define _XFT_NO_COMPAT_
-#include <X11/Xlib.h>
-#include <X11/Xft/Xft.h>
-#if defined(XftVersion) && XftVersion >= 20000
-#else
-#error "must have Xft version 2 or newer"
-#endif
-
-typedef struct _PangoXftRenderer PangoXftRenderer;
-typedef struct _PangoXftRendererClass PangoXftRendererClass;
-typedef struct _PangoXftRendererPrivate PangoXftRendererPrivate;
-
-#ifdef __GI_SCANNER__
-#define PANGO_XFT_TYPE_RENDERER (pango_xft_renderer_get_type())
-#define PANGO_XFT_RENDERER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_XFT_TYPE_RENDERER, PangoXftRenderer))
-#define PANGO_XFT_IS_RENDERER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_XFT_TYPE_RENDERER))
-#define PANGO_XFT_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_XFT_TYPE_RENDERER, PangoXftRendererClass))
-#define PANGO_XFT_IS_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_XFT_TYPE_RENDERER))
-#define PANGO_XFT_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_XFT_TYPE_RENDERER, PangoXftRendererClass))
-#else
-#define PANGO_TYPE_XFT_RENDERER (pango_xft_renderer_get_type())
-#define PANGO_XFT_RENDERER(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_XFT_RENDERER, PangoXftRenderer))
-#define PANGO_IS_XFT_RENDERER(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_XFT_RENDERER))
-#define PANGO_XFT_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_XFT_RENDERER, PangoXftRendererClass))
-#define PANGO_IS_XFT_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_XFT_RENDERER))
-#define PANGO_XFT_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_XFT_RENDERER, PangoXftRendererClass))
-#endif
-
-/**
- * PangoXftRenderer:
- *
- * `PangoXftRenderer` is a subclass of `PangoRenderer` used for rendering
- * with Pango's Xft backend. It can be used directly, or it can be
- * further subclassed to modify exactly how drawing of individual
- * elements occurs.
- *
- * Since: 1.8
- */
-struct _PangoXftRenderer
-{
- /*< private >*/
- PangoRenderer parent_instance;
-
- Display *display;
- int screen;
- XftDraw *draw;
-
- PangoXftRendererPrivate *priv;
-};
-
-/**
- * PangoXftRendererClass:
- * @composite_trapezoids: draw the specified trapezoids using
- * the current color and other attributes for @part
- * @composite_glyphs: draw the specified glyphs using
- * the current foreground color and other foreground
- * attributes
- *
- * The class structure for `PangoXftRenderer`
- *
- * Since: 1.8
- */
-struct _PangoXftRendererClass
-{
- /*< private >*/
- PangoRendererClass parent_class;
-
- /*< public >*/
- void (*composite_trapezoids) (PangoXftRenderer *xftrenderer,
- PangoRenderPart part,
- XTrapezoid *trapezoids,
- int n_trapezoids);
- void (*composite_glyphs) (PangoXftRenderer *xftrenderer,
- XftFont *xft_font,
- XftGlyphSpec *glyphs,
- int n_glyphs);
-};
-
-PANGO_AVAILABLE_IN_1_8
-GType pango_xft_renderer_get_type (void) G_GNUC_CONST;
-
-PANGO_AVAILABLE_IN_1_8
-PangoRenderer *pango_xft_renderer_new (Display *display,
- int screen);
-PANGO_AVAILABLE_IN_1_8
-void pango_xft_renderer_set_draw (PangoXftRenderer *xftrenderer,
- XftDraw *draw);
-PANGO_AVAILABLE_IN_1_8
-void pango_xft_renderer_set_default_color (PangoXftRenderer *xftrenderer,
- PangoColor *default_color);
-
-PANGO_AVAILABLE_IN_ALL
-void pango_xft_render (XftDraw *draw,
- XftColor *color,
- PangoFont *font,
- PangoGlyphString *glyphs,
- gint x,
- gint y);
-PANGO_AVAILABLE_IN_ALL
-void pango_xft_picture_render (Display *display,
- Picture src_picture,
- Picture dest_picture,
- PangoFont *font,
- PangoGlyphString *glyphs,
- gint x,
- gint y);
-PANGO_AVAILABLE_IN_1_8
-void pango_xft_render_transformed (XftDraw *draw,
- XftColor *color,
- PangoMatrix *matrix,
- PangoFont *font,
- PangoGlyphString *glyphs,
- int x,
- int y);
-PANGO_AVAILABLE_IN_1_8
-void pango_xft_render_layout_line (XftDraw *draw,
- XftColor *color,
- PangoLayoutLine *line,
- int x,
- int y);
-PANGO_AVAILABLE_IN_1_8
-void pango_xft_render_layout (XftDraw *draw,
- XftColor *color,
- PangoLayout *layout,
- int x,
- int y);
-
-G_END_DECLS
-
-#endif /* __PANGOXFT_RENDER_H__ */
-
diff --git a/pango/pangoxft.h b/pango/pangoxft.h
deleted file mode 100644
index bf17507b..00000000
--- a/pango/pangoxft.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* Pango
- * pangoxft.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 __PANGOXFT_H__
-#define __PANGOXFT_H__
-
-#include <pango/pangofc-fontmap.h>
-#include <pango/pango-context.h>
-#include <pango/pangofc-font.h>
-#include <pango/pango-layout.h>
-#include <pango/pangoxft-render.h>
-
-G_BEGIN_DECLS
-
-/**
- * PangoXftFontMap:
- *
- * `PangoXftFontMap` is an implementation of `PangoFcFontMap` suitable for
- * the Xft library as the renderer. It is used in to create fonts of
- * type `PangoXftFont`.
- */
-
-/* This is a hack needed because PangoXft hijacks the Pango namespace
- * for the identifiers, but consumers expect these symbols to be under
- * the PangoXft namespace.
- */
-#ifdef __GI_SCANNER__
-#define PANGO_XFT_TYPE_FONT_MAP (pango_xft_font_map_get_type())
-#define PANGO_XFT_FONT_MAP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PANGO_XFT_TYPE_FONT_MAP, PangoXftFontMap))
-#define PANGO_XFT_IS_FONT_MAP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PANGO_XFT_TYPE_FONT_MAP))
-#else
-#define PANGO_TYPE_XFT_FONT_MAP (pango_xft_font_map_get_type ())
-#define PANGO_XFT_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_XFT_FONT_MAP, PangoXftFontMap))
-#define PANGO_XFT_IS_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_XFT_FONT_MAP))
-#endif
-
-typedef struct _PangoXftFontMap PangoXftFontMap;
-
-/**
- * PangoXftFont:
- *
- * `PangoXftFont` is an implementation of `PangoFcFont` using the Xft
- * library for rendering. It is used in conjunction with `PangoXftFontMap`.
- */
-typedef struct _PangoXftFont PangoXftFont;
-
-/**
- * PangoXftSubstituteFunc:
- * @pattern: the FcPattern to tweak.
- * @data: user data.
- *
- * Function type for doing final config tweaking on prepared FcPatterns.
- */
-typedef void (*PangoXftSubstituteFunc) (FcPattern *pattern,
- gpointer data);
-
-/* Calls for applications
- */
-PANGO_AVAILABLE_IN_1_2
-PangoFontMap *pango_xft_get_font_map (Display *display,
- int screen);
-PANGO_AVAILABLE_IN_1_2
-void pango_xft_shutdown_display (Display *display,
- int screen);
-
-PANGO_AVAILABLE_IN_ALL
-GType pango_xft_font_map_get_type (void) G_GNUC_CONST;
-
-#define PANGO_XFT_TYPE_FONT (pango_xft_font_get_type ())
-#define PANGO_XFT_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_XFT_TYPE_FONT, PangoXftFont))
-#define PANGO_XFT_IS_FONT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_XFT_TYPE_FONT))
-
-PANGO_AVAILABLE_IN_ALL
-GType pango_xft_font_get_type (void) G_GNUC_CONST;
-
-G_END_DECLS
-
-#endif /* __PANGOXFT_H__ */
diff --git a/pango/pangoxft.rc.in b/pango/pangoxft.rc.in
deleted file mode 100644
index 1f39685b..00000000
--- a/pango/pangoxft.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", "Pangoxft"
- VALUE "FileVersion", "@PANGO_VERSION_MAJOR@.@PANGO_VERSION_MINOR@.@PANGO_VERSION_MICRO@.0"
- VALUE "InternalName", "pangoxft-@PANGO_API_VERSION@-@PANGO_CURRENT_MINUS_AGE@"
- VALUE "LegalCopyright", "Copyright © 1999 Red Hat Software."
- VALUE "OriginalFilename", "pangoxft-@PANGO_API_VERSION@-@PANGO_CURRENT_MINUS_AGE@.dll"
- VALUE "ProductName", "Pangoxft"
- 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/tests/meson.build b/tests/meson.build
index de054f79..67d6e550 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -2,10 +2,6 @@ test_cflags = [
'-DSRCDIR=@0@'.format(meson.current_source_dir()),
]
-if xft_dep.found()
- test_cflags += [ '-DHAVE_X', '-DHAVE_XFT' ]
-endif
-
if host_system == 'windows'
test_cflags += '-DHAVE_WIN32'
elif host_system == 'darwin'
diff --git a/utils/meson.build b/utils/meson.build
index 5072c1cc..4a16df24 100644
--- a/utils/meson.build
+++ b/utils/meson.build
@@ -14,12 +14,17 @@ if build_pangoft2
pango_view_deps += libpangoft2_dep
endif
-if xft_dep.found() and build_pangoft2
+extra_cflags = [
+ '-DPACKAGE_NAME="@0@"'.format(meson.project_name()),
+ '-DPACKAGE_VERSION="@0@"'.format(meson.project_version())
+]
+
+if build_pangoft2 and x11_dep.found()
pango_view_sources += [
- 'viewer-pangoxft.c',
'viewer-x.c',
]
- pango_view_deps += [ libpangoft2_dep, libpangoxft_dep, ]
+ pango_view_deps += [ libpangoft2_dep, x11_dep ]
+ extra_cflags += [ '-DHAVE_X' ]
endif
if cairo_dep.found()
@@ -34,10 +39,7 @@ pango_view = executable('pango-view', pango_view_sources,
dependencies: pango_view_deps,
include_directories: [ root_inc ],
install: true,
- c_args: common_cflags + pango_debug_cflags + [
- '-DPACKAGE_NAME="@0@"'.format(meson.project_name()),
- '-DPACKAGE_VERSION="@0@"'.format(meson.project_version()),
- ])
+ c_args: extra_cflags)
help2man = find_program('help2man', required: false)
# help2man has to run pango-view to generate the man page, which it can't do if
diff --git a/utils/pango-view.c b/utils/pango-view.c
index fec00be9..dbfb31ca 100644
--- a/utils/pango-view.c
+++ b/utils/pango-view.c
@@ -2,7 +2,6 @@
#include "viewer.h"
extern const PangoViewer pangocairo_viewer;
-extern const PangoViewer pangoxft_viewer;
extern const PangoViewer pangoft2_viewer;
extern const PangoViewer pangox_viewer;
@@ -10,9 +9,6 @@ const PangoViewer *viewers[] = {
#ifdef HAVE_CAIRO
&pangocairo_viewer,
#endif
-#ifdef HAVE_XFT
- &pangoxft_viewer,
-#endif
#ifdef HAVE_FREETYPE
&pangoft2_viewer,
#endif
diff --git a/utils/viewer-cairo.c b/utils/viewer-cairo.c
index ca98c1cd..af4763fa 100644
--- a/utils/viewer-cairo.c
+++ b/utils/viewer-cairo.c
@@ -30,7 +30,7 @@
#ifdef HAVE_CAIRO_XLIB
-#ifdef HAVE_XFT
+#ifdef HAVE_X
#include "viewer-x.h"
#include <cairo-xlib.h>
@@ -67,11 +67,11 @@ cairo_x_view_iface_paint_background (gpointer instance G_GNUC_UNUSED,
}
static CairoViewerIface cairo_x_viewer_iface = {
- &x_viewer,
+ &pangox_viewer,
cairo_x_view_iface_create_surface,
cairo_x_view_iface_paint_background
};
-#endif /* HAVE_XFT */
+#endif /* HAVE_X */
#endif /* HAVE_CAIRO_XLIB */
@@ -348,13 +348,13 @@ cairo_viewer_iface_create (const CairoViewerIface **iface)
return ret;
#ifdef HAVE_CAIRO_XLIB
-#ifdef HAVE_XFT
+#ifdef HAVE_X
if (opt_display)
{
*iface = &cairo_x_viewer_iface;
return (*iface)->backend_class->create ((*iface)->backend_class);
}
-#endif /* HAVE_XFT */
+#endif /* HAVE_X */
#endif /* HAVE_CAIRO_XLIB */
*iface = &cairo_image_viewer_iface;
diff --git a/utils/viewer-x.c b/utils/viewer-x.c
index 02c688ea..0bc9286c 100644
--- a/utils/viewer-x.c
+++ b/utils/viewer-x.c
@@ -219,9 +219,9 @@ x_view_display (gpointer instance,
}
}
-const PangoViewer x_viewer = {
+const PangoViewer pangox_viewer = {
"X",
- NULL,
+ "x",
NULL,
x_view_create,
x_view_destroy,
diff --git a/utils/viewer-x.h b/utils/viewer-x.h
index 28f61f6b..5611f20c 100644
--- a/utils/viewer-x.h
+++ b/utils/viewer-x.h
@@ -36,7 +36,7 @@ typedef struct
} XViewer;
-extern const PangoViewer x_viewer;
+extern const PangoViewer pangox_viewer;
void x_view_init (gpointer instance,
const PangoViewer *klass);