Synopsis#define PANGO_SCALE #define PANGO_PIXELS (d) #define PANGO_PIXELS_FLOOR (d) #define PANGO_PIXELS_CEIL (d) #define PANGO_UNITS_ROUND (d) double pango_units_to_double (int i); int pango_units_from_double (double d); PangoRectangle; #define PANGO_ASCENT (rect) #define PANGO_DESCENT (rect) #define PANGO_LBEARING (rect) #define PANGO_RBEARING (rect) void pango_extents_to_pixels (PangoRectangle *inclusive, PangoRectangle *nearest); PangoMatrix; #define PANGO_TYPE_MATRIX #define PANGO_MATRIX_INIT PangoMatrix* pango_matrix_copy (const PangoMatrix *matrix); void pango_matrix_free (PangoMatrix *matrix); void pango_matrix_translate (PangoMatrix *matrix, double tx, double ty); void pango_matrix_scale (PangoMatrix *matrix, double scale_x, double scale_y); void pango_matrix_rotate (PangoMatrix *matrix, double degrees); void pango_matrix_concat (PangoMatrix *matrix, const PangoMatrix *new_matrix); void pango_matrix_transform_point (const PangoMatrix *matrix, double *x, double *y); void pango_matrix_transform_distance (const PangoMatrix *matrix, double *dx, double *dy); void pango_matrix_transform_rectangle (const PangoMatrix *matrix, PangoRectangle *rect); void pango_matrix_transform_pixel_rectangle (const PangoMatrix *matrix, PangoRectangle *rect); double pango_matrix_get_font_scale_factor (const PangoMatrix *matrix); typedef PangoGlyph; #define PANGO_GLYPH_EMPTY #define PANGO_GLYPH_INVALID_INPUT #define PANGO_GLYPH_UNKNOWN_FLAG #define PANGO_GET_UNKNOWN_GLYPH (wc) PangoGlyphInfo; PangoGlyphGeometry; typedef PangoGlyphUnit; PangoGlyphVisAttr; PangoGlyphString; PangoGlyphItem; PangoGlyphItemIter; #define PANGO_TYPE_GLYPH_STRING PangoGlyphString* pango_glyph_string_new (void); PangoGlyphString* pango_glyph_string_copy (PangoGlyphString *string); void pango_glyph_string_set_size (PangoGlyphString *string, gint new_len); void pango_glyph_string_free (PangoGlyphString *string); void pango_glyph_string_extents (PangoGlyphString *glyphs, PangoFont *font, PangoRectangle *ink_rect, PangoRectangle *logical_rect); void pango_glyph_string_extents_range (PangoGlyphString *glyphs, int start, int end, PangoFont *font, PangoRectangle *ink_rect, PangoRectangle *logical_rect); int pango_glyph_string_get_width (PangoGlyphString *glyphs); void pango_glyph_string_index_to_x (PangoGlyphString *glyphs, char *text, int length, PangoAnalysis *analysis, int index_, gboolean trailing, int *x_pos); void pango_glyph_string_x_to_index (PangoGlyphString *glyphs, char *text, int length, PangoAnalysis *analysis, int x_pos, int *index_, int *trailing); void pango_glyph_string_get_logical_widths (PangoGlyphString *glyphs, const char *text, int length, int embedding_level, int *logical_widths); #define PANGO_TYPE_GLYPH_ITEM PangoGlyphItem* pango_glyph_item_copy (PangoGlyphItem *orig); void pango_glyph_item_free (PangoGlyphItem *glyph_item); PangoGlyphItem* pango_glyph_item_split (PangoGlyphItem *orig, const char *text, int split_index); GSList* pango_glyph_item_apply_attrs (PangoGlyphItem *glyph_item, const char *text, PangoAttrList *list); void pango_glyph_item_letter_space (PangoGlyphItem *glyph_item, const char *text, PangoLogAttr *log_attrs, int letter_spacing); #define PANGO_TYPE_GLYPH_ITEM_ITER PangoGlyphItemIter* pango_glyph_item_iter_copy (PangoGlyphItemIter *orig); void pango_glyph_item_iter_free (PangoGlyphItemIter *iter); gboolean pango_glyph_item_iter_init_start (PangoGlyphItemIter *iter, PangoGlyphItem *glyph_item, const char *text); gboolean pango_glyph_item_iter_init_end (PangoGlyphItemIter *iter, PangoGlyphItem *glyph_item, const char *text); gboolean pango_glyph_item_iter_next_cluster (PangoGlyphItemIter *iter); gboolean pango_glyph_item_iter_prev_cluster (PangoGlyphItemIter *iter); Description
DetailsPANGO_SCALE#define PANGO_SCALE 1024
The When setting font sizes, device units are always considered to be points (as in "12 point font"), rather than pixels. PANGO_PIXELS()#define PANGO_PIXELS(d) (((int)(d) + 512) >> 10) Converts a dimension to device units by rounding.
PANGO_PIXELS_FLOOR()#define PANGO_PIXELS_FLOOR(d) (((int)(d)) >> 10) Converts a dimension to device units by flooring.
Since 1.14 PANGO_PIXELS_CEIL()#define PANGO_PIXELS_CEIL(d) (((int)(d) + 1023) >> 10) Converts a dimension to device units by ceiling.
Since 1.14 PANGO_UNITS_ROUND()#define PANGO_UNITS_ROUND(d) Rounds a dimension to whole device units, but does not convert it to device units.
Since 1.18 pango_units_to_double ()double pango_units_to_double (int i);
Converts a number in Pango units to floating-point: divides
it by
Since 1.16 pango_units_from_double ()int pango_units_from_double (double d);
Converts a floating-point number to Pango units: multiplies
it by
Since 1.16 PangoRectangletypedef struct { int x; int y; int width; int height; } PangoRectangle;
The PangoRectangle structure represents a rectangle. It is frequently
used to represent the logical or ink extents of a single glyph or section
of text. (See, for instance,
PANGO_ASCENT()#define PANGO_ASCENT(rect) (-(rect).y) Extracts the ascent from a PangoRectangle representing glyph extents. The ascent is the distance from the baseline to the highest point of the character. This is positive if the glyph ascends above the baseline.
PANGO_DESCENT()#define PANGO_DESCENT(rect) ((rect).y + (rect).height) Extracts the descent from a PangoRectangle representing glyph extents. The descent is the distance from the baseline to the lowest point of the character. This is positive if the glyph descends below the baseline.
PANGO_LBEARING()#define PANGO_LBEARING(rect) ((rect).x) Extracts the left bearing from a PangoRectangle representing glyph extents. The left bearing is the distance from the horizontal origin to the farthest left point of the character. This is positive for characters drawn completely to the right of the glyph origin.
PANGO_RBEARING()#define PANGO_RBEARING(rect) ((rect).x + (rect).width) Extracts the right bearing from a PangoRectangle representing glyph extents. The right bearing is the distance from the horizontal origin to the farthest right point of the character. This is positive except for characters drawn completely to the left of the horizontal origin.
pango_extents_to_pixels ()void pango_extents_to_pixels (PangoRectangle *inclusive, PangoRectangle *nearest);
Converts extents from Pango units to device units, dividing by the
The
The
The rule to which argument to use is: if you want the resulting device-space
rectangle to completely contain the original rectangle, pass it in as
Since 1.16 PangoMatrixtypedef struct { double xx; double xy; double yx; double yy; double x0; double y0; } PangoMatrix; A structure specifying a transformation between user-space coordinates and device coordinates. The transformation is given by
x_device = x_user * matrix->xx + y_user * matrix->xy + matrix->x0; y_device = x_user * matrix->yx + y_user * matrix->yy + matrix->y0;
Since 1.6 PANGO_TYPE_MATRIX#define PANGO_TYPE_MATRIX (pango_matrix_get_type ()) The GObject type for PangoMatrix
PANGO_MATRIX_INIT#define PANGO_MATRIX_INIT { 1., 0., 0., 1., 0., 0. } Constant that can be used to initialize a PangoMatrix to the identity transform.
PangoMatrix matrix = PANGO_MATRIX_INIT; pango_matrix_rotate (&matrix, 45.);
Since 1.6 pango_matrix_copy ()PangoMatrix* pango_matrix_copy (const PangoMatrix *matrix); Copies a PangoMatrix.
Since 1.6 pango_matrix_free ()void pango_matrix_free (PangoMatrix *matrix);
Free a PangoMatrix created with
Since 1.6 pango_matrix_translate ()void pango_matrix_translate (PangoMatrix *matrix, double tx, double ty);
Changes the transformation represented by
Since 1.6 pango_matrix_scale ()void pango_matrix_scale (PangoMatrix *matrix, double scale_x, double scale_y);
Changes the transformation represented by
Since 1.6 pango_matrix_rotate ()void pango_matrix_rotate (PangoMatrix *matrix, double degrees);
Changes the transformation represented by
Since 1.6 pango_matrix_concat ()void pango_matrix_concat (PangoMatrix *matrix, const PangoMatrix *new_matrix);
Changes the transformation represented by
Since 1.6 pango_matrix_transform_point ()void pango_matrix_transform_point (const PangoMatrix *matrix, double *x, double *y);
Transforms the point (
Since 1.16 pango_matrix_transform_distance ()void pango_matrix_transform_distance (const PangoMatrix *matrix, double *dx, double *dy);
Transforms the distance vector (
dx2 = dx1 * xx + dy1 * xy; dy2 = dx1 * yx + dy1 * yy;
Affine transformations are position invariant, so the same vector
always transforms to the same vector. If (
Since 1.16 pango_matrix_transform_rectangle ()void pango_matrix_transform_rectangle (const PangoMatrix *matrix, PangoRectangle *rect);
First transforms
This function is useful for example when you want to draw a rotated
If you have a rectangle in device units (pixels), use
If you have the rectangle in Pango units and want to convert to
transformed pixel bounding box, it is more accurate to transform it first
(using this function) and pass the result to
Since 1.16 pango_matrix_transform_pixel_rectangle ()void pango_matrix_transform_pixel_rectangle (const PangoMatrix *matrix, PangoRectangle *rect);
First transforms the
This function is useful for example when you want to draw a rotated
For better accuracy, you should use
Since 1.16 pango_matrix_get_font_scale_factor ()double pango_matrix_get_font_scale_factor (const PangoMatrix *matrix); Returns the scale factor of a matrix on the height of the font. That is, the scale factor in the direction perpendicular to the vector that the X coordinate is mapped to.
Since 1.12 PangoGlyphtypedef guint32 PangoGlyph; A PangoGlyph represents a single glyph in the output form of a string. PANGO_GLYPH_EMPTY#define PANGO_GLYPH_EMPTY ((PangoGlyph)0x0FFFFFFF)
The PANGO_GLYPH_INVALID_INPUT#define PANGO_GLYPH_INVALID_INPUT ((PangoGlyph)0xFFFFFFFF)
The Since 1.20 PANGO_GLYPH_UNKNOWN_FLAG#define PANGO_GLYPH_UNKNOWN_FLAG ((PangoGlyph)0x10000000)
The PANGO_GET_UNKNOWN_GLYPH()#define PANGO_GET_UNKNOWN_GLYPH(wc) ((PangoGlyph)(wc)|PANGO_GLYPH_UNKNOWN_FLAG)
Returns a PangoGlyph value that means no glyph was found for
PangoGlyphInfotypedef struct { PangoGlyph glyph; PangoGlyphGeometry geometry; PangoGlyphVisAttr attr; } PangoGlyphInfo; The PangoGlyphInfo structure represents a single glyph together with positioning information and visual attributes. It contains the following fields.
PangoGlyphGeometrytypedef struct { PangoGlyphUnit width; PangoGlyphUnit x_offset; PangoGlyphUnit y_offset; } PangoGlyphGeometry; The PangoGlyphGeometry structure contains width and positioning information for a single glyph.
PangoGlyphUnittypedef gint32 PangoGlyphUnit;
The PangoGlyphUnit type is used to store dimensions within
Pango. Dimensions are stored in 1/ PangoGlyphVisAttrtypedef struct { guint is_cluster_start : 1; } PangoGlyphVisAttr; The PangoGlyphVisAttr is used to communicate information between the shaping phase and the rendering phase. More attributes may be added in the future.
PangoGlyphStringtypedef struct { gint num_glyphs; PangoGlyphInfo *glyphs; /* This is a memory inefficient way of representing the information * here - each value gives the byte index within the text * corresponding to the glyph string of the start of the cluster to * which the glyph belongs. */ gint *log_clusters; } PangoGlyphString; The PangoGlyphString structure is used to store strings of glyphs with geometry and visual attribute information. The storage for the glyph information is owned by the structure which simplifies memory management.
PangoGlyphItemtypedef struct { PangoItem *item; PangoGlyphString *glyphs; } PangoGlyphItem; A PangoGlyphItem is a pair of a PangoItem and the glyphs resulting from shaping the text corresponding to an item. As an example of the usage of PangoGlyphItem, the results of shaping text with PangoLayout is a list of PangoLayoutLine, each of which contains a list of PangoGlyphItem.
PangoGlyphItemItertypedef struct { PangoGlyphItem *glyph_item; const gchar *text; int start_glyph; int start_index; int start_char; int end_glyph; int end_index; int end_char; } PangoGlyphItemIter;
A PangoGlyphItemIter is an iterator over the clusters in a
PangoGlyphItem. The forward direction of the
iterator is the logical direction of text. That is, with increasing
PangoGlyphItemIter cluster_iter; gboolean have_cluster; for (have_cluster = pango_glyph_item_iter_init_start (&cluster_iter, glyph_item, text); have_cluster; have_cluster = pango_glyph_item_iter_next_cluster (&cluster_iter)) { ... }
Note that
Since 1.22 PANGO_TYPE_GLYPH_STRING#define PANGO_TYPE_GLYPH_STRING (pango_glyph_string_get_type ()) The GObject type for PangoGlyphString. pango_glyph_string_new ()PangoGlyphString* pango_glyph_string_new (void); Create a new PangoGlyphString.
pango_glyph_string_copy ()PangoGlyphString* pango_glyph_string_copy (PangoGlyphString *string); Copy a glyph string and associated storage.
pango_glyph_string_set_size ()void pango_glyph_string_set_size (PangoGlyphString *string, gint new_len); Resize a glyph string to the given length.
pango_glyph_string_free ()void pango_glyph_string_free (PangoGlyphString *string); Free a glyph string and associated storage.
pango_glyph_string_extents ()void pango_glyph_string_extents (PangoGlyphString *glyphs, PangoFont *font, PangoRectangle *ink_rect, PangoRectangle *logical_rect);
Compute the logical and ink extents of a glyph string. See the documentation
for
pango_glyph_string_extents_range ()void pango_glyph_string_extents_range (PangoGlyphString *glyphs, int start, int end, PangoFont *font, PangoRectangle *ink_rect, PangoRectangle *logical_rect); Computes the extents of a sub-portion of a glyph string. The extents are relative to the start of the glyph string range (the origin of their coordinate system is at the start of the range, not at the start of the entire glyph string).
pango_glyph_string_get_width ()int pango_glyph_string_get_width (PangoGlyphString *glyphs);
Computes the logical width of the glyph string as can also be computed
using
Since 1.14 pango_glyph_string_index_to_x ()void pango_glyph_string_index_to_x (PangoGlyphString *glyphs, char *text, int length, PangoAnalysis *analysis, int index_, gboolean trailing, int *x_pos); Converts from character position to x position. (X position is measured from the left edge of the run). Character positions are computed by dividing up each cluster into equal portions.
pango_glyph_string_x_to_index ()void pango_glyph_string_x_to_index (PangoGlyphString *glyphs, char *text, int length, PangoAnalysis *analysis, int x_pos, int *index_, int *trailing); Convert from x offset to character position. Character positions are computed by dividing up each cluster into equal portions. In scripts where positioning within a cluster is not allowed (such as Thai), the returned value may not be a valid cursor position; the caller must combine the result with the logical attributes for the text to compute the valid cursor position.
pango_glyph_string_get_logical_widths ()void pango_glyph_string_get_logical_widths (PangoGlyphString *glyphs, const char *text, int length, int embedding_level, int *logical_widths);
Given a PangoGlyphString resulting from
PANGO_TYPE_GLYPH_ITEM#define PANGO_TYPE_GLYPH_ITEM (pango_glyph_item_get_type ()) The GObject type for PangoGlyphItem. Since 1.20 pango_glyph_item_copy ()PangoGlyphItem* pango_glyph_item_copy (PangoGlyphItem *orig); Make a deep copy of an existing PangoGlyphItem structure.
Since 1.20 pango_glyph_item_free ()void pango_glyph_item_free (PangoGlyphItem *glyph_item); Frees a PangoGlyphItem and resources to which it points.
Since 1.6 pango_glyph_item_split ()PangoGlyphItem* pango_glyph_item_split (PangoGlyphItem *orig, const char *text, int split_index);
Modifies
This function is similar in function to
Since 1.2 pango_glyph_item_apply_attrs ()GSList* pango_glyph_item_apply_attrs (PangoGlyphItem *glyph_item, const char *text, PangoAttrList *list);
Splits a shaped item (PangoGlyphItem) into multiple items based
on an attribute list. The idea is that if you have attributes
that don't affect shaping, such as color or underline, to avoid
affecting shaping, you filter them out ( All attributes that start or end inside a cluster are applied to that cluster; for instance, if half of a cluster is underlined and the other-half strikethrough, then the cluster will end up with both underline and strikethrough attributes. In these cases, it may happen that item->extra_attrs for some of the result items can have multiple attributes of the same type.
This function takes ownership of
Since 1.2 pango_glyph_item_letter_space ()void pango_glyph_item_letter_space (PangoGlyphItem *glyph_item, const char *text, PangoLogAttr *log_attrs, int letter_spacing);
Adds spacing between the graphemes of
Since 1.6 PANGO_TYPE_GLYPH_ITEM_ITER#define PANGO_TYPE_GLYPH_ITEM_ITER (pango_glyph_item_iter_get_type ()) The GObject type for PangoGlyphItemIter. Since 1.22 pango_glyph_item_iter_copy ()PangoGlyphItemIter* pango_glyph_item_iter_copy (PangoGlyphItemIter *orig); Make a shallow copy of an existing PangoGlyphItemIter structure.
Since 1.22 pango_glyph_item_iter_free ()void pango_glyph_item_iter_free (PangoGlyphItemIter *iter);
Frees a PangoGlyphItemIter created by
Since 1.22 pango_glyph_item_iter_init_start ()gboolean pango_glyph_item_iter_init_start (PangoGlyphItemIter *iter, PangoGlyphItem *glyph_item, const char *text); Initializes a PangoGlyphItemIter structure to point to the first cluster in a glyph item. See PangoGlyphItemIter for details of cluster orders.
Since 1.22 pango_glyph_item_iter_init_end ()gboolean pango_glyph_item_iter_init_end (PangoGlyphItemIter *iter, PangoGlyphItem *glyph_item, const char *text); Initializes a PangoGlyphItemIter structure to point to the last cluster in a glyph item. See PangoGlyphItemIter for details of cluster orders.
Since 1.22 pango_glyph_item_iter_next_cluster ()gboolean pango_glyph_item_iter_next_cluster (PangoGlyphItemIter *iter); Advances the iterator to the next cluster in the glyph item. See PangoGlyphItemIter for details of cluster orders.
Since 1.22 pango_glyph_item_iter_prev_cluster ()gboolean pango_glyph_item_iter_prev_cluster (PangoGlyphItemIter *iter); Moves the iterator to the preceding cluster in the glyph item. See PangoGlyphItemIter for details of cluster orders.
Since 1.22 |