Engines

## Engines Engines — Language-specific and rendering-system-specific processing |

## Synopsis

    struct              PangoEngineInfo;
    struct              PangoEngineScriptInfo;
    struct              PangoEngine;
    struct              PangoEngineClass;
    #define             PANGO_RENDER_TYPE_NONE
    void                script_engine_list                  (PangoEngineInfo **engines,
                                                             int *n_engines);
    void                script_engine_init                  (GTypeModule *module);
    void                script_engine_exit                  (void);
    PangoEngine *       script_engine_create                (const char *id);

## Object Hierarchy

      GObject
       +----PangoEngine
             +----PangoEngineLang
             +----PangoEngineShape

## Description

Pango utilizes a module architecture in which the language-specific and render-system-specific components are provided by loadable modules. Each loadable module supplies one or more engines. Each engine has an associated engine type and render type. These two types are represented by strings.

Each dynamically-loaded module exports several functions which provide the public API. These functions are `script_engine_list()`, `script_engine_init()` and script_engine_exit, and `script_engine_create()`. The latter three functions are used when creating engines from the module at run time, while the first function is used when building a catalog of all available modules.

## Details

### struct PangoEngineInfo

    struct PangoEngineInfo {
      const gchar *id;
      const gchar *engine_type;
      const gchar *render_type;
      PangoEngineScriptInfo *scripts;
      gint n_scripts;
    };

The PangoEngineInfo structure contains information about a particular engine. It contains the following fields:

const gchar *`id`; | a unique string ID for the engine.
const gchar *`engine_type`; | a string identifying the engine type.
const gchar *`render_type`; | a string identifying the render type.
PangoEngineScriptInfo *`scripts`; | array of scripts this engine supports.
gint `n_scripts`; | number of items in `scripts`.

### struct PangoEngineScriptInfo

    struct PangoEngineScriptInfo {
      PangoScript script;
      const gchar *langs;
    };

The PangoEngineScriptInfo structure contains information about how the shaper covers a particular script.

PangoScript `script`; | a PangoScript. The value `PANGO_SCRIPT_COMMON` has the special meaning here of "all scripts"
const gchar *`langs`; | a semicolon separated list of languages that this engine handles for this script. This may be empty, in which case the engine is saying that it is a fallback choice for all languages for this range, but should not be used if another engine indicates that it is specific for the language for a given code point. An entry in this list of "*" indicates that this engine is specific to all languages for this range.

### struct PangoEngine

    struct PangoEngine;

PangoEngine is the base class for all types of language and script specific engines. It has no functionality by itself.

### struct PangoEngineClass

    struct PangoEngineClass {
    };

Class structure for PangoEngine

### PANGO_RENDER_TYPE_NONE

    #define PANGO_RENDER_TYPE_NONE "PangoRenderNone"

A string constant defining the render type for engines that are not rendering-system specific.

### script_engine_list ()

    void                script_engine_list                  (PangoEngineInfo **engines,
                                                             int *n_engines);

Function to be provided by a module to list the engines that the module supplies. The function stores a pointer to an array of PangoEngineInfo structures and the length of that array in the given location.

Note that `script_engine_init()` will not be called before this function.

`engines` : | location to store a pointer to an array of engines.
`n_engines` : | location to store the number of elements in `engines`.

### script_engine_init ()

    void                script_engine_init                  (GTypeModule *module);

Function to be provided by a module to register any GObject types in the module.

`module` : | a GTypeModule structure used to associate any GObject types created in this module with the module.

### script_engine_exit ()

    void                script_engine_exit                  (void);

Function to be provided by the module that is called when the module is unloading. Frequently does nothing.

### script_engine_create ()

    PangoEngine *       script_engine_create                (const char *id);

Function to be provided by the module to create an instance of one of the engines implemented by the module.

`id` : | the ID of an engine as reported by script_engine_list.
Returns : | a newly created PangoEngine of the specified type, or `NULL` if an error occurred. (In normal operation, a module should not return `NULL`. A `NULL` return is only acceptable in the case where system misconfiguration or bugs in the driver routine are encountered.)