summaryrefslogtreecommitdiff
path: root/modules/basic
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2003-04-14 23:48:34 +0000
committerOwen Taylor <otaylor@src.gnome.org>2003-04-14 23:48:34 +0000
commit402f2625c2c779df20470ed0f758999db494e4dc (patch)
tree6667e384ed0c39a22a6e3f731c062311fa7b3e9a /modules/basic
parentf6fdd34661bd9fe23452b5eb98ece8488a12ce8f (diff)
downloadpango-402f2625c2c779df20470ed0f758999db494e4dc.tar.gz
Switch over the way that module entry points work, taking advantage of the
Mon Apr 14 06:02:34 2003 Owen Taylor <otaylor@redhat.com> * modules/thai/{thai-fc.c,thai-shaper.c,thai-x.c}: * modules/*/*-{xft,x,win32.c} pango/pango-engine.h modules/*/Makefile.am: Switch over the way that module entry points work, taking advantage of the new automake capability for per-target CFLAGS for shared sources. * pango/pangofc-font.[ch] pango/pangoxft-font.c pango/pangoft2.c: Add a base class for PangoXft and PangoFT2 font classes so code can be shared between FT2 and Xft backends. * configure.in modules/*/Makefile.am modules/{arabic,basic,hangul,hebrew,indic,thai}: Move *-xft.c to *-fc.c and share between Xft and FT2 backends; adds FT2 backend capabilities for hangul/indic/thai. * pango/pangoxft.h pango/pangoft2.h: Deprecate APIs that moved into PangoFcFont * modules/basic/basic-fc.c (set_glyph): Add kerning handling from FT2 backend.
Diffstat (limited to 'modules/basic')
-rw-r--r--modules/basic/Makefile.am23
-rw-r--r--modules/basic/basic-fc.c121
-rw-r--r--modules/basic/basic-ft2.c335
-rw-r--r--modules/basic/basic-win32.c17
-rw-r--r--modules/basic/basic-x.c16
-rw-r--r--modules/basic/basic-xft.c269
6 files changed, 86 insertions, 695 deletions
diff --git a/modules/basic/Makefile.am b/modules/basic/Makefile.am
index f9ed1bf6..a655db71 100644
--- a/modules/basic/Makefile.am
+++ b/modules/basic/Makefile.am
@@ -14,8 +14,7 @@ INCLUDES = \
$(PANGO_DEBUG_FLAGS) \
-I$(top_srcdir) \
-I$(top_srcdir)/pango/ \
- $(GLIB_CFLAGS) \
- $(moddefine)
+ $(GLIB_CFLAGS)
if PLATFORM_WIN32
no_undefined = -no-undefined
@@ -25,13 +24,10 @@ moduledir = $(libdir)/pango/$(PANGO_MODULE_VERSION)/modules
module_LTLIBRARIES =
noinst_LTLIBRARIES =
-moddefine =
-
if HAVE_X
INCLUDES += $(X_CFLAGS)
if INCLUDE_BASIC_X
noinst_LTLIBRARIES += libpango-basic-x.la
-INCLUDES += -DX_MODULE_PREFIX
else
module_LTLIBRARIES += pango-basic-x.la
endif
@@ -41,13 +37,13 @@ pango_basic_x_la_LDFLAGS = -export-dynamic -avoid-version -module
pango_basic_x_la_LIBADD = $(pangoxlibs)
pango_basic_x_la_SOURCES = basic-x.c
libpango_basic_x_la_SOURCES = basic-x.c
+libpango_basic_x_la_CFLAGS = -DPANGO_MODULE_PREFIX=_pango_basic_x
if HAVE_XFT
INCLUDES += $(XFT_CFLAGS)
if INCLUDE_BASIC_XFT
noinst_LTLIBRARIES += libpango-basic-xft.la
-INCLUDES += -DXFT_MODULE_PREFIX
else
module_LTLIBRARIES += pango-basic-xft.la
endif
@@ -55,15 +51,16 @@ endif
pango_basic_xft_la_LDFLAGS = -export-dynamic -avoid-version -module
pango_basic_xft_la_LIBADD = $(pangoxftlibs)
-pango_basic_xft_la_SOURCES = basic-xft.c
-libpango_basic_xft_la_SOURCES = basic-xft.c
+pango_basic_xft_la_SOURCES = basic-fc.c
+pango_basic_xft_la_CFLAGS = -DBUILD_XFT
+libpango_basic_xft_la_SOURCES = basic-fc.c
+libpango_basic_xft_la_CFLAGS = -DBUILD_XFT -DPANGO_MODULE_PREFIX=_pango_basic_xft
if HAVE_FREETYPE
INCLUDES += $(FREETYPE_CFLAGS)
if INCLUDE_BASIC_FT2
noinst_LTLIBRARIES += libpango-basic-ft2.la
-INCLUDES += -DFT2_MODULE_PREFIX
else
module_LTLIBRARIES += pango-basic-ft2.la
endif
@@ -71,14 +68,15 @@ endif
pango_basic_ft2_la_LDFLAGS = -export-dynamic -avoid-version -module $(no_undefined)
pango_basic_ft2_la_LIBADD = $(pangoft2libs)
-pango_basic_ft2_la_SOURCES = basic-ft2.c
-libpango_basic_ft2_la_SOURCES = basic-ft2.c
+pango_basic_ft2_la_SOURCES = basic-fc.c
+pango_basic_ft2_la_CFLAGS = -DBUILD_FT2
+libpango_basic_ft2_la_SOURCES = basic-fc.c
+libpango_basic_ft2_la_CFLAGS = -DBUILD_FT2 -DPANGO_MODULE_PREFIX=_pango_basic_ft2
if HAVE_WIN32
if INCLUDE_BASIC_WIN32
noinst_LTLIBRARIES += libpango-basic-win32.la
-moddefine += -DWIN32_MODULE_PREFIX
else
module_LTLIBRARIES += pango-basic-win32.la
endif
@@ -88,6 +86,7 @@ pango_basic_win32_la_LDFLAGS = -export-dynamic -avoid-version -module $(no_undef
pango_basic_win32_la_LIBADD = $(pangowin32libs) -lgdi32
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_USP10_H
basic-win32.lo: usp10.h
diff --git a/modules/basic/basic-fc.c b/modules/basic/basic-fc.c
index cdc0db36..c9d64c9e 100644
--- a/modules/basic/basic-fc.c
+++ b/modules/basic/basic-fc.c
@@ -1,5 +1,5 @@
/* Pango
- * basic-xft.h:
+ * basic-fc.c: Basic shaper for FreeType-based backends
*
* Copyright (C) 2000 Red Hat Software
* Author: Owen Taylor <otaylor@redhat.com>
@@ -23,39 +23,65 @@
#include <string.h>
#include <glib/gprintf.h>
-#include "pangoxft.h"
#include "pango-engine.h"
#include "pango-utils.h"
#include "basic-common.h"
+#ifdef BUILD_XFT
+#include "pangoxft.h"
+#define SCRIPT_ENGINE_NAME "BasicScriptEngineXft"
+#define RENDER_TYPE PANGO_RENDER_TYPE_XFT
+#else /* FT2 */
+#include "pangoft2.h"
+#define SCRIPT_ENGINE_NAME "BasicScriptEngineFt2"
+#define RENDER_TYPE PANGO_RENDER_TYPE_FT2
+#endif
+
static PangoEngineRange basic_ranges[] = {
- /* Language characters */
- { 0x0380, 0x058f, "*" },
+ /* Basic Latin, Latin-1 Supplement, Latin Extended-A, Latin Extended-B,
+ * IPA Extensions
+ */
+ { 0x0000, 0x02af, "*" },
+ { 0x0380, 0x058f, "*" }, /* Greek, Cyrillic, Armenian */
{ 0x10a0, 0x10ff, "*" }, /* Georgian */
{ 0x1200, 0x16ff, "*" }, /* Ethiopic,Cherokee,Canadian,Ogham,Runic */
- { 0x1e00, 0x1fff, "*" },
- { 0x2000, 0x302d, "*" },
+ { 0x1e00, 0x1fff, "*" }, /* Latin Extended Additional, Greek Extended */
+
+ /* General Punctuation, Superscripts and Subscripts, Currency Symbols,
+ * Combining Marks for Symbols, Letterlike Symbols, Number Forms,
+ * Arrows, Mathematical Operators, Miscellaneous Technical,
+ * Control Pictures, Optical Character Recognition, Enclosed Alphanumerics,
+ * Box Drawing, Block Elements, Geometric Shapes, Miscellaneous Symbols,
+ * Dingbats, Braille Patterns, CJK Radicals Supplement, Kangxi Radicals,
+ * Ideographic Description Characters, CJK Symbols and Punctuation,
+ * Hiragana, Katakana, Bopomofo, Hangul Compatibility Jamo, Kanbun,
+ * Bopomofo Extended, Enclosed CJK Letters and Months, CJK Compatibility,
+ * CJK Unified Ideographs Extension A, CJK Unified Ideographs
+ */
+ { 0x2000, 0x3029, "*" }, /* Gap for Hangul diacritics */
{ 0x3030, 0x9fff, "*" },
{ 0xa000, 0xa4c6, "*" }, /* Yi */
{ 0xe000, 0xf7ee, "*" }, /* HKSCS-1999 */
{ 0xf900, 0xfa2d, "*" }, /* CJK Compatibility Ideographs */
{ 0xfe30, 0xfe6b, "*" }, /* CJK Compatibility Forms and Small Form Variants */
- { 0xff00, 0xffe3, "*" },
+ { 0xff00, 0xffe3, "*" }, /* Halfwidth and Fullwidth Forms (partly) */
{ 0x0000, 0xffff, "" },
};
static PangoEngineInfo script_engines[] = {
{
- "BasicScriptEngineXft",
+ SCRIPT_ENGINE_NAME,
PANGO_ENGINE_TYPE_SHAPE,
- PANGO_RENDER_TYPE_XFT,
+ RENDER_TYPE,
basic_ranges, G_N_ELEMENTS(basic_ranges)
}
};
static void
-swap_range (PangoGlyphString *glyphs, int start, int end)
+swap_range (PangoGlyphString *glyphs,
+ int start,
+ int end)
{
int i, j;
@@ -75,7 +101,11 @@ swap_range (PangoGlyphString *glyphs, int start, int end)
}
static void
-set_glyph (PangoFont *font, PangoGlyphString *glyphs, int i, int offset, PangoGlyph glyph)
+set_glyph (PangoFont *font,
+ PangoGlyphString *glyphs,
+ int i,
+ int offset,
+ PangoGlyph glyph)
{
PangoRectangle logical_rect;
@@ -88,6 +118,12 @@ set_glyph (PangoFont *font, PangoGlyphString *glyphs, int i, int offset, PangoGl
pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, NULL, &logical_rect);
glyphs->glyphs[i].geometry.width = logical_rect.width;
+
+ if (i > 0)
+ glyphs->glyphs[i-1].geometry.width +=
+ pango_fc_font_get_kerning ((PangoFcFont *)font,
+ glyphs->glyphs[i-1].glyph,
+ glyphs->glyphs[i].glyph);
}
static void
@@ -97,6 +133,7 @@ basic_engine_shape (PangoFont *font,
PangoAnalysis *analysis,
PangoGlyphString *glyphs)
{
+ PangoFcFont *fc_font = PANGO_FC_FONT (font);
int n_chars;
int i;
const char *p;
@@ -109,8 +146,10 @@ basic_engine_shape (PangoFont *font,
n_chars = g_utf8_strlen (text, length);
pango_glyph_string_set_size (glyphs, n_chars);
+ pango_fc_font_lock_face (fc_font);
+
p = text;
- for (i=0; i < n_chars; i++)
+ for (i = 0; i < n_chars; i++)
{
gunichar wc;
gunichar mirrored_ch;
@@ -131,29 +170,12 @@ basic_engine_shape (PangoFont *font,
}
else
{
- index = pango_xft_font_get_glyph (font, wc);
+ index = pango_fc_font_get_glyph (fc_font, wc);
if (!index)
{
set_glyph (font, glyphs, i, p - text,
- pango_xft_font_get_unknown_glyph (font, wc));
-
-#if 0
- gint j;
- char buf[9];
- int len = (wc < 65536) ? 6 : 8;
-
- g_sprintf (buf, "[%0*X]", len - 2, wc);
-
- n_chars += len - 1;
- pango_glyph_string_set_size (glyphs, n_chars);
- for (j=0; j < len; j++)
- {
- set_glyph (font, glyphs, i + j,
- p - text, find_char (face, font, buf[j]));
- }
- i += len - 1;
-#endif
+ pango_fc_font_get_unknown_glyph (fc_font, wc));
}
else
{
@@ -184,8 +206,9 @@ basic_engine_shape (PangoFont *font,
p = g_utf8_next_char (p);
}
- /* Simple bidi support... may have separate modules later */
-
+ /* Simple bidi support; most bidi languages (Arabic, Hebrew, Syriac)
+ * are in fact handled in other modules.
+ */
if (analysis->level % 2)
{
int start, end;
@@ -194,7 +217,7 @@ basic_engine_shape (PangoFont *font,
swap_range (glyphs, 0, n_chars);
/* Now reorder glyphs within each cluster back to LTR */
- for (start=0; start<n_chars;)
+ for (start = 0; start < n_chars;)
{
end = start;
while (end < n_chars &&
@@ -205,6 +228,8 @@ basic_engine_shape (PangoFont *font,
start = end;
}
}
+
+ pango_fc_font_unlock_face (fc_font);
}
static PangoCoverage *
@@ -215,13 +240,13 @@ basic_engine_get_coverage (PangoFont *font,
}
static PangoEngine *
-basic_engine_xft_new ()
+basic_engine_fc_new ()
{
PangoEngineShape *result;
result = g_new (PangoEngineShape, 1);
- result->engine.id = PANGO_RENDER_TYPE_XFT;
+ result->engine.id = SCRIPT_ENGINE_NAME;
result->engine.type = PANGO_ENGINE_TYPE_SHAPE;
result->engine.length = sizeof (result);
result->script_shape = basic_engine_shape;
@@ -230,23 +255,11 @@ basic_engine_xft_new ()
return (PangoEngine *)result;
}
-/* The following three functions provide the public module API for
- * Pango. If we are compiling it is a module, then we name the
- * entry points script_engine_list, etc. But if we are compiling
- * it for inclusion directly in Pango, then we need them to
- * to have distinct names for this module, so we prepend
- * _pango_basic_xft_
- */
-#ifdef XFT_MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_basic_xft_##func
-#else
-#define MODULE_ENTRY(func) func
-#endif
-
/* List the engines contained within this module
*/
void
-MODULE_ENTRY(script_engine_list) (PangoEngineInfo **engines, gint *n_engines)
+PANGO_MODULE_ENTRY(list) (PangoEngineInfo **engines,
+ int *n_engines)
{
*engines = script_engines;
*n_engines = G_N_ELEMENTS (script_engines);
@@ -255,15 +268,15 @@ MODULE_ENTRY(script_engine_list) (PangoEngineInfo **engines, gint *n_engines)
/* Load a particular engine given the ID for the engine
*/
PangoEngine *
-MODULE_ENTRY(script_engine_load) (const char *id)
+PANGO_MODULE_ENTRY(load) (const char *id)
{
- if (!strcmp (id, "BasicScriptEngineXft"))
- return basic_engine_xft_new ();
+ if (!strcmp (id, SCRIPT_ENGINE_NAME))
+ return basic_engine_fc_new ();
else
return NULL;
}
void
-MODULE_ENTRY(script_engine_unload) (PangoEngine *engine)
+PANGO_MODULE_ENTRY(unload) (PangoEngine *engine)
{
}
diff --git a/modules/basic/basic-ft2.c b/modules/basic/basic-ft2.c
deleted file mode 100644
index e1f65a42..00000000
--- a/modules/basic/basic-ft2.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/* Pango
- * basic-ft2.c:
- *
- * Copyright (C) 1999 Red Hat Software
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- */
-
-#include <glib.h>
-#include <string.h>
-
-#include "pango-layout.h"
-#include "pango-engine.h"
-#include "pangoft2.h"
-#include "pango-utils.h"
-
-#include "basic-common.h"
-
-#define SCRIPT_ENGINE_NAME "BasicScriptEngineFT2"
-
-
-static PangoEngineRange basic_ranges[] = {
- /* Basic Latin, Latin-1 Supplement, Latin Extended-A, Latin Extended-B,
- * IPA Extensions
- */
- { 0x0000, 0x02af, "*" },
-
- /* Spacing Modifier Letters */
- { 0x02b0, 0x02ff, "" },
-
- /* Not covered: Combining Diacritical Marks */
-
- /* Greek, Cyrillic, Armenian */
- { 0x0380, 0x058f, "*" },
-
- /* Hebrew */
- { 0x0591, 0x05f4, "" },
-
- /* Arabic */
- { 0x060c, 0x06f9, "" },
-
- /* Not covered: Syriac, Thaana, Devanagari, Bengali, Gurmukhi, Gujarati,
- * Oriya, Tamil, Telugu, Kannada, Malayalam, Sinhala
- */
-
- /* Thai */
- { 0x0e01, 0x0e5b, "" },
-
- /* Not covered: Lao, Tibetan, Myanmar, Georgian, Hangul Jamo, Ethiopic,
- * Cherokee, Unified Canadian Aboriginal Syllabics, Ogham, Runic,
- * Khmer, Mongolian
- */
-
- /* Latin Extended Additional, Greek Extended */
- { 0x1e00, 0x1fff, "*" },
-
- /* General Punctuation, Superscripts and Subscripts, Currency Symbols,
- * Combining Marks for Symbols, Letterlike Symbols, Number Forms,
- * Arrows, Mathematical Operators, Miscellaneous Technical,
- * Control Pictures, Optical Character Recognition, Enclosed Alphanumerics,
- * Box Drawing, Block Elements, Geometric Shapes, Miscellaneous Symbols,
- * Dingbats, Braille Patterns, CJK Radicals Supplement, Kangxi Radicals,
- * Ideographic Description Characters, CJK Symbols and Punctuation,
- * Hiragana, Katakana, Bopomofo, Hangul Compatibility Jamo, Kanbun,
- * Bopomofo Extended, Enclosed CJK Letters and Months, CJK Compatibility,
- * CJK Unified Ideographs Extension A, CJK Unified Ideographs
- */
- { 0x2000, 0x9fff, "*" },
-
- /* Not covered: Yi Syllables, Yi Radicals */
-
- /* Hangul Syllables */
- { 0xac00, 0xd7a3, "kr" },
-
- /* Not covered: Private Use */
-
- /* CJK Compatibility Ideographs (partly) */
- { 0xf900, 0xfa0b, "kr" },
-
- /* Not covered: CJK Compatibility Ideographs (partly),
- * Alphabetic Presentation Forms, Arabic Presentation Forms-A,
- * Combining Half Marks, CJK Compatibility Forms,
- * Small Form Variants, Arabic Presentation Forms-B,
- * Specials
- */
-
- /* Halfwidth and Fullwidth Forms (partly) */
- { 0xff00, 0xffe3, "*" }
-
- /* Not covered: Halfwidth and Fullwidth Forms, Specials */
-};
-
-static PangoEngineInfo script_engines[] = {
- {
- SCRIPT_ENGINE_NAME,
- PANGO_ENGINE_TYPE_SHAPE,
- PANGO_RENDER_TYPE_FT2,
- basic_ranges, G_N_ELEMENTS(basic_ranges)
- }
-};
-
-static gint n_script_engines = G_N_ELEMENTS (script_engines);
-
-/*
- * FT2 system script engine portion
- */
-
-static PangoGlyph
-find_char (PangoFont *font,
- gunichar wc)
-{
- FT_Face face;
- FT_UInt index;
-
- face = pango_ft2_font_get_face (font);
- index = FT_Get_Char_Index (face, wc);
- if (index && index <= face->num_glyphs)
- return index;
-
- return 0;
-}
-
-static void
-set_glyph (PangoFont *font,
- PangoGlyphString *glyphs,
- int i,
- int offset,
- PangoGlyph glyph)
-{
- PangoRectangle logical_rect;
-
- glyphs->glyphs[i].glyph = glyph;
-
- glyphs->glyphs[i].geometry.x_offset = 0;
- glyphs->glyphs[i].geometry.y_offset = 0;
-
- glyphs->log_clusters[i] = offset;
-
- pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, NULL, &logical_rect);
- glyphs->glyphs[i].geometry.width = logical_rect.width;
-
- if (i > 0)
- {
- glyphs->glyphs[i-1].geometry.width +=
- pango_ft2_font_get_kerning (font,
- glyphs->glyphs[i-1].glyph,
- glyphs->glyphs[i].glyph);
- }
-}
-
-static void
-swap_range (PangoGlyphString *glyphs,
- int start,
- int end)
-{
- int i, j;
-
- for (i = start, j = end - 1; i < j; i++, j--)
- {
- PangoGlyphInfo glyph_info;
- gint log_cluster;
-
- glyph_info = glyphs->glyphs[i];
- glyphs->glyphs[i] = glyphs->glyphs[j];
- glyphs->glyphs[j] = glyph_info;
-
- log_cluster = glyphs->log_clusters[i];
- glyphs->log_clusters[i] = glyphs->log_clusters[j];
- glyphs->log_clusters[j] = log_cluster;
- }
-}
-
-static void
-basic_engine_shape (PangoFont *font,
- const char *text,
- gint length,
- PangoAnalysis *analysis,
- PangoGlyphString *glyphs)
-{
- int n_chars;
- int i;
- const char *p;
-
- g_return_if_fail (font != NULL);
- g_return_if_fail (text != NULL);
- g_return_if_fail (length >= 0);
- g_return_if_fail (analysis != NULL);
-
- n_chars = g_utf8_strlen (text, length);
- pango_glyph_string_set_size (glyphs, n_chars);
-
- p = text;
- for (i = 0; i < n_chars; i++)
- {
- gunichar wc;
- gunichar mirrored_ch;
- PangoGlyph index;
-
- 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 (ZERO_WIDTH_CHAR (wc))
- {
- set_glyph (font, glyphs, i, p - text, 0);
- }
- else
- {
- index = find_char (font, wc);
- if (index)
- {
- set_glyph (font, glyphs, i, p - text, index);
-
- if (g_unichar_type (wc) == G_UNICODE_NON_SPACING_MARK)
- {
- if (i > 0)
- {
- PangoRectangle logical_rect, ink_rect;
-
- glyphs->glyphs[i].geometry.width = MAX (glyphs->glyphs[i-1].geometry.width,
- glyphs->glyphs[i].geometry.width);
- glyphs->glyphs[i-1].geometry.width = 0;
- glyphs->log_clusters[i] = glyphs->log_clusters[i-1];
-
- /* Some heuristics to try to guess how overstrike glyphs are
- * done and compensate
- */
- pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, &ink_rect, &logical_rect);
- if (logical_rect.width == 0 && ink_rect.x == 0)
- glyphs->glyphs[i].geometry.x_offset = (glyphs->glyphs[i].geometry.width - ink_rect.width) / 2;
- }
- }
- }
- else
- set_glyph (font, glyphs, i, p - text, pango_ft2_get_unknown_glyph (font));
- }
-
- p = g_utf8_next_char (p);
- }
-
- /* Simple bidi support... may have separate modules later */
-
- if (analysis->level % 2)
- {
- int start, end;
-
- /* Swap all glyphs */
- swap_range (glyphs, 0, n_chars);
-
- /* Now reorder glyphs within each cluster back to LTR */
- for (start = 0; start < n_chars;)
- {
- end = start;
- while (end < n_chars &&
- glyphs->log_clusters[end] == glyphs->log_clusters[start])
- end++;
-
- swap_range (glyphs, start, end);
- start = end;
- }
- }
-}
-
-static PangoCoverage *
-basic_engine_get_coverage (PangoFont *font,
- PangoLanguage *lang)
-{
- return pango_font_get_coverage (font, lang);
-}
-
-static PangoEngine *
-basic_engine_ft2_new (void)
-{
- PangoEngineShape *result;
-
- result = g_new (PangoEngineShape, 1);
-
- result->engine.id = SCRIPT_ENGINE_NAME;
- result->engine.type = PANGO_ENGINE_TYPE_SHAPE;
- result->engine.length = sizeof (result);
- result->script_shape = basic_engine_shape;
- result->get_coverage = basic_engine_get_coverage;
-
- return (PangoEngine *)result;
-}
-
-/* The following three functions provide the public module API for
- * Pango
- */
-#ifdef FT2_MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_basic_ft2_##func
-#else
-#define MODULE_ENTRY(func) func
-#endif
-
-void
-MODULE_ENTRY(script_engine_list) (PangoEngineInfo **engines,
- gint *n_engines)
-{
- *engines = script_engines;
- *n_engines = n_script_engines;
-}
-
-PangoEngine *
-MODULE_ENTRY(script_engine_load) (const char *id)
-{
- if (!strcmp (id, SCRIPT_ENGINE_NAME))
- return basic_engine_ft2_new ();
- else
- return NULL;
-}
-
-void
-MODULE_ENTRY(script_engine_unload) (PangoEngine *engine)
-{
-}
-
diff --git a/modules/basic/basic-win32.c b/modules/basic/basic-win32.c
index 1b5cf8b2..83fa12ca 100644
--- a/modules/basic/basic-win32.c
+++ b/modules/basic/basic-win32.c
@@ -1067,18 +1067,9 @@ init_uniscribe (void)
#endif
}
-/* The following three functions provide the public module API for
- * Pango
- */
-#ifdef WIN32_MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_basic_win32_##func
-#else
-#define MODULE_ENTRY(func) func
-#endif
-
void
-MODULE_ENTRY(script_engine_list) (PangoEngineInfo **engines,
- gint *n_engines)
+PANGO_MODULE_ENTRY(list) (PangoEngineInfo **engines,
+ gint *n_engines)
{
init_uniscribe ();
@@ -1115,7 +1106,7 @@ MODULE_ENTRY(script_engine_list) (PangoEngineInfo **engines,
}
PangoEngine *
-MODULE_ENTRY(script_engine_load) (const char *id)
+PANGO_MODULE_ENTRY(load) (const char *id)
{
init_uniscribe ();
@@ -1129,6 +1120,6 @@ MODULE_ENTRY(script_engine_load) (const char *id)
}
void
-MODULE_ENTRY(script_engine_unload) (PangoEngine *engine)
+PANGO_MODULE_ENTRY(unload) (PangoEngine *engine)
{
}
diff --git a/modules/basic/basic-x.c b/modules/basic/basic-x.c
index 2cce3046..686b85e7 100644
--- a/modules/basic/basic-x.c
+++ b/modules/basic/basic-x.c
@@ -715,24 +715,16 @@ basic_engine_x_new ()
return (PangoEngine *)result;
}
-/* The following three functions provide the public module API for
- * Pango
- */
-#ifdef X_MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_basic_x_##func
-#else
-#define MODULE_ENTRY(func) func
-#endif
-
void
-MODULE_ENTRY(script_engine_list) (PangoEngineInfo **engines, gint *n_engines)
+PANGO_MODULE_ENTRY(list) (PangoEngineInfo **engines,
+ int *n_engines)
{
*engines = script_engines;
*n_engines = n_script_engines;
}
PangoEngine *
-MODULE_ENTRY(script_engine_load) (const char *id)
+PANGO_MODULE_ENTRY(load) (const char *id)
{
if (!strcmp (id, SCRIPT_ENGINE_NAME))
return basic_engine_x_new ();
@@ -741,7 +733,7 @@ MODULE_ENTRY(script_engine_load) (const char *id)
}
void
-MODULE_ENTRY(script_engine_unload) (PangoEngine *engine)
+PANGO_MODULE_ENTRY(unload) (PangoEngine *engine)
{
}
diff --git a/modules/basic/basic-xft.c b/modules/basic/basic-xft.c
deleted file mode 100644
index cdc0db36..00000000
--- a/modules/basic/basic-xft.c
+++ /dev/null
@@ -1,269 +0,0 @@
-/* Pango
- * basic-xft.h:
- *
- * Copyright (C) 2000 Red Hat Software
- * Author: Owen Taylor <otaylor@redhat.com>
- *
- * 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 <string.h>
-
-#include <glib/gprintf.h>
-#include "pangoxft.h"
-#include "pango-engine.h"
-#include "pango-utils.h"
-
-#include "basic-common.h"
-
-static PangoEngineRange basic_ranges[] = {
- /* Language characters */
- { 0x0380, 0x058f, "*" },
- { 0x10a0, 0x10ff, "*" }, /* Georgian */
- { 0x1200, 0x16ff, "*" }, /* Ethiopic,Cherokee,Canadian,Ogham,Runic */
- { 0x1e00, 0x1fff, "*" },
- { 0x2000, 0x302d, "*" },
- { 0x3030, 0x9fff, "*" },
- { 0xa000, 0xa4c6, "*" }, /* Yi */
- { 0xe000, 0xf7ee, "*" }, /* HKSCS-1999 */
- { 0xf900, 0xfa2d, "*" }, /* CJK Compatibility Ideographs */
- { 0xfe30, 0xfe6b, "*" }, /* CJK Compatibility Forms and Small Form Variants */
- { 0xff00, 0xffe3, "*" },
- { 0x0000, 0xffff, "" },
-};
-
-static PangoEngineInfo script_engines[] = {
- {
- "BasicScriptEngineXft",
- PANGO_ENGINE_TYPE_SHAPE,
- PANGO_RENDER_TYPE_XFT,
- basic_ranges, G_N_ELEMENTS(basic_ranges)
- }
-};
-
-static void
-swap_range (PangoGlyphString *glyphs, int start, int end)
-{
- int i, j;
-
- for (i = start, j = end - 1; i < j; i++, j--)
- {
- PangoGlyphInfo glyph_info;
- gint log_cluster;
-
- glyph_info = glyphs->glyphs[i];
- glyphs->glyphs[i] = glyphs->glyphs[j];
- glyphs->glyphs[j] = glyph_info;
-
- log_cluster = glyphs->log_clusters[i];
- glyphs->log_clusters[i] = glyphs->log_clusters[j];
- glyphs->log_clusters[j] = log_cluster;
- }
-}
-
-static void
-set_glyph (PangoFont *font, PangoGlyphString *glyphs, int i, int offset, PangoGlyph glyph)
-{
- PangoRectangle logical_rect;
-
- glyphs->glyphs[i].glyph = glyph;
-
- glyphs->glyphs[i].geometry.x_offset = 0;
- glyphs->glyphs[i].geometry.y_offset = 0;
-
- glyphs->log_clusters[i] = offset;
-
- pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, NULL, &logical_rect);
- glyphs->glyphs[i].geometry.width = logical_rect.width;
-}
-
-static void
-basic_engine_shape (PangoFont *font,
- const char *text,
- gint length,
- PangoAnalysis *analysis,
- PangoGlyphString *glyphs)
-{
- int n_chars;
- int i;
- const char *p;
-
- g_return_if_fail (font != NULL);
- g_return_if_fail (text != NULL);
- g_return_if_fail (length >= 0);
- g_return_if_fail (analysis != NULL);
-
- n_chars = g_utf8_strlen (text, length);
- pango_glyph_string_set_size (glyphs, n_chars);
-
- p = text;
- for (i=0; i < n_chars; i++)
- {
- gunichar wc;
- gunichar mirrored_ch;
- PangoGlyph index;
-
- 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 (ZERO_WIDTH_CHAR (wc))
- {
- set_glyph (font, glyphs, i, p - text, 0);
- }
- else
- {
- index = pango_xft_font_get_glyph (font, wc);
-
- if (!index)
- {
- set_glyph (font, glyphs, i, p - text,
- pango_xft_font_get_unknown_glyph (font, wc));
-
-#if 0
- gint j;
- char buf[9];
- int len = (wc < 65536) ? 6 : 8;
-
- g_sprintf (buf, "[%0*X]", len - 2, wc);
-
- n_chars += len - 1;
- pango_glyph_string_set_size (glyphs, n_chars);
- for (j=0; j < len; j++)
- {
- set_glyph (font, glyphs, i + j,
- p - text, find_char (face, font, buf[j]));
- }
- i += len - 1;
-#endif
- }
- else
- {
- set_glyph (font, glyphs, i, p - text, index);
-
- if (g_unichar_type (wc) == G_UNICODE_NON_SPACING_MARK)
- {
- if (i > 0)
- {
- PangoRectangle logical_rect, ink_rect;
-
- glyphs->glyphs[i].geometry.width = MAX (glyphs->glyphs[i-1].geometry.width,
- glyphs->glyphs[i].geometry.width);
- glyphs->glyphs[i-1].geometry.width = 0;
- glyphs->log_clusters[i] = glyphs->log_clusters[i-1];
-
- /* Some heuristics to try to guess how overstrike glyphs are
- * done and compensate
- */
- pango_font_get_glyph_extents (font, glyphs->glyphs[i].glyph, &ink_rect, &logical_rect);
- if (logical_rect.width == 0 && ink_rect.x == 0)
- glyphs->glyphs[i].geometry.x_offset = (glyphs->glyphs[i].geometry.width - ink_rect.width) / 2;
- }
- }
- }
- }
-
- p = g_utf8_next_char (p);
- }
-
- /* Simple bidi support... may have separate modules later */
-
- if (analysis->level % 2)
- {
- int start, end;
-
- /* Swap all glyphs */
- swap_range (glyphs, 0, n_chars);
-
- /* Now reorder glyphs within each cluster back to LTR */
- for (start=0; start<n_chars;)
- {
- end = start;
- while (end < n_chars &&
- glyphs->log_clusters[end] == glyphs->log_clusters[start])
- end++;
-
- swap_range (glyphs, start, end);
- start = end;
- }
- }
-}
-
-static PangoCoverage *
-basic_engine_get_coverage (PangoFont *font,
- PangoLanguage *lang)
-{
- return pango_font_get_coverage (font, lang);
-}
-
-static PangoEngine *
-basic_engine_xft_new ()
-{
- PangoEngineShape *result;
-
- result = g_new (PangoEngineShape, 1);
-
- result->engine.id = PANGO_RENDER_TYPE_XFT;
- result->engine.type = PANGO_ENGINE_TYPE_SHAPE;
- result->engine.length = sizeof (result);
- result->script_shape = basic_engine_shape;
- result->get_coverage = basic_engine_get_coverage;
-
- return (PangoEngine *)result;
-}
-
-/* The following three functions provide the public module API for
- * Pango. If we are compiling it is a module, then we name the
- * entry points script_engine_list, etc. But if we are compiling
- * it for inclusion directly in Pango, then we need them to
- * to have distinct names for this module, so we prepend
- * _pango_basic_xft_
- */
-#ifdef XFT_MODULE_PREFIX
-#define MODULE_ENTRY(func) _pango_basic_xft_##func
-#else
-#define MODULE_ENTRY(func) func
-#endif
-
-/* List the engines contained within this module
- */
-void
-MODULE_ENTRY(script_engine_list) (PangoEngineInfo **engines, gint *n_engines)
-{
- *engines = script_engines;
- *n_engines = G_N_ELEMENTS (script_engines);
-}
-
-/* Load a particular engine given the ID for the engine
- */
-PangoEngine *
-MODULE_ENTRY(script_engine_load) (const char *id)
-{
- if (!strcmp (id, "BasicScriptEngineXft"))
- return basic_engine_xft_new ();
- else
- return NULL;
-}
-
-void
-MODULE_ENTRY(script_engine_unload) (PangoEngine *engine)
-{
-}