PangoPDF Reference Manual |
---|
PDFlib Fonts and Rendering — Functions for shape engines to manipulate FreeType fonts for the PDFlib renderer
struct PangoPDFLIBLayout; enum PangoPDFLIBBaseline; enum PangoPDFLIBLineStackingStrategy; #define PANGO_RENDER_TYPE_PDFLIB struct PangoPDFLIBFontMap; void (*PangoPDFLIBSubstituteFunc) (FcPattern *pattern, gpointer data); PangoContext* pango_pdflib_get_context (double dpi_x, double dpi_y); PangoFontMap* pango_pdflib_font_map_for_display (void); void pango_pdflib_shutdown_display (void); void pango_pdflib_render (PDF *pdf_doc, const gchar *layout_text, PangoLayoutRun *run, PangoFont *font, PangoGlyphString *glyphs, gint x, gint y); void pango_pdflib_render_layout_line (PDF *pdf_doc, const gchar *layout_text, PangoLayoutLine *line, gint x, gint y); void pango_pdflib_render_layout_lines (PDF *pdf_doc, PangoLayout *layout, gint line_first, gint line_last, gint x, gint y); void pango_pdflib_render_layout (PDF *pdf_doc, PangoLayout *layout, gint x, gint y); PangoFontMap* pango_pdflib_font_map_new (void); void pango_pdflib_font_map_set_resolution (PangoPDFLIBFontMap *fontmap, double dpi_x, double dpi_y); void pango_pdflib_font_map_set_default_substitute (PangoPDFLIBFontMap *fontmap, PangoPDFLIBSubstituteFunc func, gpointer data, GDestroyNotify notify); void pango_pdflib_font_map_substitute_changed (PangoPDFLIBFontMap *fontmap); PangoContext* pango_pdflib_font_map_create_context (PangoPDFLIBFontMap *fontmap); enum PangoPDFLIBDebugFlags; PangoContext* pango_pdflib_font_map_create_context_with_debug_flags (PangoPDFLIBFontMap *fontmap, PangoPDFLIBDebugFlags debug_flags); void pango_pdflib_layout_set_line_height (PangoLayout *layout, gint line_height); void pango_pdflib_layout_set_line_stacking_strategy (PangoLayout *layout, PangoPDFLIBLineStackingStrategy line_stacking_strategy); gint pango_pdflib_layout_get_item_attrs (PangoItem *item, PangoAttrType first_attribute_type, ...); PangoGlyph pango_pdflib_get_unknown_glyph (PangoFont *font); int pango_pdflib_font_get_kerning (PangoFont *font, PangoGlyph left, PangoGlyph right); FT_Face pango_pdflib_font_get_face (PangoFont *font); PangoCoverage* pango_pdflib_font_get_coverage (PangoFont *font, PangoLanguage *language);
struct PangoPDFLIBLayout;
The PangoPDFLIBLayout is a PDFlib-specific subclass of PangoLayout.
typedef enum { PANGO_PDFLIB_BASELINE_INVALID, PANGO_PDFLIB_BASELINE_AUTO, PANGO_PDFLIB_BASELINE_RESET_SIZE, PANGO_PDFLIB_BASELINE_ALPHABETIC, PANGO_PDFLIB_BASELINE_IDEOGRAPHIC, PANGO_PDFLIB_BASELINE_HANGING, PANGO_PDFLIB_BASELINE_MATHEMATICAL, PANGO_PDFLIB_BASELINE_CENTRAL, PANGO_PDFLIB_BASELINE_MIDDLE, PANGO_PDFLIB_BASELINE_TEXT_BEFORE_EDGE, PANGO_PDFLIB_BASELINE_TEXT_AFTER_EDGE, PANGO_PDFLIB_BASELINE_BEFORE_EDGE, PANGO_PDFLIB_BASELINE_AFTER_EDGE, PANGO_PDFLIB_BASELINE_LENGTH, PANGO_PDFLIB_BASELINE_USE_SCRIPT, PANGO_PDFLIB_BASELINE_BASELINE } PangoPDFLIBBaseline;
The PangoPDFLIBBaseline represents the baseline for aligning glyphs.
PANGO_PDFLIB_BASELINE_INVALID | Invalid |
PANGO_PDFLIB_BASELINE_AUTO | The baseline is determined by Pango |
PANGO_PDFLIB_BASELINE_RESET_SIZE | |
PANGO_PDFLIB_BASELINE_ALPHABETIC | The baseline used by most alphabetic and syllabic scripts |
PANGO_PDFLIB_BASELINE_IDEOGRAPHIC | The baseline used by ideographic scripts |
PANGO_PDFLIB_BASELINE_HANGING | The baseline used by certain Indic scripts |
PANGO_PDFLIB_BASELINE_MATHEMATICAL | The baseline used by mathematical symbols |
PANGO_PDFLIB_BASELINE_CENTRAL | The computed baseline at the center of the em box |
PANGO_PDFLIB_BASELINE_MIDDLE | The baseline offset from the alphabetic baseline in the shift-direction by 1/2 the font x-height |
PANGO_PDFLIB_BASELINE_TEXT_BEFORE_EDGE | The baseline at the before-edge of the em box |
PANGO_PDFLIB_BASELINE_TEXT_AFTER_EDGE | The baseline at the after-edge of the em box |
PANGO_PDFLIB_BASELINE_BEFORE_EDGE | Computed baseline for line areas |
PANGO_PDFLIB_BASELINE_AFTER_EDGE | Computed baseline for line areas |
PANGO_PDFLIB_BASELINE_LENGTH | Baseline is specified as a length |
PANGO_PDFLIB_BASELINE_USE_SCRIPT | The script determines the baseline |
PANGO_PDFLIB_BASELINE_BASELINE |
typedef enum { PANGO_PDFLIB_LINE_STACKING_STRATEGY_INVALID, PANGO_PDFLIB_LINE_STACKING_STRATEGY_LINE_HEIGHT, PANGO_PDFLIB_LINE_STACKING_STRATEGY_FONT_HEIGHT, PANGO_PDFLIB_LINE_STACKING_STRATEGY_MAX_HEIGHT } PangoPDFLIBLineStackingStrategy;
The PangoPDFLIBLineStackingStrategy determines how lines are stacked within a layout.
See Section 7.15.6 of the XSL 1.0 Recommendation.
PANGO_PDFLIB_LINE_STACKING_STRATEGY_INVALID | Invalid value |
PANGO_PDFLIB_LINE_STACKING_STRATEGY_LINE_HEIGHT | Uses the per-inline-height rectangle |
PANGO_PDFLIB_LINE_STACKING_STRATEGY_FONT_HEIGHT | Uses the nominal-requested-line-rectangle |
PANGO_PDFLIB_LINE_STACKING_STRATEGY_MAX_HEIGHT | Uses the maximal-line-rectangle |
#define PANGO_RENDER_TYPE_PDFLIB "PangoRenderPDFLIB"
A string constant identifying the PDFlib renderer. The associated quark (see g_quark_from_string()) is used to identify the renderer in pango_find_map().
struct PangoPDFLIBFontMap;
The PangoPDFLIBFontMap is the PangoFontMap implementation for FreeType fonts and the PDFlib renderer.
void (*PangoPDFLIBSubstituteFunc) (FcPattern *pattern, gpointer data);
Function type for doing final config tweaking on prepared FcPatterns.
pattern : | the FcPattern to tweak. |
data : | user data. |
PangoContext* pango_pdflib_get_context (double dpi_x, double dpi_y);
Retrieves a PangoContext for the default PangoPDFLIB fontmap (see pango_pdflib_fontmap_get_for_display()) and sets the resolution for the default fontmap to dpi_x by dpi_y.
Use of this function is discouraged, see pango_pdflib_font_map_create_context() instead.
dpi_x : | the horizontal dpi of the target device |
dpi_y : | the vertical dpi of the target device |
Returns : | the new PangoContext |
PangoFontMap* pango_pdflib_font_map_for_display (void);
Returns a PangoPDFLIBFontMap. This font map is cached and should not be freed. If the font map is no longer needed, it can be released with pango_pdflib_shutdown_display().
Returns : | a PangoPDFLIBFontMap. |
void pango_pdflib_shutdown_display (void);
Free the global fontmap. (See pango_pdflib_font_map_for_display())
void pango_pdflib_render (PDF *pdf_doc, const gchar *layout_text, PangoLayoutRun *run, PangoFont *font, PangoGlyphString *glyphs, gint x, gint y);
Renders a PangoGlyphString onto a PDFlib PDF document.
pdf_doc : | the PDFlib document onto which to draw layout_text. |
layout_text : | the text of the layout. |
run : | the PangoLayoutRun to render. |
font : | the font in which to draw the string. |
glyphs : | the glyph string to draw. |
x : | the x position of the start of the string (in PangoGlyphUnit). |
y : | the y position of the baseline (in PangoGlyphUnit). |
void pango_pdflib_render_layout_line (PDF *pdf_doc, const gchar *layout_text, PangoLayoutLine *line, gint x, gint y);
Render a PangoLayoutLine onto a FreeType2 bitmap
pdf_doc : | the PDFlib document onto which to draw layout_text. |
layout_text : | the text of the layout. |
line : | a PangoLayoutLine |
x : | the x position of start of string (in PangoGlyphUnit) |
y : | the y position of baseline (in PangoGlyphUnit) |
void pango_pdflib_render_layout_lines (PDF *pdf_doc, PangoLayout *layout, gint line_first, gint line_last, gint x, gint y);
Render some lines from PangoLayout onto a PDFlib PDF document.
pdf_doc : | the PDFlib document onto which to draw layout_text. |
layout : | a PangoLayout |
line_first : | the first line to render. |
line_last : | the last line to render. |
x : | the X position of the left of the layout (in PangoGlyphUnit) |
y : | the Y position of the top of the layout (in PangoGlyphUnit) |
void pango_pdflib_render_layout (PDF *pdf_doc, PangoLayout *layout, gint x, gint y);
Render a PangoLayout onto a PDFlib PDF document.
pdf_doc : | the PDFlib document onto which to draw layout_text. |
layout : | a PangoLayout |
x : | the X position of the left of the layout (in PangoGlyphUnit) |
y : | the Y position of the top of the layout (in PangoGlyphUnit) |
PangoFontMap* pango_pdflib_font_map_new (void);
Create a new PangoPDFLIBFontMap object; a fontmap is used to cache information about available fonts, and holds certain global parameters such as the resolution and the default substitute function (see pango_font_map_set_default_substitute()).
Returns : | the newly created fontmap object. Unref with g_object_unref when you are finished with it. |
void pango_pdflib_font_map_set_resolution (PangoPDFLIBFontMap *fontmap, double dpi_x, double dpi_y);
Sets the horizontal and vertical resolutions for the fontmap.
fontmap : | a PangoPDFLIBFontmap |
dpi_x : | dots per inch in the X direction |
dpi_y : | dots per inch in the Y direction |
void pango_pdflib_font_map_set_default_substitute (PangoPDFLIBFontMap *fontmap, PangoPDFLIBSubstituteFunc func, gpointer data, GDestroyNotify notify);
Sets a function that will be called to do final configuration substitution on a FcPattern before it is used to load the font. This function can be used to do things like set hinting and antiasing options.
Since: 1.2
fontmap : | a PangoPDFLIBFontMap |
func : | function to call to to do final config tweaking on FcPattern objects. |
data : | data to pass to func |
notify : | function to call when data is no longer used. |
void pango_pdflib_font_map_substitute_changed (PangoPDFLIBFontMap *fontmap);
Call this function any time the results of the default substitution function set with pango_pdflib_font_map_set_default_substitute() change. That is, if your subsitution function will return different results for the same input pattern, you must call this function.
fontmap : | a PangoPDFLIBFontmap |
PangoContext* pango_pdflib_font_map_create_context (PangoPDFLIBFontMap *fontmap);
Create a PangoContext for the given fontmap.
fontmap : | a PangoPDFLIBFontmap |
Returns : | the newly created context; free with g_object_unref(). |
typedef enum { PANGO_PDFLIB_DEBUG_NONE = 0, PANGO_PDFLIB_DEBUG_DEBUG = 1, PANGO_PDFLIB_DEBUG_MASK = 0x01 } PangoPDFLIBDebugFlags;
The PangoPDFLIBDebugFlags determine the debugging mode of the PangoContext
PANGO_PDFLIB_DEBUG_NONE | No debugging is enabled |
PANGO_PDFLIB_DEBUG_DEBUG | Debugging is enabled |
PANGO_PDFLIB_DEBUG_MASK |
PangoContext* pango_pdflib_font_map_create_context_with_debug_flags (PangoPDFLIBFontMap *fontmap, PangoPDFLIBDebugFlags debug_flags);
Create a PangoContext for the given fontmap.
Debug flags are currently ignored.
fontmap : | a PangoPDFLIBFontmap |
debug_flags : | PangoPDFLIBDebugFlags |
Returns : | the newly created context; free with g_object_unref(). |
void pango_pdflib_layout_set_line_height (PangoLayout *layout, gint line_height);
Sets the line-height of the layout.
layout : | The PangoPDFLIBLayout. |
line_height : | The line-height for the layout. |
void pango_pdflib_layout_set_line_stacking_strategy (PangoLayout *layout, PangoPDFLIBLineStackingStrategy line_stacking_strategy);
Sets the line-stacking-strategy of the layout.
layout : | The PangoPDFLIBLayout. |
line_stacking_strategy : | The line-stacking-strategy for the layout. |
gint pango_pdflib_layout_get_item_attrs (PangoItem *item, PangoAttrType first_attribute_type, ...);
Gets specified attribute types, if present, from the extra attributes of item.
For each specified attribute type, if item has an attribute of that type, sets the PangoAttribute pointed to by the following argument to the attribute.
If item does not have an attribute of the specified type, sets the PangoAttribute pointed to by the following argument to NULL.
item : | PangoItem which may have extra attributes. |
first_attribute_type : | PangoAttrType of a predefined or registered attribute type. |
... : | Remainder of list of PangoAttrType and **PangoAttribute pairs, terminated by PANGO_ATTR_INVALID. |
Returns : | The number of matches found. |
PangoGlyph pango_pdflib_get_unknown_glyph (PangoFont *font);
Return the index of a glyph suitable for drawing unknown characters.
font : | a PangoFont |
Returns : | a glyph index into font |
int pango_pdflib_font_get_kerning (PangoFont *font, PangoGlyph left, PangoGlyph right);
Retrieves kerning information for a combination of two glyphs.
font : | a PangoFont |
left : | the left PangoGlyph |
right : | the right PangoGlyph |
Returns : | The amount of kerning (in Pango units) to apply for the given combination of glyphs. |
FT_Face pango_pdflib_font_get_face (PangoFont *font);
Returns the native FreeType2 FT_Face structure used for this PangoFont. This may be useful if you want to use FreeType2 functions directly.
font : | a PangoFont |
Returns : | a pointer to a FT_Face structure, with the size set correctly |
PangoCoverage* pango_pdflib_font_get_coverage (PangoFont *font, PangoLanguage *language);
Should not be called directly, use pango_font_get_coverage() instead.
font : | a PangoPDFLIBFont. |
language : | a language tag. |
Returns : | a PangoCoverage. |
<< FreeType Fonts and Rendering | Xft Fonts and Rendering >> |