SynopsisPangoContext; PangoItem; PangoAnalysis; #define PANGO_ANALYSIS_FLAG_CENTERED_BASELINE #define PANGO_TYPE_DIRECTION GList* pango_itemize (PangoContext *context, const char *text, int start_index, int length, PangoAttrList *attrs, PangoAttrIterator *cached_iter); GList* pango_itemize_with_base_dir (PangoContext *context, PangoDirection base_dir, const char *text, int start_index, int length, PangoAttrList *attrs, PangoAttrIterator *cached_iter); void pango_item_free (PangoItem *item); PangoItem* pango_item_copy (PangoItem *item); PangoItem* pango_item_new (void); PangoItem* pango_item_split (PangoItem *orig, int split_index, int split_offset); GList* pango_reorder_items (GList *logical_items); PangoContext* pango_context_new (void); void pango_context_set_font_map (PangoContext *context, PangoFontMap *font_map); PangoFontMap* pango_context_get_font_map (PangoContext *context); PangoFontDescription* pango_context_get_font_description (PangoContext *context); void pango_context_set_font_description (PangoContext *context, const PangoFontDescription *desc); PangoLanguage* pango_context_get_language (PangoContext *context); void pango_context_set_language (PangoContext *context, PangoLanguage *language); PangoDirection pango_context_get_base_dir (PangoContext *context); void pango_context_set_base_dir (PangoContext *context, PangoDirection direction); PangoGravity pango_context_get_base_gravity (PangoContext *context); void pango_context_set_base_gravity (PangoContext *context, PangoGravity gravity); PangoGravity pango_context_get_gravity (PangoContext *context); PangoGravityHint pango_context_get_gravity_hint (PangoContext *context); void pango_context_set_gravity_hint (PangoContext *context, PangoGravityHint hint); const PangoMatrix* pango_context_get_matrix (PangoContext *context); void pango_context_set_matrix (PangoContext *context, const PangoMatrix *matrix); PangoFont* pango_context_load_font (PangoContext *context, const PangoFontDescription *desc); PangoFontset* pango_context_load_fontset (PangoContext *context, const PangoFontDescription *desc, PangoLanguage *language); PangoFontMetrics* pango_context_get_metrics (PangoContext *context, const PangoFontDescription *desc, PangoLanguage *language); void pango_context_list_families (PangoContext *context, PangoFontFamily ***families, int *n_families); void pango_break (const gchar *text, int length, PangoAnalysis *analysis, PangoLogAttr *attrs, int attrs_len); void pango_get_log_attrs (const char *text, int length, int level, PangoLanguage *language, PangoLogAttr *log_attrs, int attrs_len); void pango_find_paragraph_boundary (const gchar *text, gint length, gint *paragraph_delimiter_index, gint *next_paragraph_start); void pango_default_break (const gchar *text, int length, PangoAnalysis *analysis, PangoLogAttr *attrs, int attrs_len); PangoLogAttr; void pango_shape (const gchar *text, gint length, const PangoAnalysis *analysis, PangoGlyphString *glyphs); DescriptionThe Pango rendering pipeline takes a string of Unicode characters and converts it into glyphs. The functions described in this section accomplish various steps of this process. DetailsPangoContexttypedef struct _PangoContext PangoContext; The PangoContext structure stores global information used to control the itemization process. PangoItemtypedef struct { gint offset; gint length; gint num_chars; PangoAnalysis analysis; } PangoItem; The PangoItem structure stores information about a segment of text. It contains the following fields:
PangoAnalysistypedef struct { PangoEngineShape *shape_engine; PangoEngineLang *lang_engine; PangoFont *font; guint8 level; guint8 gravity; /* PangoGravity */ guint8 flags; guint8 script; /* PangoScript */ PangoLanguage *language; GSList *extra_attrs; } PangoAnalysis; The PangoAnalysis structure stores information about the properties of a segment of text. It has the following fields:
PANGO_ANALYSIS_FLAG_CENTERED_BASELINE#define PANGO_ANALYSIS_FLAG_CENTERED_BASELINE (1 << 0) Whether the segment should be shifted to center around the baseline. Used in vertical writing directions mostly. Since: 1.16 PANGO_TYPE_DIRECTION#define PANGO_TYPE_DIRECTION (pango_direction_get_type()) The GObject type for PangoDirection. pango_itemize ()GList* pango_itemize (PangoContext *context, const char *text, int start_index, int length, PangoAttrList *attrs, PangoAttrIterator *cached_iter);
Breaks a piece of text into segments with consistent
directional level and shaping engine. Each byte of
pango_itemize_with_base_dir ()GList* pango_itemize_with_base_dir (PangoContext *context, PangoDirection base_dir, const char *text, int start_index, int length, PangoAttrList *attrs, PangoAttrIterator *cached_iter);
Like
Since 1.4 pango_item_free ()void pango_item_free (PangoItem *item); Free a PangoItem and all associated memory.
pango_item_copy ()PangoItem* pango_item_copy (PangoItem *item); Copy an existing PangoItem structure.
pango_item_new ()PangoItem* pango_item_new (void); Creates a new PangoItem structure initialized to default values.
pango_item_split ()PangoItem* pango_item_split (PangoItem *orig, int split_index, int split_offset);
Modifies
pango_reorder_items ()GList* pango_reorder_items (GList *logical_items); From a list of items in logical order and the associated directional levels, produce a list in visual order. The original list is unmodified.
pango_context_new ()PangoContext* pango_context_new (void); Creates a new PangoContext initialized to default values.
This function is not particularly useful as it should always
be followed by a
If you are using Pango as part of a higher-level system,
that system may have it's own way of create a PangoContext.
For instance, the GTK+ toolkit has, among others,
pango_context_set_font_map ()void pango_context_set_font_map (PangoContext *context, PangoFontMap *font_map); Sets the font map to be searched when fonts are looked-up in this context. This is only for internal use by Pango backends, a PangoContext obtained via one of the recommended methods should already have a suitable font map.
pango_context_get_font_map ()PangoFontMap* pango_context_get_font_map (PangoContext *context); Gets the PangoFontmap used to look up fonts for this context.
Since 1.6 pango_context_get_font_description ()PangoFontDescription* pango_context_get_font_description (PangoContext *context); Retrieve the default font description for the context.
pango_context_set_font_description ()void pango_context_set_font_description (PangoContext *context, const PangoFontDescription *desc); Set the default font description for the context
pango_context_get_language ()PangoLanguage* pango_context_get_language (PangoContext *context); Retrieves the global language tag for the context.
pango_context_set_language ()void pango_context_set_language (PangoContext *context, PangoLanguage *language);
Sets the global language tag for the context. The default language
for the locale of the running process can be found using
pango_context_get_base_dir ()PangoDirection pango_context_get_base_dir (PangoContext *context);
Retrieves the base direction for the context. See
pango_context_set_base_dir ()void pango_context_set_base_dir (PangoContext *context, PangoDirection direction); Sets the base direction for the context.
The base direction is used in applying the Unicode bidirectional
algorithm; if the
pango_context_get_base_gravity ()PangoGravity pango_context_get_base_gravity (PangoContext *context);
Retrieves the base gravity for the context. See
Since 1.16 pango_context_set_base_gravity ()void pango_context_set_base_gravity (PangoContext *context, PangoGravity gravity); Sets the base gravity for the context. The base gravity is used in laying vertical text out.
Since 1.16 pango_context_get_gravity ()PangoGravity pango_context_get_gravity (PangoContext *context);
Retrieves the gravity for the context. This is similar to
Since 1.16 pango_context_get_gravity_hint ()PangoGravityHint pango_context_get_gravity_hint (PangoContext *context);
Retrieves the gravity hint for the context. See
Since 1.16 pango_context_set_gravity_hint ()void pango_context_set_gravity_hint (PangoContext *context, PangoGravityHint hint); Sets the gravity hint for the context.
The gravity hint is used in laying vertical text out, and is only relevant
if gravity of the context as returned by
Since 1.16 pango_context_get_matrix ()const PangoMatrix* pango_context_get_matrix (PangoContext *context);
Gets the transformation matrix that will be applied when
rendering with this context. See
Since 1.6 pango_context_set_matrix ()void pango_context_set_matrix (PangoContext *context, const PangoMatrix *matrix); Sets the transformation matrix that will be applied when rendering with this context. Note that reported metrics are in the user space coordinates before the application of the matrix, not device-space coordinates after the application of the matrix. So, they don't scale with the matrix, though they may change slightly for different matrices, depending on how the text is fit to the pixel grid.
Since 1.6 pango_context_load_font ()PangoFont* pango_context_load_font (PangoContext *context, const PangoFontDescription *desc);
Loads the font in one of the fontmaps in the context
that is the closest match for
pango_context_load_fontset ()PangoFontset* pango_context_load_fontset (PangoContext *context, const PangoFontDescription *desc, PangoLanguage *language);
Load a set of fonts in the context that can be used to render
a font matching
pango_context_get_metrics ()PangoFontMetrics* pango_context_get_metrics (PangoContext *context, const PangoFontDescription *desc, PangoLanguage *language); Get overall metric information for a particular font description. Since the metrics may be substantially different for different scripts, a language tag can be provided to indicate that the metrics should be retrieved that correspond to the script(s) used by that language.
The PangoFontDescription is interpreted in the same way as
by
pango_context_list_families ()void pango_context_list_families (PangoContext *context, PangoFontFamily ***families, int *n_families); List all families for a context.
pango_break ()void pango_break (const gchar *text, int length, PangoAnalysis *analysis, PangoLogAttr *attrs, int attrs_len);
Determines possible line, word, and character breaks
for a string of Unicode text with a single analysis. For most
purposes you may want to use
pango_get_log_attrs ()void pango_get_log_attrs (const char *text, int length, int level, PangoLanguage *language, PangoLogAttr *log_attrs, int attrs_len);
Computes a PangoLogAttr for each character in
pango_find_paragraph_boundary ()void pango_find_paragraph_boundary (const gchar *text, gint length, gint *paragraph_delimiter_index, gint *next_paragraph_start);
Locates a paragraph boundary in
If no delimiters are found, both
pango_default_break ()void pango_default_break (const gchar *text, int length, PangoAnalysis *analysis, PangoLogAttr *attrs, int attrs_len);
This is the default break algorithm, used if no language
engine overrides it. Normally you should use
PangoLogAttrtypedef struct { guint is_line_break : 1; /* Can break line in front of character */ guint is_mandatory_break : 1; /* Must break line in front of character */ guint is_char_break : 1; /* Can break here when doing char wrap */ guint is_white : 1; /* Whitespace character */ /* Cursor can appear in front of character (i.e. this is a grapheme * boundary, or the first character in the text). */ guint is_cursor_position : 1; /* Note that in degenerate cases, you could have both start/end set on * some text, most likely for sentences (e.g. no space after a period, so * the next sentence starts right away). */ guint is_word_start : 1; /* first character in a word */ guint is_word_end : 1; /* is first non-word char after a word */ /* There are two ways to divide sentences. The first assigns all * intersentence whitespace/control/format chars to some sentence, * so all chars are in some sentence; is_sentence_boundary denotes * the boundaries there. The second way doesn't assign * between-sentence spaces, etc. to any sentence, so * is_sentence_start/is_sentence_end mark the boundaries of those * sentences. */ guint is_sentence_boundary : 1; guint is_sentence_start : 1; /* first character in a sentence */ guint is_sentence_end : 1; /* first non-sentence char after a sentence */ /* If set, backspace deletes one character rather than * the entire grapheme cluster. */ guint backspace_deletes_character : 1; /* Only few space variants (U+0020 and U+00A0) have variable * width during justification. */ guint is_expandable_space : 1; /* Word boundary as defined by UAX#29 */ guint is_word_boundary : 1; /* is NOT in the middle of a word */ } PangoLogAttr; The PangoLogAttr structure stores information about the attributes of a single character.
pango_shape ()void pango_shape (const gchar *text, gint length, const PangoAnalysis *analysis, PangoGlyphString *glyphs);
Given a segment of text and the corresponding
PangoAnalysis structure returned from
|