summaryrefslogtreecommitdiff
path: root/modules/indic
diff options
context:
space:
mode:
authorOwen Taylor <otaylor@redhat.com>2003-08-03 21:57:35 +0000
committerOwen Taylor <otaylor@src.gnome.org>2003-08-03 21:57:35 +0000
commit2584212cd0976f5f95d9381e829917e7d2a10d28 (patch)
tree5773e9f6802f8316c5c7463aa55677babe67343c /modules/indic
parent95a8d1788e884b7d8d29d4171a1adc51c61e880e (diff)
downloadpango-2584212cd0976f5f95d9381e829917e7d2a10d28.tar.gz
Make PangoEngine{,Lang,Shape} GObjects, and use a GTypeModule-based
Sat Aug 2 23:19:16 2003 Owen Taylor <otaylor@redhat.com> * pango/pango-engine.[ch] modules/*/*-{fc,win32,x}.c pango/modules.c pango/break.c pango/pango-context.c pango/pango-layout.c pango/pango-modules.h pango/querymodules.c pango/shape.c: Make PangoEngine{,Lang,Shape} GObjects, and use a GTypeModule-based module-loading system closely based on the one used for GtkIMContext and GtkThemeEngine. * pango/pango-impl-utils.h: OK, I'm tired of typing in get_type() functions. * pango/pango-script.[ch] pango/pango-script-table.h tests/testscript.c tools/gen-script-table.pl: Add port of script-range code from ICU in preparation for future use. (#91542) * tools/gen-script-for-lang.c: Utility program to determine the script for each fontconfig .orth file. * docs/tmpl/{scripts.sgml,pango-engine-lang.sgml, pango-engine-shape.sgml} docs/pango-sections.txt docs/pango-docs.sgml: Redo to go along with the above changes. * configure.in: chmod +x tests/runtests.sh
Diffstat (limited to 'modules/indic')
-rw-r--r--modules/indic/indic-fc.c66
1 files changed, 27 insertions, 39 deletions
diff --git a/modules/indic/indic-fc.c b/modules/indic/indic-fc.c
index bd4c8f4b..f70fadfb 100644
--- a/modules/indic/indic-fc.c
+++ b/modules/indic/indic-fc.c
@@ -28,11 +28,14 @@
#include "pango-engine.h"
#include "pango-ot.h"
#include "pango-utils.h"
+#include "pangofc-font.h"
-typedef struct _PangoEngineShapeIndic PangoEngineShapeIndic;
typedef struct _PangoIndicInfo PangoIndicInfo;
-struct _PangoEngineShapeIndic
+typedef struct _IndicEngineFc IndicEngineFc;
+typedef PangoEngineShapeClass IndicEngineFcClass ; /* No extra fields needed */
+
+struct _IndicEngineFc
{
PangoEngineShape shapeEngine;
PangoIndicInfo *indicInfo;
@@ -46,7 +49,6 @@ struct _PangoIndicInfo
gchar *gposQuarkName;
};
-#include "pangofc-font.h"
#define ENGINE_SUFFIX "ScriptEngineFc"
#define RENDER_TYPE PANGO_RENDER_TYPE_FC
@@ -291,7 +293,8 @@ expand_text(const gchar *text, glong length, glong **offsets, glong *n_chars)
/* analysis->shape_engine has the PangoEngine... */
static void
-indic_engine_shape (PangoFont *font,
+indic_engine_shape (PangoEngineShape *engine,
+ PangoFont *font,
const char *text,
gint length,
PangoAnalysis *analysis,
@@ -304,7 +307,7 @@ indic_engine_shape (PangoFont *font,
glong *indices = NULL;
FT_Face face;
PangoOTRuleset *gsub_ruleset = NULL, *gpos_ruleset = NULL;
- PangoEngineShapeIndic *indic_shape_engine = NULL;
+ IndicEngineFc *indic_shape_engine = NULL;
PangoIndicInfo *indic_info = NULL;
PangoFcFont *fc_font;
MPreFixups *mprefixups;
@@ -318,11 +321,7 @@ indic_engine_shape (PangoFont *font,
face = pango_fc_font_lock_face (fc_font);
g_assert (face != NULL);
- indic_shape_engine = (PangoEngineShapeIndic *) analysis->shape_engine;
-
-#if 1
- g_assert (indic_shape_engine->shapeEngine.engine.length == sizeof (PangoEngineShapeIndic));
-#endif
+ indic_shape_engine = (IndicEngineFc *) engine;
indic_info = indic_shape_engine->indicInfo;
@@ -400,33 +399,26 @@ indic_engine_shape (PangoFont *font,
g_free (utf8_offsets);
}
-static PangoCoverage *
-indic_engine_get_coverage (PangoFont *font,
- PangoLanguage *lang)
+static void
+indic_engine_fc_class_init (PangoEngineShapeClass *class)
{
- return pango_font_get_coverage (font, lang);
+ class->script_shape = indic_engine_shape;
}
-static PangoEngine *
-indic_engine_fc_new (gint index)
-{
- PangoEngineShapeIndic *result;
-
- result = g_new (PangoEngineShapeIndic, 1);
-
- result->shapeEngine.engine.id = script_engines[index].id;
- result->shapeEngine.engine.type = PANGO_ENGINE_TYPE_SHAPE;
- result->shapeEngine.engine.length = sizeof (*result);
- result->shapeEngine.script_shape = indic_engine_shape;
- result->shapeEngine.get_coverage = indic_engine_get_coverage;
+PANGO_ENGINE_SHAPE_DEFINE_TYPE (IndicEngineFc, indic_engine_fc,
+ indic_engine_fc_class_init, NULL);
- result->indicInfo = &indic_info[index];
+void
+PANGO_MODULE_ENTRY(init) (GTypeModule *module)
+{
+ indic_engine_fc_register_type (module);
+}
- return (PangoEngine *)result;
+void
+PANGO_MODULE_ENTRY(exit) (void)
+{
}
-/* List the engines contained within this module
- */
void
PANGO_MODULE_ENTRY(list) (PangoEngineInfo **engines,
int *n_engines)
@@ -435,10 +427,8 @@ PANGO_MODULE_ENTRY(list) (PangoEngineInfo **engines,
*n_engines = G_N_ELEMENTS (script_engines);
}
-/* Load a particular engine given the ID for the engine
- */
PangoEngine *
-PANGO_MODULE_ENTRY(load) (const char *id)
+PANGO_MODULE_ENTRY(create) (const char *id)
{
gint i;
@@ -446,14 +436,12 @@ PANGO_MODULE_ENTRY(load) (const char *id)
{
if (!strcmp(id, script_engines[i].id))
{
- return indic_engine_fc_new(i);
+ IndicEngineFc *engine = g_object_new (indic_engine_fc_type, NULL);
+ engine->indicInfo = &indic_info[i];
+
+ return (PangoEngine *)engine;
}
}
return NULL;
}
-
-void
-PANGO_MODULE_ENTRY(unload) (PangoEngine *engine)
-{
-}