summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2012-08-16 21:58:44 -0400
committerBehdad Esfahbod <behdad@behdad.org>2012-08-16 22:02:45 -0400
commit7c6c11cd8392d483f0de7bba434faccdb9c068fa (patch)
treef48f5013a5da1a3c106110ac6ec5e2de715c3769
parent194b6ee552318ec6c494f34ed9f0979d0460fe4f (diff)
downloadpango-7c6c11cd8392d483f0de7bba434faccdb9c068fa.tar.gz
Remove Atsui Module
CoreText for the win.
-rw-r--r--configure.in56
-rw-r--r--docs/pango-sections.txt27
-rw-r--r--modules/basic/Makefile.am17
-rw-r--r--modules/basic/basic-atsui.c211
-rw-r--r--pango/Makefile.am25
-rw-r--r--pango/pangoatsui-fontmap.c825
-rw-r--r--pango/pangoatsui-private.h105
-rw-r--r--pango/pangoatsui.c231
-rw-r--r--pango/pangoatsui.h80
9 files changed, 8 insertions, 1569 deletions
diff --git a/configure.in b/configure.in
index 90ed3c46..9e26921c 100644
--- a/configure.in
+++ b/configure.in
@@ -317,11 +317,6 @@ if test "$pango_os_win32" = "yes"; then
fi
#
-# Checks for ATSUI
-#
-AC_CHECK_HEADER(Carbon/Carbon.h, [have_atsui=true], [have_atsui=false])
-
-#
# Checks for CoreText
#
@@ -350,7 +345,7 @@ have_cairo_pdf=false
have_cairo_xlib=false
have_cairo_freetype=false
have_cairo_win32=false
-have_cairo_atsui=false
+have_cairo_quartz=false
cairo_required=1.7.6
PKG_CHECK_MODULES(CAIRO, cairo >= $cairo_required, have_cairo=true, AC_MSG_RESULT([no]))
@@ -382,11 +377,11 @@ if $have_cairo ; then
have_cairo=true
fi
- if test $have_atsui -o $have_core_text; then
- PKG_CHECK_EXISTS(cairo-quartz-font >= $cairo_required, have_cairo_atsui=true, :)
+ if test $have_core_text; then
+ PKG_CHECK_EXISTS(cairo-quartz-font >= $cairo_required, have_cairo_quartz=true, :)
fi
- if $have_cairo_atsui; then
- AC_DEFINE(HAVE_CAIRO_ATSUI, 1, [Whether Cairo can use ATSUI for fonts])
+ if $have_cairo_quartz; then
+ AC_DEFINE(HAVE_CAIRO_QUARTZ, 1, [Whether Cairo can use Quartz for fonts])
cairo_font_backends="quartz $cairo_font_backends"
have_cairo=true
fi
@@ -434,7 +429,7 @@ AM_CONDITIONAL(HAVE_CAIRO_PDF, $have_cairo_pdf)
AM_CONDITIONAL(HAVE_CAIRO_XLIB, $have_cairo_xlib)
AM_CONDITIONAL(HAVE_CAIRO_WIN32, $have_cairo_win32)
AM_CONDITIONAL(HAVE_CAIRO_FREETYPE, $have_cairo_freetype)
-AM_CONDITIONAL(HAVE_CAIRO_ATSUI, $have_cairo_atsui)
+AM_CONDITIONAL(HAVE_CAIRO_QUARTZ, $have_cairo_quartz)
harfbuzz_required=0.9
@@ -489,7 +484,7 @@ GOBJECT_INTROSPECTION_CHECK([0.9.5])
# Modules to build
#
arabic_modules="arabic-lang"
-basic_modules="basic-fc,basic-win32,basic-x,basic-atsui,basic-coretext"
+basic_modules="basic-fc,basic-win32,basic-x,basic-coretext"
indic_modules="indic-lang"
thai_modules=""
@@ -536,17 +531,13 @@ AC_MSG_RESULT([$dynamic_modules (those built into Pango will be excluded)])
AM_CONDITIONAL(HAVE_DYNAMIC_MODULES, test "x$dynamic_modules" != x)
-INCLUDED_X_MODULES=
INCLUDED_FC_MODULES=
INCLUDED_WIN32_MODULES=
-INCLUDED_ATSUI_MODULES=
INCLUDED_CORE_TEXT_MODULES=
INCLUDED_LANG_MODULES=
-AC_SUBST(INCLUDED_X_MODULES)
AC_SUBST(INCLUDED_FC_MODULES)
AC_SUBST(INCLUDED_WIN32_MODULES)
-AC_SUBST(INCLUDED_ATSUI_MODULES)
AC_SUBST(INCLUDED_CORE_TEXT_MODULES)
AC_SUBST(INCLUDED_LANG_MODULES)
@@ -556,10 +547,8 @@ for module in $included_modules; do
included_path="\$(top_builddir)/modules/$dir/libpango-$module.la"
case $module in
- *-x) INCLUDED_X_MODULES="$INCLUDED_X_MODULES $included_path" ;;
*-fc) INCLUDED_FC_MODULES="$INCLUDED_FC_MODULES $included_path" ;;
*-win32) INCLUDED_WIN32_MODULES="$INCLUDED_WIN32_MODULES $included_path" ;;
- *-atsui) INCLUDED_ATSUI_MODULES="$INCLUDED_ATSUI_MODULES $included_path" ;;
*-coretext) INCLUDED_CORE_TEXT_MODULES="$INCLUDED_CORE_TEXT_MODULES $included_path" ;;
*-lang) INCLUDED_LANG_MODULES="$INCLUDED_LANG_MODULES $included_path" ;;
*) IFS="$pango_save_ifs"; AC_MSG_ERROR([specified module $module not recognized]) ;;
@@ -571,7 +560,6 @@ AM_CONDITIONAL(INCLUDE_ARABIC_LANG, echo $included_modules | egrep '(^|,)arabic-
AM_CONDITIONAL(INCLUDE_BASIC_FC, echo $included_modules | egrep '(^|,)basic-fc($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_BASIC_WIN32, echo $included_modules | egrep '(^|,)basic-win32($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_BASIC_X, echo $included_modules | egrep '(^|,)basic-x($|,)' > /dev/null)
-AM_CONDITIONAL(INCLUDE_BASIC_ATSUI, echo $included_modules | egrep '(^|,)basic-atsui($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_BASIC_CORE_TEXT, echo $included_modules | egrep '(^|,)basic-coretext($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_INDIC_LANG, echo $included_modules | egrep '(^|,)indic-lang($|,)' > /dev/null)
AM_CONDITIONAL(INCLUDE_THAI_LANG, echo $included_modules | egrep '(^|,)thai-lang($|,)' > /dev/null)
@@ -580,7 +568,6 @@ AM_CONDITIONAL(DYNAMIC_ARABIC_LANG, echo $dynamic_modules | egrep '(^|,)arabic-l
AM_CONDITIONAL(DYNAMIC_BASIC_FC, echo $dynamic_modules | egrep '(^|,)basic-fc($|,)' > /dev/null)
AM_CONDITIONAL(DYNAMIC_BASIC_WIN32, echo $dynamic_modules | egrep '(^|,)basic-win32($|,)' > /dev/null)
AM_CONDITIONAL(DYNAMIC_BASIC_X, echo $dynamic_modules | egrep '(^|,)basic-x($|,)' > /dev/null)
-AM_CONDITIONAL(DYNAMIC_BASIC_ATSUI, echo $dynamic_modules | egrep '(^|,)basic-atsui($|,)' > /dev/null)
AM_CONDITIONAL(DYNAMIC_BASIC_CORE_TEXT, echo $dynamic_modules | egrep '(^|,)basic-coretext($|,)' > /dev/null)
AM_CONDITIONAL(DYNAMIC_INDIC_LANG, echo $dynamic_modules | egrep '(^|,)indic-lang($|,)' > /dev/null)
AM_CONDITIONAL(DYNAMIC_THAI_LANG, echo $dynamic_modules | egrep '(^|,)thai-lang($|,)' > /dev/null)
@@ -840,35 +827,6 @@ cat >> pango/module-defs-win32.c <<EOTEXT
EOTEXT
])
-AC_CONFIG_COMMANDS([pango/module-defs-atsui.c],
-[
-### ATSUI modules
-cat > pango/module-defs-atsui.c <<EOTEXT
-/* Autogenerated by configure. Do not edit */
-
-#include "module-defs.h"
-
-PangoIncludedModule _pango_included_atsui_modules@<:@@:>@ = {
-EOTEXT
-
-IFS="${IFS= }"; pango_save_ifs="$IFS"; IFS=","
-for module in $included_modules; do
- if echo $module | egrep -- "-atsui($|,)" > /dev/null; then
- module_c=`echo $module | sed s/-/_/`
- cat >> pango/module-defs-atsui.c <<EOTEXT
- { _pango_${module_c}_script_engine_list, _pango_${module_c}_script_engine_init, _pango_${module_c}_script_engine_exit, _pango_${module_c}_script_engine_create },
-EOTEXT
- fi
-done
-
-IFS="$pango_save_ifs"
-
-cat >> pango/module-defs-atsui.c <<EOTEXT
- { NULL, NULL, NULL, NULL },
-};
-EOTEXT
-])
-
AC_CONFIG_COMMANDS([pango/module-defs-coretext.c],
[
### CoreText modules
diff --git a/docs/pango-sections.txt b/docs/pango-sections.txt
index 51b69bcb..bb08992c 100644
--- a/docs/pango-sections.txt
+++ b/docs/pango-sections.txt
@@ -855,33 +855,6 @@ pango_cairo_font_map_get_type
</SECTION>
<SECTION>
-<TITLE>ATSUI Fonts</TITLE>
-<FILE>atsui-fonts</FILE>
-PANGO_RENDER_TYPE_ATSUI
-pango_atsui_font_get_cgfont
-pango_atsui_font_get_atsfont
-<SUBSECTION Standard>
-PANGO_ATSUI_FONT
-PANGO_ATSUI_FONT_CLASS
-PANGO_ATSUI_FONT_GET_CLASS
-PANGO_CAIRO_ATSUI_FONT
-PANGO_CAIRO_ATSUI_FONT_CLASS
-PANGO_CAIRO_ATSUI_FONT_GET_CLASS
-PANGO_IS_ATSUI_FONT
-PANGO_IS_ATSUI_FONT_CLASS
-PANGO_IS_CAIRO_ATSUI_FONT_CLASS
-PANGO_TYPE_ATSUI_FONT
-PANGO_TYPE_CAIRO_ATSUI_FONT
-PangoATSUIFont
-PangoATSUIFontClass
-PangoATSUIFontPrivate
-PangoCairoATSUIFont
-PangoCairoATSUIFontClass
-pango_atsui_font_get_type
-pango_cairo_atsui_font_get_type
-</SECTION>
-
-<SECTION>
<TITLE>CoreText Fonts</TITLE>
<FILE>coretext-fonts</FILE>
PANGO_RENDER_TYPE_CORE_TEXT
diff --git a/modules/basic/Makefile.am b/modules/basic/Makefile.am
index 306b9ec4..15908558 100644
--- a/modules/basic/Makefile.am
+++ b/modules/basic/Makefile.am
@@ -35,7 +35,6 @@ pango_basic_win32_la_SOURCES = basic-win32.c
libpango_basic_win32_la_SOURCES = basic-win32.c
libpango_basic_win32_la_CFLAGS = -DPANGO_MODULE_PREFIX=_pango_basic_win32
-if HAVE_CAIRO_ATSUI
if HAVE_CORE_TEXT
INCLUDES += $(CAIRO_CFLAGS)
if INCLUDE_BASIC_CORE_TEXT
@@ -45,16 +44,6 @@ if DYNAMIC_BASIC_CORE_TEXT
module_LTLIBRARIES += pango-basic-coretext.la
endif
endif
-else
-INCLUDES += $(ATSUI_CFLAGS) $(CAIRO_CFLAGS)
-if INCLUDE_BASIC_ATSUI
-noinst_LTLIBRARIES += libpango-basic-atsui.la
-else
-if DYNAMIC_BASIC_ATSUI
-module_LTLIBRARIES += pango-basic-atsui.la
-endif
-endif
-endif
endif
pango_basic_coretext_la_LDFLAGS = -module $(MODULE_LIBTOOL_OPTIONS) -framework Carbon
@@ -63,12 +52,6 @@ pango_basic_coretext_la_SOURCES = basic-coretext.c
libpango_basic_coretext_la_SOURCES = basic-coretext.c
libpango_basic_coretext_la_CFLAGS = -DPANGO_MODULE_PREFIX=_pango_basic_coretext
-pango_basic_atsui_la_LDFLAGS = -module $(MODULE_LIBTOOL_OPTIONS) -framework Carbon
-pango_basic_atsui_la_LIBADD = $(pangoatsuilibs)
-pango_basic_atsui_la_SOURCES = basic-atsui.c
-libpango_basic_atsui_la_SOURCES = basic-atsui.c
-libpango_basic_atsui_la_CFLAGS = -DPANGO_MODULE_PREFIX=_pango_basic_atsui
-
EXTRA_DIST = \
tables-big.i \
tables-small.i
diff --git a/modules/basic/basic-atsui.c b/modules/basic/basic-atsui.c
deleted file mode 100644
index 369a596a..00000000
--- a/modules/basic/basic-atsui.c
+++ /dev/null
@@ -1,211 +0,0 @@
-/* Pango
- * basic-atsui.c
- *
- * Copyright (C) 2005 Imendio AB
- *
- * 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 <Carbon/Carbon.h>
-#include "pango-engine.h"
-#include "pango-utils.h"
-#include "pango-fontmap.h"
-#include "pangoatsui.h"
-
-/* No extra fields needed */
-typedef PangoEngineShape BasicEngineATSUI;
-typedef PangoEngineShapeClass BasicEngineATSUIClass ;
-
-#define SCRIPT_ENGINE_NAME "BasicScriptEngineATSUI"
-#define RENDER_TYPE PANGO_RENDER_TYPE_ATSUI
-
-static PangoEngineScriptInfo basic_scripts[] = {
- { PANGO_SCRIPT_COMMON, "" }
-};
-
-static PangoEngineInfo script_engines[] = {
- {
- SCRIPT_ENGINE_NAME,
- PANGO_ENGINE_TYPE_SHAPE,
- RENDER_TYPE,
- basic_scripts, G_N_ELEMENTS(basic_scripts)
- }
-};
-
-static void
-set_glyph (PangoFont *font,
- PangoGlyphString *glyphs,
- int i,
- int offset,
- PangoGlyph glyph)
-{
- PangoRectangle logical_rect;
-
- glyphs->glyphs[i].glyph = G_UNLIKELY (glyph == kATSDeletedGlyphcode) ?
- PANGO_GLYPH_EMPTY : 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 void
-basic_engine_shape (PangoEngineShape *engine,
- PangoFont *font,
- const char *text,
- gint length,
- const PangoAnalysis *analysis,
- PangoGlyphString *glyphs)
-{
- gunichar2 *utf16;
- long n16;
- ATSUTextLayout text_layout;
- ATSLayoutRecord *layout_records;
- OSStatus err;
- ItemCount glyph_count;
- int i;
- const char *p;
- PangoATSUIFont *afont = PANGO_ATSUI_FONT (font);
- ATSUStyle style;
- ATSUFontID fontID;
- ATSUAttributeTag styleTags[] = { kATSUFontTag };
- ATSUAttributeValuePtr styleValues[] = { &fontID };
- ByteCount styleSizes[] = { sizeof (ATSUFontID) };
-
- utf16 = g_utf8_to_utf16 (text, length, NULL, &n16, NULL);
-
- err = ATSUCreateTextLayoutWithTextPtr (utf16, 0, n16, n16,
- 0,
- NULL,
- NULL,
- &text_layout);
-
- err = ATSUCreateStyle(&style);
- fontID = pango_atsui_font_get_atsfont (afont);
-
- err = ATSUSetAttributes(style,
- (ItemCount)(sizeof(styleTags) / sizeof(styleTags[0])),
- styleTags, styleSizes, styleValues);
-
- err = ATSUSetRunStyle(text_layout,
- style, kATSUFromTextBeginning, kATSUToTextEnd);
-
- err = ATSUDirectGetLayoutDataArrayPtrFromTextLayout (text_layout, 0,
- kATSUDirectDataLayoutRecordATSLayoutRecordCurrent,
- (void *)&layout_records,
- &glyph_count);
-
- p = text;
- pango_glyph_string_set_size (glyphs, glyph_count - 1);
-
- for (i = 0; i < glyph_count - 1; i++)
- {
- gunichar wc;
- gunichar mirrored_ch;
-
- wc = g_utf8_get_char (p);
-
- if (analysis->level % 2)
- if (pango_get_mirror_char (wc, &mirrored_ch))
- wc = mirrored_ch;
-
- if (wc == 0xa0) /* non-break-space */
- wc = 0x20;
-
- if (pango_is_zero_width (wc))
- {
- set_glyph (font, glyphs, i, p - text, PANGO_GLYPH_EMPTY);
- }
- else
- {
- set_glyph (font, glyphs, i, p - text, layout_records[i].glyphID);
-
- 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;
- }
- }
- }
-
- p = g_utf8_next_char (p);
- }
-
- ATSUDirectReleaseLayoutDataArrayPtr (NULL, kATSUDirectDataLayoutRecordATSLayoutRecordCurrent,
- (void *)&layout_records);
-
- ATSUDisposeStyle (style);
- ATSUDisposeTextLayout (text_layout);
-
- g_free (utf16);
-}
-
-static void
-basic_engine_atsui_class_init (PangoEngineShapeClass *class)
-{
- class->script_shape = basic_engine_shape;
-}
-
-PANGO_ENGINE_SHAPE_DEFINE_TYPE (BasicEngineATSUI, basic_engine_atsui,
- basic_engine_atsui_class_init, NULL);
-
-void
-PANGO_MODULE_ENTRY(init) (GTypeModule *module)
-{
- basic_engine_atsui_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_atsui_type, NULL);
- else
- return NULL;
-}
-
diff --git a/pango/Makefile.am b/pango/Makefile.am
index 4e9592a7..ed1b48a2 100644
--- a/pango/Makefile.am
+++ b/pango/Makefile.am
@@ -343,7 +343,6 @@ libpangocairo_1_0_la_SOURCES += \
pangocairo-fc.h
endif
-if HAVE_CAIRO_ATSUI
if HAVE_CORE_TEXT
libpangocairo_1_0_la_SOURCES += \
modules.h \
@@ -362,27 +361,6 @@ libpangocairo_1_0_la_LDFLAGS += -framework CoreFoundation -framework Application
libpangocairo_1_0_la_LIBADD += $(INCLUDED_CORE_TEXT_MODULES)
# We don't have an CoreText GIR right now, so this is just hypothetical
PANGOCAIRO_FONT_BACKEND_GI_MODULE = PangoCoreText-1.0
-
-else
-libpangocairo_1_0_la_SOURCES += \
- modules.h \
- module-defs-atsui.c \
- pangoatsui.h \
- pangoatsui.c \
- pangoatsui-private.h \
- pangoatsui-fontmap.c \
- pangocairo-atsui.h \
- pangocairo-atsuifont.c \
- pangocairo-atsuifont.h \
- pangocairo-atsuifontmap.c
-pangoinclude_HEADERS += pangoatsui.h
-
-libpangocairo_1_0_la_CFLAGS = -xobjective-c
-libpangocairo_1_0_la_LDFLAGS += -framework CoreFoundation -framework Carbon -framework Cocoa
-libpangocairo_1_0_la_LIBADD += $(INCLUDED_ATSUI_MODULES)
-# We don't have an ATSUI GIR right now, so this is just hypothetical
-PANGOCAIRO_FONT_BACKEND_GI_MODULE = PangoATSUI-1.0
-endif
endif
pangocairo_introspection_files = \
@@ -563,7 +541,7 @@ if HAVE_INCLUDED_MODULES
included-modules:
$(AM_V_GEN) cd $(top_builddir)/modules && $(MAKE) $(AM_MAKEFLAGS) included-modules
-$(INCLUDED_LANG_MODULES) $(INCLUDED_X_MODULES) $(INCLUDED_FC_MODULES) $(INCLUDED_WIN32_MODULES) $(INCLUDED_ATSUI_MODULES): included-modules
+$(INCLUDED_LANG_MODULES) $(INCLUDED_X_MODULES) $(INCLUDED_FC_MODULES) $(INCLUDED_WIN32_MODULES) $(INCLUDED_CORE_TEXT_MODULES): included-modules
$(AM_V_GEN) true
.PHONY: included-modules
@@ -575,7 +553,6 @@ MODULE_DEF_FILES = \
module-defs-x.c \
module-defs-fc.c \
module-defs-win32.c \
- module-defs-atsui.c \
module-defs-coretext.c
$(MODULE_DEF_FILES): $(top_builddir)/config.status
diff --git a/pango/pangoatsui-fontmap.c b/pango/pangoatsui-fontmap.c
deleted file mode 100644
index c169f0df..00000000
--- a/pango/pangoatsui-fontmap.c
+++ /dev/null
@@ -1,825 +0,0 @@
-/* Pango
- * pangoatsui-fontmap.c
- *
- * Copyright (C) 2000-2003 Red Hat, Inc.
- * Copyright (C) 2005-2007 Imendio AB
- *
- * 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 "pango-fontmap.h"
-#include "pangoatsui-private.h"
-#include "pango-impl-utils.h"
-#include "modules.h"
-
-#import <Cocoa/Cocoa.h>
-
-typedef struct _FontHashKey FontHashKey;
-
-struct _PangoATSUIFamily
-{
- PangoFontFamily parent_instance;
-
- char *family_name;
-
- guint is_monospace : 1;
-
- PangoFontFace **faces;
- gint n_faces;
-};
-
-#define PANGO_TYPE_ATSUI_FAMILY (pango_atsui_family_get_type ())
-#define PANGO_ATSUI_FAMILY(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_ATSUI_FAMILY, PangoATSUIFamily))
-#define PANGO_IS_ATSUI_FAMILY(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_ATSUI_FAMILY))
-
-#define PANGO_TYPE_ATSUI_FACE (pango_atsui_face_get_type ())
-#define PANGO_ATSUI_FACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_ATSUI_FACE, PangoATSUIFace))
-#define PANGO_IS_ATSUI_FACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_ATSUI_FACE))
-
-struct _PangoATSUIFace
-{
- PangoFontFace parent_instance;
-
- PangoATSUIFamily *family;
-
- PangoCoverage *coverage;
-
- char *postscript_name;
- char *style_name;
-
- int weight;
- int traits;
- guint synthetic_italic : 1;
-};
-
-static GType pango_atsui_family_get_type (void);
-static GType pango_atsui_face_get_type (void);
-
-static gpointer pango_atsui_face_parent_class;
-
-static const char *
-get_real_family (const char *family_name)
-{
- switch (family_name[0])
- {
- case 'm':
- case 'M':
- if (g_ascii_strcasecmp (family_name, "monospace") == 0)
- return "Courier";
- break;
- case 's':
- case 'S':
- if (g_ascii_strcasecmp (family_name, "sans") == 0)
- return "Helvetica";
- else if (g_ascii_strcasecmp (family_name, "serif") == 0)
- return "Times";
- break;
- }
-
- return family_name;
-}
-
-static void
-pango_atsui_family_list_faces (PangoFontFamily *family,
- PangoFontFace ***faces,
- int *n_faces)
-{
- PangoATSUIFamily *atsuifamily = PANGO_ATSUI_FAMILY (family);
-
- if (atsuifamily->n_faces < 0)
- {
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- const char *real_family = get_real_family (atsuifamily->family_name);
- NSFontManager *manager = [NSFontManager sharedFontManager];
- NSArray *members = [manager availableMembersOfFontFamily:[NSString stringWithUTF8String:real_family]];
- int i, count;
- GHashTable *hash_table;
- GList *faces = NULL, *l;
- GList *synthetic_faces = NULL;
-
- /* The NSFontManager API returns italic faces for some families
- * even if they don't exist. When using Cocoa to create
- * instances of those fonts, Cocoa synthesizes italic versions
- * by applying a shear transformation. We do that manually for
- * those fonts in pangocairo-atsuifont.c. For many other fonts,
- * there is no italic face at all, so we create synthesized
- * versions of those like in the win32 and fontconfig backends.
- */
- hash_table = g_hash_table_new (g_direct_hash, g_direct_equal);
-
- count = [members count];
- for (i = 0; i < count; i++)
- {
- PangoATSUIFace *face = g_object_new (PANGO_TYPE_ATSUI_FACE, NULL);
- NSArray *font_array = [members objectAtIndex:i];
-
- face->family = atsuifamily;
- face->postscript_name = g_strdup ([[font_array objectAtIndex:0] UTF8String]);
- face->style_name = g_strdup ([[font_array objectAtIndex:1] UTF8String]);
- face->weight = [[font_array objectAtIndex:2] intValue];
- face->traits = [[font_array objectAtIndex:3] intValue];
-
- faces = g_list_prepend (faces, face);
-
- if (face->traits & NSItalicFontMask)
- g_hash_table_insert (hash_table, GINT_TO_POINTER (face->weight), face);
- }
-
- for (l = faces; l; l = l->next)
- {
- PangoATSUIFace *face = l->data;
-
- if (!g_hash_table_lookup (hash_table, GINT_TO_POINTER (face->weight)))
- {
- PangoATSUIFace *italic_face = g_object_new (PANGO_TYPE_ATSUI_FACE, NULL);
-
- italic_face->family = atsuifamily;
- italic_face->postscript_name = g_strdup (face->postscript_name);
- italic_face->weight = face->weight;
- italic_face->traits = face->traits | NSItalicFontMask;
- italic_face->synthetic_italic = TRUE;
-
- /* Try to create a sensible face name. */
- if (strcasecmp (face->style_name, "regular") == 0)
- italic_face->style_name = g_strdup ("Oblique");
- else
- italic_face->style_name = g_strdup_printf ("%s Oblique", face->style_name);
-
- synthetic_faces = g_list_prepend (synthetic_faces, italic_face);
- }
- }
-
- faces = g_list_concat (faces, synthetic_faces);
-
- atsuifamily->n_faces = g_list_length (faces);
- atsuifamily->faces = g_new (PangoFontFace *, atsuifamily->n_faces);
-
- for (l = faces, i = 0; l; l = l->next, i++)
- atsuifamily->faces[i] = l->data;
-
- g_list_free (faces);
- g_hash_table_destroy (hash_table);
-
- [pool release];
- }
-
- if (n_faces)
- *n_faces = atsuifamily->n_faces;
-
- if (faces)
- *faces = g_memdup (atsuifamily->faces, atsuifamily->n_faces * sizeof (PangoFontFace *));
-}
-
-static const char *
-pango_atsui_family_get_name (PangoFontFamily *family)
-
-{
- PangoATSUIFamily *atsuifamily = PANGO_ATSUI_FAMILY (family);
-
- return atsuifamily->family_name;
-}
-
-static gboolean
-pango_atsui_family_is_monospace (PangoFontFamily *family)
-{
- PangoATSUIFamily *atsuifamily = PANGO_ATSUI_FAMILY (family);
-
- return atsuifamily->is_monospace;
-}
-
-G_DEFINE_TYPE (PangoATSUIFamily, pango_atsui_family, PANGO_TYPE_FONT_FAMILY);
-
-static void
-pango_atsui_family_finalize (GObject *object)
-{
- PangoATSUIFamily *family = PANGO_ATSUI_FAMILY (object);
- int i;
-
- g_free (family->family_name);
-
- if (family->n_faces != -1)
- {
- for (i = 0; i < family->n_faces; i++)
- g_object_unref (family->faces[i]);
-
- g_free (family->faces);
- }
-
- G_OBJECT_CLASS (pango_atsui_family_parent_class)->finalize (object);
-}
-
-static void
-pango_atsui_family_class_init (PangoATSUIFamilyClass *class)
-{
- GObjectClass *object_class = (GObjectClass *)class;
- int i;
-
- object_class->finalize = pango_atsui_family_finalize;
-
- class->list_faces = pango_atsui_family_list_faces;
- class->get_name = pango_atsui_family_get_name;
- class->is_monospace = pango_atsui_family_is_monospace;
-
- for (i = 0; _pango_included_atsui_modules[i].list; i++)
- pango_module_register (&_pango_included_atsui_modules[i]);
-}
-
-static void
-pango_atsui_family_init (PangoATSUIFamily *family)
-{
- family->n_faces = -1;
-}
-
-static PangoFontDescription *
-pango_atsui_face_describe (PangoFontFace *face)
-{
- PangoATSUIFace *atsuiface = PANGO_ATSUI_FACE (face);
- PangoFontDescription *description;
- PangoWeight pango_weight;
- PangoStyle pango_style;
- PangoVariant pango_variant;
- int weight;
-
- description = pango_font_description_new ();
-
- pango_font_description_set_family (description, atsuiface->family->family_name);
-
- weight = atsuiface->weight;
-
- if (weight == 1 || weight == 2)
- pango_weight = PANGO_WEIGHT_ULTRALIGHT;
- else if (weight == 3 || weight == 4)
- pango_weight = PANGO_WEIGHT_LIGHT;
- else if (weight == 5 || weight == 6)
- pango_weight = PANGO_WEIGHT_NORMAL;
- else if (weight == 7 || weight == 8)
- pango_weight = PANGO_WEIGHT_SEMIBOLD;
- else if (weight == 9 || weight == 10)
- pango_weight = PANGO_WEIGHT_BOLD;
- else if (weight == 11 || weight == 12)
- pango_weight = PANGO_WEIGHT_ULTRABOLD;
- else if (weight == 13 || weight == 14)
- pango_weight = PANGO_WEIGHT_HEAVY;
- else
- g_assert_not_reached ();
-
- if (atsuiface->traits & NSItalicFontMask)
- pango_style = PANGO_STYLE_ITALIC;
- else
- pango_style = PANGO_STYLE_NORMAL;
-
- if (atsuiface->traits & NSSmallCapsFontMask)
- pango_variant = PANGO_VARIANT_SMALL_CAPS;
- else
- pango_variant = PANGO_VARIANT_NORMAL;
-
- pango_font_description_set_weight (description, pango_weight);
- pango_font_description_set_style (description, pango_style);
- pango_font_description_set_variant (description, pango_variant);
-
- return description;
-}
-
-static const char *
-pango_atsui_face_get_face_name (PangoFontFace *face)
-{
- PangoATSUIFace *atsuiface = PANGO_ATSUI_FACE (face);
-
- return atsuiface->style_name;
-}
-
-static void
-pango_atsui_face_list_sizes (PangoFontFace *face,
- int **sizes,
- int *n_sizes)
-{
- *n_sizes = 0;
- *sizes = NULL;
-}
-
-static void
-pango_atsui_face_finalize (GObject *object)
-{
- PangoATSUIFace *atsuiface = PANGO_ATSUI_FACE (object);
-
- if (atsuiface->coverage)
- pango_coverage_unref (atsuiface->coverage);
-
- g_free (atsuiface->postscript_name);
- g_free (atsuiface->style_name);
-
- G_OBJECT_CLASS (pango_atsui_face_parent_class)->finalize (object);
-}
-
-static gboolean
-pango_atsui_face_is_synthesized (PangoFontFace *face)
-{
- PangoATSUIFace *atsuiface = PANGO_ATSUI_FACE (face);
-
- return atsuiface->synthetic_italic;
-}
-
-static void
-pango_atsui_face_class_init (PangoFontFaceClass *class)
-{
- GObjectClass *object_class = (GObjectClass *)class;
-
- pango_atsui_face_parent_class = g_type_class_peek_parent (class);
-
- object_class->finalize = pango_atsui_face_finalize;
-
- class->describe = pango_atsui_face_describe;
- class->get_face_name = pango_atsui_face_get_face_name;
- class->list_sizes = pango_atsui_face_list_sizes;
- class->is_synthesized = pango_atsui_face_is_synthesized;
-}
-
-GType
-pango_atsui_face_get_type (void)
-{
- static GType object_type = 0;
-
- if (G_UNLIKELY (!object_type))
- {
- const GTypeInfo object_info =
- {
- sizeof (PangoFontFaceClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) pango_atsui_face_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (PangoATSUIFace),
- 0, /* n_preallocs */
- (GInstanceInitFunc) NULL,
- };
-
- object_type = g_type_register_static (PANGO_TYPE_FONT_FACE,
- I_("PangoATSUIFace"),
- &object_info, 0);
- }
-
- return object_type;
-}
-
-const char *
-_pango_atsui_face_get_postscript_name (PangoATSUIFace *face)
-{
- return face->postscript_name;
-}
-
-gboolean
-_pango_atsui_face_get_synthetic_italic (PangoATSUIFace *face)
-{
- return face->synthetic_italic;
-}
-
-PangoCoverage *
-_pango_atsui_face_get_coverage (PangoATSUIFace *face,
- PangoLanguage *language)
-{
- int i;
-
- /* Note: We currently fake the coverage by reporting that the 255 first
- * glyphs exist in all fonts, which is not true. It's unclear how to get
- * this done correctly.
- */
-
- if (face->coverage)
- return face->coverage;
-
- face->coverage = pango_coverage_new ();
-
- for (i = 0; i < 256; i++)
- pango_coverage_set (face->coverage, i, PANGO_COVERAGE_EXACT);
-
- return face->coverage;
-}
-
-static void pango_atsui_font_map_class_init (PangoATSUIFontMapClass *class);
-static void pango_atsui_font_map_init (PangoATSUIFontMap *atsuifontmap);
-
-static guint font_hash_key_hash (const FontHashKey *key);
-static gboolean font_hash_key_equal (const FontHashKey *key_a,
- const FontHashKey *key_b);
-static void font_hash_key_free (FontHashKey *key);
-
-G_DEFINE_TYPE (PangoATSUIFontMap, pango_atsui_font_map, PANGO_TYPE_FONT_MAP);
-
-static void
-pango_atsui_font_map_finalize (GObject *object)
-{
- PangoATSUIFontMap *fontmap = PANGO_ATSUI_FONT_MAP (object);
-
- g_hash_table_destroy (fontmap->font_hash);
- g_hash_table_destroy (fontmap->families);
-
- G_OBJECT_CLASS (pango_atsui_font_map_parent_class)->finalize (object);
-}
-
-struct _FontHashKey {
- PangoATSUIFontMap *fontmap;
- PangoMatrix matrix;
- PangoFontDescription *desc;
- char *postscript_name;
- gpointer context_key;
-};
-
-/* Fowler / Noll / Vo (FNV) Hash (http://www.isthe.com/chongo/tech/comp/fnv/)
- *
- * Not necessarily better than a lot of other hashes, but should be OK, and
- * well tested with binary data.
- */
-
-#define FNV_32_PRIME ((guint32)0x01000193)
-#define FNV1_32_INIT ((guint32)0x811c9dc5)
-
-static guint32
-hash_bytes_fnv (unsigned char *buffer,
- int len,
- guint32 hval)
-{
- while (len--)
- {
- hval *= FNV_32_PRIME;
- hval ^= *buffer++;
- }
-
- return hval;
-}
-
-static gboolean
-font_hash_key_equal (const FontHashKey *key_a,
- const FontHashKey *key_b)
-{
- if (key_a->matrix.xx == key_b->matrix.xx &&
- key_a->matrix.xy == key_b->matrix.xy &&
- key_a->matrix.yx == key_b->matrix.yx &&
- key_a->matrix.yy == key_b->matrix.yy &&
- pango_font_description_equal (key_a->desc, key_b->desc) &&
- strcmp (key_a->postscript_name, key_b->postscript_name) == 0)
- {
- if (key_a->context_key)
- return PANGO_ATSUI_FONT_MAP_GET_CLASS (key_a->fontmap)->context_key_equal (key_a->fontmap,
- key_a->context_key,
- key_b->context_key);
- else
- return TRUE;
- }
- else
- return FALSE;
-}
-
-static guint
-font_hash_key_hash (const FontHashKey *key)
-{
- guint32 hash = FNV1_32_INIT;
-
- /* We do a bytewise hash on the context matrix */
- hash = hash_bytes_fnv ((unsigned char *)(&key->matrix),
- sizeof(double) * 4,
- hash);
-
- if (key->context_key)
- hash ^= PANGO_ATSUI_FONT_MAP_GET_CLASS (key->fontmap)->context_key_hash (key->fontmap,
- key->context_key);
-
- hash ^= g_str_hash (key->postscript_name);
-
- return (hash ^ pango_font_description_hash (key->desc));
-}
-
-static void
-font_hash_key_free (FontHashKey *key)
-{
- if (key->context_key)
- PANGO_ATSUI_FONT_MAP_GET_CLASS (key->fontmap)->context_key_free (key->fontmap,
- key->context_key);
-
- g_slice_free (FontHashKey, key);
-}
-
-static FontHashKey *
-font_hash_key_copy (FontHashKey *old)
-{
- FontHashKey *key = g_slice_new (FontHashKey);
-
- key->fontmap = old->fontmap;
- key->matrix = old->matrix;
- key->desc = pango_font_description_copy (old->desc);
- key->postscript_name = g_strdup (old->postscript_name);
- if (old->context_key)
- key->context_key = PANGO_ATSUI_FONT_MAP_GET_CLASS (key->fontmap)->context_key_copy (key->fontmap,
- old->context_key);
- else
- key->context_key = NULL;
-
- return key;
-}
-
-
-static void
-get_context_matrix (PangoContext *context,
- PangoMatrix *matrix)
-{
- const PangoMatrix *set_matrix;
- static const PangoMatrix identity = PANGO_MATRIX_INIT;
-
- if (context)
- set_matrix = pango_context_get_matrix (context);
- else
- set_matrix = NULL;
-
- if (set_matrix)
- *matrix = *set_matrix;
- else
- *matrix = identity;
-}
-
-static void
-font_hash_key_for_context (PangoATSUIFontMap *fcfontmap,
- PangoContext *context,
- FontHashKey *key)
-{
- key->fontmap = fcfontmap;
- get_context_matrix (context, &key->matrix);
-
- if (PANGO_ATSUI_FONT_MAP_GET_CLASS (fcfontmap)->context_key_get)
- key->context_key = (gpointer)PANGO_ATSUI_FONT_MAP_GET_CLASS (fcfontmap)->context_key_get (fcfontmap, context);
- else
- key->context_key = NULL;
-}
-
-static void
-pango_atsui_font_map_add (PangoATSUIFontMap *atsuifontmap,
- PangoContext *context,
- PangoATSUIFont *atsuifont)
-{
- FontHashKey key;
- FontHashKey *key_copy;
- PangoATSUIFace *face;
-
- _pango_atsui_font_set_font_map (atsuifont, atsuifontmap);
-
- font_hash_key_for_context (atsuifontmap, context, &key);
- face = _pango_atsui_font_get_face (atsuifont);
- key.postscript_name = (char *)_pango_atsui_face_get_postscript_name (face);
- key.desc = _pango_atsui_font_get_font_description (atsuifont);
-
- key_copy = font_hash_key_copy (&key);
- _pango_atsui_font_set_context_key (atsuifont, key_copy->context_key);
- g_hash_table_insert (atsuifontmap->font_hash, key_copy, g_object_ref (atsuifont));
-}
-
-static PangoATSUIFont *
-pango_atsui_font_map_lookup (PangoATSUIFontMap *atsuifontmap,
- PangoContext *context,
- PangoFontDescription *desc,
- PangoATSUIFace *face)
-{
- FontHashKey key;
-
- font_hash_key_for_context (atsuifontmap, context, &key);
- key.postscript_name = (char *)_pango_atsui_face_get_postscript_name (face);
- key.desc = desc;
-
- return g_hash_table_lookup (atsuifontmap->font_hash, &key);
-}
-
-static gboolean
-find_best_match (PangoATSUIFamily *font_family,
- const PangoFontDescription *description,
- PangoFontDescription **best_description,
- PangoATSUIFace **best_face)
-{
- PangoFontDescription *new_desc;
- int i;
-
- *best_description = NULL;
- *best_face = NULL;
-
- for (i = 0; i < font_family->n_faces; i++)
- {
- new_desc = pango_font_face_describe (font_family->faces[i]);
-
- if (pango_font_description_better_match (description, *best_description, new_desc))
- {
- pango_font_description_free (*best_description);
- *best_description = new_desc;
- *best_face = (PangoATSUIFace *)font_family->faces[i];
- }
- else
- pango_font_description_free (new_desc);
- }
-
- if (*best_description)
- return TRUE;
-
- return FALSE;
-}
-
-static PangoFont *
-pango_atsui_font_map_load_font (PangoFontMap *fontmap,
- PangoContext *context,
- const PangoFontDescription *description)
-{
- PangoATSUIFontMap *atsuifontmap = (PangoATSUIFontMap *)fontmap;
- PangoATSUIFamily *font_family;
- const gchar *family;
- gchar *name;
- gint size;
- gboolean is_absolute;
-
- size = pango_font_description_get_size (description);
- if (size < 0)
- return NULL;
-
- is_absolute = pango_font_description_get_size_is_absolute (description);
-
- family = pango_font_description_get_family (description);
- family = family ? family : "";
- name = g_utf8_casefold (family, -1);
- font_family = g_hash_table_lookup (atsuifontmap->families, name);
- g_free (name);
-
- if (font_family)
- {
- PangoFontDescription *best_description;
- PangoATSUIFace *best_face;
- PangoATSUIFont *best_font;
-
- /* Force a listing of the available faces */
- pango_font_family_list_faces ((PangoFontFamily *)font_family, NULL, NULL);
-
- if (!find_best_match (font_family, description, &best_description, &best_face))
- return NULL;
-
- if (is_absolute)
- pango_font_description_set_absolute_size (best_description, size);
- else
- pango_font_description_set_size (best_description, size);
-
- best_font = pango_atsui_font_map_lookup (atsuifontmap,
- context,
- best_description,
- best_face);
-
- if (best_font)
- g_object_ref (best_font);
- else
- {
- PangoATSUIFontMapClass *klass;
-
- klass = PANGO_ATSUI_FONT_MAP_GET_CLASS (atsuifontmap);
- best_font = klass->create_font (atsuifontmap, context,
- best_face, best_description);
-
- if (best_font)
- pango_atsui_font_map_add (atsuifontmap, context, best_font);
- /* TODO: Handle the else case here. */
- }
-
- pango_font_description_free (best_description);
-
- return (PangoFont *)best_font;
- }
-
- return NULL;
-}
-
-static void
-list_families_foreach (gpointer key,
- gpointer value,
- gpointer user_data)
-{
- GSList **list = user_data;
-
- *list = g_slist_prepend (*list, value);
-}
-
-static void
-pango_atsui_font_map_list_families (PangoFontMap *fontmap,
- PangoFontFamily ***families,
- int *n_families)
-{
- GSList *family_list = NULL;
- GSList *tmp_list;
- PangoATSUIFontMap *atsuifontmap = (PangoATSUIFontMap *)fontmap;
-
- if (!n_families)
- return;
-
- g_hash_table_foreach (atsuifontmap->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 void
-pango_atsui_font_map_init (PangoATSUIFontMap *atsuifontmap)
-{
- NSAutoreleasePool *pool;
- NSFontManager *manager;
- NSArray *family_array;
- PangoATSUIFamily *family;
- int size, i;
-
- atsuifontmap->families = g_hash_table_new_full (g_str_hash, g_str_equal,
- g_free, g_object_unref);
-
-
- atsuifontmap->font_hash = g_hash_table_new_full ((GHashFunc)font_hash_key_hash,
- (GEqualFunc)font_hash_key_equal,
- (GDestroyNotify)font_hash_key_free,
- NULL);
-
- pool = [[NSAutoreleasePool alloc] init];
- manager = [NSFontManager sharedFontManager];
- family_array = [manager availableFontFamilies];
- size = [family_array count];
-
- for (i = 0; i < size; i++)
- {
- NSString *family_name = [family_array objectAtIndex:i];
- NSArray *members;
-
- family = g_object_new (PANGO_TYPE_ATSUI_FAMILY, NULL);
- family->family_name = g_strdup ([family_name UTF8String]);
-
- members = [manager availableMembersOfFontFamily:family_name];
- if ([members count] > 0)
- {
- NSArray *font_array = [members objectAtIndex:0];
-
- /* We assume that all faces in the family are monospaced, or
- * none.
- */
- if ([[font_array objectAtIndex:3] intValue] & NSFixedPitchFontMask)
- family->is_monospace = TRUE;
- }
-
- g_hash_table_insert (atsuifontmap->families, g_utf8_casefold (family->family_name, -1), family);
- }
-
- /* Insert aliases */
- family = g_object_new (PANGO_TYPE_ATSUI_FAMILY, NULL);
- family->family_name = g_strdup ("Sans");
- g_hash_table_insert (atsuifontmap->families, g_utf8_casefold (family->family_name, -1), family);
-
- family = g_object_new (PANGO_TYPE_ATSUI_FAMILY, NULL);
- family->family_name = g_strdup ("Serif");
- g_hash_table_insert (atsuifontmap->families, g_utf8_casefold (family->family_name, -1), family);
-
- family = g_object_new (PANGO_TYPE_ATSUI_FAMILY, NULL);
- family->family_name = g_strdup ("Monospace");
- family->is_monospace = TRUE;
- g_hash_table_insert (atsuifontmap->families, g_utf8_casefold (family->family_name, -1), family);
-
- [pool release];
-}
-
-static void
-pango_atsui_font_map_class_init (PangoATSUIFontMapClass *class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (class);
- PangoFontMapClass *fontmap_class = PANGO_FONT_MAP_CLASS (class);
-
- object_class->finalize = pango_atsui_font_map_finalize;
-
- fontmap_class->load_font = pango_atsui_font_map_load_font;
- fontmap_class->list_families = pango_atsui_font_map_list_families;
- fontmap_class->shape_engine_type = PANGO_RENDER_TYPE_ATSUI;
-}
-
-
diff --git a/pango/pangoatsui-private.h b/pango/pangoatsui-private.h
deleted file mode 100644
index 81bcf60a..00000000
--- a/pango/pangoatsui-private.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* Pango
- * pangoatsui-private.h:
- *
- * Copyright (C) 2003 Red Hat Software
- * Copyright (C) 2005-2007 Imendio AB
- *
- * 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 __PANGOATSUI_PRIVATE_H__
-#define __PANGOATSUI_PRIVATE_H__
-
-#include <pango/pango-fontmap.h>
-#include <pango/pango-context.h>
-#include "pangoatsui.h"
-
-G_BEGIN_DECLS
-
-#define PANGO_TYPE_ATSUI_FONT_MAP (pango_atsui_font_map_get_type ())
-#define PANGO_ATSUI_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_ATSUI_FONT_MAP, PangoATSUIFontMap))
-#define PANGO_ATSUI_IS_FONT_MAP(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_ATSUI_FONT_MAP))
-#define PANGO_ATSUI_FONT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_ATSUI_FONT_MAP, PangoATSUIFontMapClass))
-#define PANGO_IS_ATSUI_FONT_MAP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_ATSUI_FONT_MAP))
-#define PANGO_ATSUI_FONT_MAP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_ATSUI_FONT_MAP, PangoATSUIFontMapClass))
-
-
-typedef struct _PangoATSUIFamily PangoATSUIFamily;
-typedef struct _PangoFontFamilyClass PangoATSUIFamilyClass;
-
-typedef struct _PangoATSUIFace PangoATSUIFace;
-
-typedef struct _PangoATSUIFontMap PangoATSUIFontMap;
-typedef struct _PangoATSUIFontMapClass PangoATSUIFontMapClass;
-
-struct _PangoATSUIFontMap
-{
- PangoFontMap parent_instance;
-
- GHashTable *font_hash;
-
- GHashTable *families;
-};
-
-struct _PangoATSUIFontMapClass
-{
- PangoFontMapClass parent_class;
-
- gconstpointer (*context_key_get) (PangoATSUIFontMap *atsuifontmap,
- PangoContext *context);
- gpointer (*context_key_copy) (PangoATSUIFontMap *atsuifontmap,
- gconstpointer key);
- void (*context_key_free) (PangoATSUIFontMap *atsuifontmap,
- gpointer key);
- guint32 (*context_key_hash) (PangoATSUIFontMap *atsuifontmap,
- gconstpointer key);
- gboolean (*context_key_equal) (PangoATSUIFontMap *atsuifontmap,
- gconstpointer key_a,
- gconstpointer key_b);
-
- PangoATSUIFont * (* create_font) (PangoATSUIFontMap *fontmap,
- PangoContext *context,
- PangoATSUIFace *face,
- const PangoFontDescription *desc);
-};
-
-
-GType pango_atsui_font_map_get_type (void) G_GNUC_CONST;
-
-const char * _pango_atsui_face_get_postscript_name (PangoATSUIFace *face);
-PangoCoverage * _pango_atsui_face_get_coverage (PangoATSUIFace *face,
- PangoLanguage *language);
-gboolean _pango_atsui_face_get_synthetic_italic (PangoATSUIFace *face);
-
-void _pango_atsui_font_set_font_description (PangoATSUIFont *afont,
- const PangoFontDescription *desc);
-PangoFontDescription *_pango_atsui_font_get_font_description (PangoATSUIFont *afont);
-void _pango_atsui_font_set_font_map (PangoATSUIFont *afont,
- PangoATSUIFontMap *fontmap);
-void _pango_atsui_font_set_face (PangoATSUIFont *afont,
- PangoATSUIFace *aface);
-PangoATSUIFace * _pango_atsui_font_get_face (PangoATSUIFont *font);
-gpointer _pango_atsui_font_get_context_key (PangoATSUIFont *afont);
-void _pango_atsui_font_set_context_key (PangoATSUIFont *afont,
- gpointer context_key);
-void _pango_atsui_font_set_cgfont (PangoATSUIFont *font,
- CGFontRef font_id);
-void _pango_atsui_font_set_atsfont (PangoATSUIFont *font,
- ATSFontRef font_ref);
-
-G_END_DECLS
-
-#endif /* __PANGOATSUI_H__ */
diff --git a/pango/pangoatsui.c b/pango/pangoatsui.c
deleted file mode 100644
index da4b9a5a..00000000
--- a/pango/pangoatsui.c
+++ /dev/null
@@ -1,231 +0,0 @@
-/* Pango
- * pangatsui.c
- *
- * Copyright (C) 2005-2007 Imendio AB
- *
- * 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 "pangoatsui.h"
-#include "pangoatsui-private.h"
-
-G_DEFINE_TYPE (PangoATSUIFont, pango_atsui_font, PANGO_TYPE_FONT);
-
-struct _PangoATSUIFontPrivate
-{
- PangoATSUIFace *face;
- PangoFontDescription *desc;
- gpointer context_key;
-
- CGFontRef font_id;
- ATSFontRef font_ref;
-
- PangoFontMap *fontmap;
-};
-
-static void
-pango_atsui_font_finalize (GObject *object)
-{
- PangoATSUIFont *afont = (PangoATSUIFont *)object;
- PangoATSUIFontPrivate *priv = afont->priv;
-
- pango_font_description_free (priv->desc);
-
- g_assert (priv->fontmap != NULL);
- g_object_remove_weak_pointer (G_OBJECT (priv->fontmap), (gpointer *) (gpointer) &priv->fontmap);
- priv->fontmap = NULL;
-
- G_OBJECT_CLASS (pango_atsui_font_parent_class)->finalize (object);
-}
-
-static PangoFontDescription *
-pango_atsui_font_describe (PangoFont *font)
-{
- PangoATSUIFont *afont = (PangoATSUIFont *)font;
- PangoATSUIFontPrivate *priv = afont->priv;
-
- return pango_font_description_copy (priv->desc);
-}
-
-static PangoCoverage *
-pango_atsui_font_get_coverage (PangoFont *font,
- PangoLanguage *language)
-{
- PangoATSUIFont *afont = (PangoATSUIFont *)font;
- PangoATSUIFontPrivate *priv = afont->priv;
-
- return pango_coverage_ref (_pango_atsui_face_get_coverage (priv->face,
- language));
-}
-
-static PangoEngineShape *
-pango_atsui_font_find_shaper (PangoFont *font,
- PangoLanguage *language,
- guint32 ch)
-{
- /* FIXME: Implement */
- return NULL;
-}
-
-static PangoFontMap *
-pango_atsui_font_get_font_map (PangoFont *font)
-{
- PangoATSUIFont *afont = (PangoATSUIFont *)font;
-
- return afont->priv->fontmap;
-}
-
-static void
-pango_atsui_font_init (PangoATSUIFont *afont)
-{
- afont->priv = G_TYPE_INSTANCE_GET_PRIVATE (afont,
- PANGO_TYPE_ATSUI_FONT,
- PangoATSUIFontPrivate);
-}
-
-static void
-pango_atsui_font_class_init (PangoATSUIFontClass *class)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (class);
- PangoFontClass *font_class = PANGO_FONT_CLASS (class);
-
- object_class->finalize = pango_atsui_font_finalize;
-
- font_class->describe = pango_atsui_font_describe;
- font_class->get_coverage = pango_atsui_font_get_coverage;
- font_class->find_shaper = pango_atsui_font_find_shaper;
- font_class->get_font_map = pango_atsui_font_get_font_map;
-
- g_type_class_add_private (object_class, sizeof (PangoATSUIFontPrivate));
-}
-
-void
-_pango_atsui_font_set_font_description (PangoATSUIFont *font,
- const PangoFontDescription *desc)
-{
- PangoATSUIFontPrivate *priv = font->priv;
-
- priv->desc = pango_font_description_copy (desc);
-}
-
-PangoFontDescription *
-_pango_atsui_font_get_font_description (PangoATSUIFont *font)
-{
- PangoATSUIFontPrivate *priv = font->priv;
-
- return priv->desc;
-}
-
-void
-_pango_atsui_font_set_font_map (PangoATSUIFont *font,
- PangoATSUIFontMap *fontmap)
-{
- PangoATSUIFontPrivate *priv = font->priv;
-
- g_assert (priv->fontmap == NULL);
- priv->fontmap = (PangoFontMap *) fontmap;
- g_object_add_weak_pointer (G_OBJECT (priv->fontmap), (gpointer *) (gpointer) &priv->fontmap);
-}
-
-void
-_pango_atsui_font_set_face (PangoATSUIFont *afont,
- PangoATSUIFace *face)
-{
- PangoATSUIFontPrivate *priv = afont->priv;
-
- priv->face = face;
-}
-
-PangoATSUIFace *
-_pango_atsui_font_get_face (PangoATSUIFont *afont)
-{
- PangoATSUIFontPrivate *priv = afont->priv;
-
- return priv->face;
-}
-
-gpointer
-_pango_atsui_font_get_context_key (PangoATSUIFont *afont)
-{
- PangoATSUIFontPrivate *priv = afont->priv;
-
- return priv->context_key;
-}
-
-void
-_pango_atsui_font_set_context_key (PangoATSUIFont *afont,
- gpointer context_key)
-{
- PangoATSUIFontPrivate *priv = afont->priv;
-
- priv->context_key = context_key;
-}
-
-void
-_pango_atsui_font_set_cgfont (PangoATSUIFont *font,
- CGFontRef font_id)
-{
- PangoATSUIFontPrivate *priv = font->priv;
-
- priv->font_id = font_id;
-}
-
-void
-_pango_atsui_font_set_atsfont (PangoATSUIFont *font,
- ATSFontRef font_ref)
-{
- PangoATSUIFontPrivate *priv = font->priv;
-
- priv->font_ref = font_ref;
-}
-
-/**
- * pango_atsui_font_get_cgfont:
- * @font: A #PangoATSUIFont
- *
- * Returns the CGFontRef of a font.
- *
- * Return value: the CGFontRef associated to @font.
- *
- * Since: 1.18
- */
-CGFontRef
-pango_atsui_font_get_cgfont (PangoATSUIFont *font)
-{
- PangoATSUIFontPrivate *priv = font->priv;
-
- return priv->font_id;
-}
-
-/**
- * pango_atsui_font_get_atsfont:
- * @font: A #PangoATSUIFont
- *
- * Returns the ATSFontRef of a font.
- *
- * Return value: the ATSFontRef associated to @font.
- *
- * Since: 1.28
- */
-ATSFontRef
-pango_atsui_font_get_atsfont (PangoATSUIFont *font)
-{
- PangoATSUIFontPrivate *priv = font->priv;
-
- return priv->font_ref;
-}
diff --git a/pango/pangoatsui.h b/pango/pangoatsui.h
deleted file mode 100644
index 3ca558e2..00000000
--- a/pango/pangoatsui.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* Pango
- * pangoatsui.h:
- *
- * Copyright (C) 2005 Imendio AB
- *
- * 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 __PANGOATSUI_H__
-#define __PANGOATSUI_H__
-
-#include <pango/pango-context.h>
-#include <pango/pango-font.h>
-#include <ApplicationServices/ApplicationServices.h>
-
-G_BEGIN_DECLS
-
-#define PANGO_TYPE_ATSUI_FONT (pango_atsui_font_get_type ())
-#define PANGO_ATSUI_FONT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), PANGO_TYPE_ATSUI_FONT, PangoATSUIFont))
-#define PANGO_IS_ATSUI_FONT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), PANGO_TYPE_ATSUI_FONT))
-
-typedef struct _PangoATSUIFont PangoATSUIFont;
-typedef struct _PangoATSUIFontClass PangoATSUIFontClass;
-
-#if defined(PANGO_ENABLE_ENGINE) || defined(PANGO_ENABLE_BACKEND)
-
-#define PANGO_RENDER_TYPE_ATSUI "PangoRenderATSUI"
-
-#ifdef PANGO_ENABLE_BACKEND
-
-#define PANGO_ATSUI_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PANGO_TYPE_ATSUI_FONT, PangoATSUIFontClass))
-#define PANGO_IS_ATSUI_FONT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PANGO_TYPE_ATSUI_FONT))
-#define PANGO_ATSUI_FONT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PANGO_TYPE_ATSUI_FONT, PangoATSUIFontClass))
-
-typedef struct _PangoATSUIFontPrivate PangoATSUIFontPrivate;
-
-struct _PangoATSUIFont
-{
- PangoFont parent_instance;
- PangoATSUIFontPrivate *priv;
-};
-
-struct _PangoATSUIFontClass
-{
- PangoFontClass parent_class;
-
- /*< private >*/
-
- /* Padding for future expansion */
- void (*_pango_reserved1) (void);
- void (*_pango_reserved2) (void);
- void (*_pango_reserved3) (void);
- void (*_pango_reserved4) (void);
-};
-
-#endif /* PANGO_ENABLE_BACKEND */
-
-CGFontRef pango_atsui_font_get_cgfont (PangoATSUIFont *font);
-ATSFontRef pango_atsui_font_get_atsfont (PangoATSUIFont *font);
-
-#endif /* PANGO_ENABLE_ENGINE || PANGO_ENABLE_BACKEND */
-
-GType pango_atsui_font_get_type (void) G_GNUC_CONST;
-
-G_END_DECLS
-
-#endif /* __PANGOATSUI_H__ */