Xfce Foundation Classes
Main Page  | IndexNamespace List  |  Alphabetical List  |  Class List  |  File List


Classes | Typedefs | Enumerations
Xfc::Pango Namespace Reference

The C++ framework for the Pango text handling library. More...

Classes

Typedefs

Enumerations

Functions

Rendering Methods
Item methods
Script Methods
Direction Methods

Detailed Description

The C++ framework for the Pango text handling library.

Pango is a library for internationalized text handling. It centers around the Pango::Layout object, representing a paragraph of text. Pango provides the engine for Gtk::TextView, Gtk::Label, Gtk::Entry and other widgets that display text.


Typedef Documentation

typedef PangoGlyph Xfc::Pango::Glyph

Glyph is a convenient typedef for PangoGlyph.

Glyph structure represents a single glyph in the output form of a glyph string.

typedef PangoGlyphUnit Xfc::Pango::GlyphUnit

GlyphUnit is a convenient typedef for PangoGlyphUnit.

The GlyphUnit type is used to store dimensions within Pango. Dimensions are stored in 1/PANGO_SCALE of a device unit. (A device unit might be a pixel for screen display, or a point on a printer.) PANGO_SCALE is currently 1024, and is unlikely to change, but you should not depend on its exact value. The PANGO_PIXELS() macro can be used to convert from glyph units into device units with correct rounding.


Enumeration Type Documentation

Describes how to align the lines of a Layout within the available space.

If the PangoLayout is set to justify using Pango::Layout::set_justify(), then this only has an effect for partial lines.

Enumerator:
ALIGN_LEFT 

Put all available space on the right.

ALIGN_CENTER 

Center the line within the available space.

ALIGN_RIGHT 

Put all available space on the left.

Distinguishes between different types of attributes.

Along with the predefined values, it is possible to allocate additional values for custom attributes using pango_attr_register_type(). The predefined values are given below. The type of class used to store the attribute is listed in parentheses after the description.

Enumerator:
ATTR_INVALID 

Invalid.

ATTR_LANGUAGE 

Language (AttrLanguage).

ATTR_FAMILY 

Font family name list (AttrString).

ATTR_STYLE 

Font slant style (AttrInt).

ATTR_WEIGHT 

Font weight (AttrInt).

ATTR_VARIANT 

Font variant (normal or small caps) (AttrInt).

ATTR_STRETCH 

Font stretch (AttrInt).

ATTR_SIZE 

Font size in points divided by PANGO_SCALE (AttrInt).

ATTR_FONT_DESC 

Font description (AttrFontDesc).

ATTR_FOREGROUND 

Foreground color (AttrColor).

ATTR_BACKGROUND 

Background color (AttrColor).

ATTR_UNDERLINE 

Whether the text has an underline (AttrInt).

ATTR_STRIKETHROUGH 

Whether the text is struck-through (AttrInt).

ATTR_RISE 

Baseline displacement (AttrInt).

ATTR_SHAPE 

Shape (AttrShape).

ATTR_SCALE 

Font size scale factor (AttrScale).

ATTR_FALLBACK 

Whether fallback is enabled (AttrInt).

ATTR_LETTER_SPACING 

The amount of extra space to add between graphemes.

ATTR_UNDERLINE_COLOR 

The color of underlines.

ATTR_STRIKETHROUGH_COLOR 

The color of strikethrough lines.

Used to indicate how well a font can represent a particular ISO 10646 character point for a particular script.

Enumerator:
COVERAGE_NONE 

The character is not representable with the font.

COVERAGE_FALLBACK 

The character is represented in a way that may be comprehensible but is not the correct graphical form; for instance, a Hangul character represented as a a sequence of Jamos, or a Latin transliteration of a Cyrillic word.

COVERAGE_APPROXIMATE 

The character is represented as basically the correct graphical form, but with a stylistic variant inappropriate for the current script.

COVERAGE_EXACT 

The character is represented as the correct graphical form.

The Direction type represents the direction of writing for unicode bidirectional text.

Note: Not every value in this enumeration makes sense for every usage of Pango::Direction.

Enumerator:
DIRECTION_LTR 

The text is written left-to-right.

DIRECTION_RTL 

The text is written right-to-left.

DIRECTION_TTB_LTR 

The text is written vertically top-to-bottom, with the rows ordered from left to right.

DIRECTION_TTB_RTL 

The text is written vertically top-to-bottom, with the rows ordered from right to left.

DIRECTION_WEAK_LTR 

A weak left-to-right direction.

DIRECTION_WEAK_RTL 

A weak right-to-left direction .

DIRECTION_NEUTRAL 

No direction specified.

Describes what sort of (if any) ellipsization should be applied to a line of text.

Enumerator:
ELLIPSIZE_NONE 

No ellipsization.

ELLIPSIZE_START 

Omit characters at the start of the text.

ELLIPSIZE_MIDDLE 

Omit characters in the middle of the text.

ELLIPSIZE_END 

Omit characters at the end of the text.

The bit flags in a FontMask correspond to fields in a FontDescription that have been set.

Enumerator:
FONT_MASK_FAMILY 

The font family is specified.

FONT_MASK_STYLE 

The font style is specified.

FONT_MASK_VARIANT 

T font variant is specified.

FONT_MASK_WEIGHT 

The font weight is specified.

FONT_MASK_STRETCH 

The font stretch is specified.

FONT_MASK_SIZE 

The font size is specified.

Defines different items to render for such purposes as setting colors.

Enumerator:
RENDER_PART_FOREGROUND 

The text itself.

RENDER_PART_BACKGROUND 

The area behind the text.

RENDER_PART_UNDERLINE 

Underlines.

RENDER_PART_STRIKETHROUGH 

Strikethrough lines.

Identifies different writing systems.

The values correspond to the names defined in the Unicode standard (see Unicode Standard Annex 24: Script names).

Enumerator:
SCRIPT_INVALID_CODE 

A value never used for any unicode character.

SCRIPT_COMMON 

Zyyy; a character used by multiple different scripts.

SCRIPT_INHERITED 

Qaai; a mark glyph that takes its script from the base glyph to which it is attached.

SCRIPT_ARABIC 

Arab.

SCRIPT_ARMENIAN 

Armn.

SCRIPT_BENGALI 

Beng.

SCRIPT_BOPOMOFO 

Bopo.

SCRIPT_CHEROKEE 

Cher.

SCRIPT_COPTIC 

Qaac.

SCRIPT_CYRILLIC 

Cyrl (Cyrs).

SCRIPT_DESERET 

Dsrt.

SCRIPT_DEVANAGARI 

Deva.

SCRIPT_ETHIOPIC 

Ethi.

SCRIPT_GEORGIAN 

Geor (Geon, Geoa).

SCRIPT_GOTHIC 

Goth.

SCRIPT_GREEK 

Grek.

SCRIPT_GUJARATI 

Gujr.

SCRIPT_GURMUKHI 

Guru.

SCRIPT_HAN 

Hani.

SCRIPT_HANGUL 

Hang.

SCRIPT_HEBREW 

Hebr.

SCRIPT_HIRAGANAPANGO_SCRIPT_HIRAGANA 

Hira.

SCRIPT_KANNADA 

Knda.

SCRIPT_KATAKANA 

Kana.

SCRIPT_KHMER 

Khmr.

SCRIPT_LAO 

Laoo.

SCRIPT_LATIN 

Latn (Latf, Latg).

SCRIPT_MALAYALAM 

Mlym.

SCRIPT_MONGOLIAN 

Mong.

SCRIPT_MYANMAR 

Mymr.

SCRIPT_OGHAM 

Ogam.

SCRIPT_OLD_ITALIC 

Ital.

SCRIPT_ORIYA 

Orya.

SCRIPT_RUNIC 

Runr.

SCRIPT_SINHALA 

Sinh.

SCRIPT_SYRIAC 

Syrc (Syrj, Syrn, Syre).

SCRIPT_TAMIL 

Taml.

SCRIPT_TELUGU 

Telu.

SCRIPT_THAANA 

Thaa.

SCRIPT_THAI 

Thai.

SCRIPT_TIBETAN 

Tibt.

SCRIPT_CANADIAN_ABORIGINAL 

Cans.

SCRIPT_YI 

Yiii.

SCRIPT_TAGALOG 

Tglg.

SCRIPT_HANUNOO 

Hano.

SCRIPT_BUHID 

Buhd.

SCRIPT_TAGBANWA 

Tagb.

SCRIPT_BRAILLE 

Brai.

SCRIPT_CYPRIOTPANGO_SCRIPT_CYPRIOT 

Cprt.

SCRIPT_LIMBUPANGO_SCRIPT_LIMBU 

Limb.

SCRIPT_OSMANYA 

Osma.

SCRIPT_SHAVIAN 

Shaw.

SCRIPT_LINEAR_B 

Linb.

SCRIPT_TAI_LE 

Tale.

SCRIPT_UGARITIC 

Ugar.

Specifies the width of the font relative to other designs within a family.

Enumerator:
STRETCH_UTLRA_CONDENSED 

Ultra condensed width.

STRETCH_EXTRA_CONDENSED 

Extra condensed width.

STRETCH_CONDENSED 

Condensed width.

STRETCH_SEMI_CONDENSED 

Semi condensed width.

STRETCH_NORMAL 

Normal width.

STRETCH_SEMI_EXPANDED 

Semi expanded width.

STRETCH_EXPANDED 

Expanded width.

STRETCH_EXTRA_EXPANDED 

Extra expanded width.

STRETCH_ULTRA_EXPANDED 

Ultra expanded width.

Specifies the various slant styles possible for a font.

Enumerator:
STYLE_NORMAL 

The font is upright.

STYLE_OBLIQUE 

The font is slanted, but in a roman style.

STYLE_ITALIC 

The font is slanted in an italic style.

Specifies where a tab stop appears relative to the text.

Currently there is only TAB_LEFT, but TAB_RIGHT, TAB_CENTER and TAB_NUMERIC may be supported in the future.

Enumerator:
TAB_LEFT 

The tab stop appears to the left of the text.

Underline is used to specify whether text should be underlined, and if so, the type of underlining.

Enumerator:
UNDERLINE_NONE 

No underline should be drawn.

UNDERLINE_SINGLE 

A single underline should be drawn.

UNDERLINE_DOUBLE 

A double underline should be drawn.

UNDERLINE_LOW 

A single underline should be drawn at a position beneath the ink extents of the text being underlined; this should be used only for underlining single characters, such as for keyboard accelerators; UNDERLINE_SINGLE should be used for extended portions of text.

UNDERLINE_ERROR 

A wavy underline should be drawn below; this underline is typically used to indicate an error such as a possilble mispelling; in some cases an contrasting color may automatically be used.

Specifies the capitalization variant of the font.

Enumerator:
VARIANT_NORMAL 

A normal font.

VARIANT_SMALL_CAPS 

A font with the lower case characters replaced by smaller variants of the capital characters.

Specifies the weight (boldness) of a font.

This is a numerical value ranging from 100 to 900, but there are some predefined values:

Enumerator:
WEIGHT_ULTALIGHT 

The ultralight weight (= 200).

WEIGHT_LIGHT 

The light weight (=300).

WEIGHT_NORMAL 

The default weight (= 400).

WEIGHT_SEMIBOLD 

The semi bold weight (= 600).

WEIGHT_BOLD 

The bold weight (= 700).

WEIGHT_ULTRABOLD 

The ultrabold weight (= 800).

WEIGHT_HEAVY 

The heavy weight (= 900).

Enumerator:
WRAP_WORD 

Wrap lines at word boundaries.

WRAP_CHAR 

Wrap lines at character boundaries.

WRAP_WORD_CHAR 

Wrap lines at word boundaries, but fall back to character boundaries if there is not enought space for a full word.


Function Documentation

void Xfc::Pango::break_text ( const String &  text,
const Analysis &  analysis,
std::vector< LogAttr > &  attrs 
)

Determines possible line, word, and character breaks for a string of Unicode text.

Parameters:
textThe text to process.
analysisAn Analysis structure from Pango::Context::itemize().
attrsA vector of LogAttr to store the character information in.
Direction Xfc::Pango::find_base_dir ( const char *  text,
int  length = -1 
)

Searches a string for the first character that has a strong direction, according to the Unicode bidirectional algorithm.

Parameters:
textThe text to process.
lengthThe length of text in bytes, or -1 if text is null-terminated.
Returns:
The direction corresponding to the first strong character.

If no such character is found, then Pango::DIRECTION_NEUTRAL is returned.

void Xfc::Pango::find_paragraph_boundary ( const String &  text,
int *  paragraph_delimiter_index,
int *  next_paragraph_start 
)

Locates a paragraph boundary in text.

Parameters:
textThe UTF-8 text.
paragraph_delimiter_indexThe return location for index of delimiter.
next_paragraph_startThe return location for start of next paragraph.

A boundary is caused by delimiter characters, such as a newline, carriage return, carriage return-newline pair, or Unicode paragraph separator character. The index of the run of delimiters is returned in paragraph_delimiter_index. The index of the start of the paragraph (index after all delimiters) is stored in next_paragraph_start. If no delimiters are found, both paragraph_delimiter_index and next_paragraph_start are filled with the length of text (an index one off the end).

void Xfc::Pango::get_log_attrs ( const String &  text,
PangoLanguage *  language,
std::vector< LogAttr > &  attrs,
int  level = -1 
)

Computes a LogAttr for each character in text.

Parameters:
textThe text to process.
languageThe language tag.
attrsA vector of LogAttr with one LogAttr per character in text, plus one extra, to be filled in.
levelThe embedding level, or -1 if unknown.

The log_attrs vector must have one LogAttr for each position in text; if text contains N characters, it has N+1 positions, including the last position at the end of the text. text should be an entire paragraph; logical attributes can't be computed without context (for example you need to see spaces on either side of a word to know the word is a word).

bool Xfc::Pango::language_includes_script ( PangoLanguage *  language,
Script  script 
)

Determines if script is one of the scripts used to write language.

Parameters:
languageA PangoLanguage.
scriptA Pango::Script
Returns:
true if script is one of the scripts used to write language, or if nothing is known about language.

The returned value is conservative; if nothing is known about the language tag language, true will be returned, since, as far as Pango knows, script might be used to write language.

This routine is used in Pango's itemization process when determining if a supplied language tag is relevant to a particular section of text. It probably is not useful for applications in most circumstances.

std::vector<Pointer<Item> > Xfc::Pango::reorder_items ( const std::vector< Pointer< Item > > &  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).

Parameters:
logical_itemsA vector of Pointer<Item> in logical order.
Returns:
A vector of Pointer<Item> in visual order.

Please mail otaylor@redhat.com if you use this method. It is not a particularly convenient interface, and the code is duplicated elsewhere in Pango for that reason.

Looks up the Pango::Script for a particular character (as defined by Unicode Technical report 24).

Parameters:
chA unicode character
Returns:
The PangoScript for the character.

No check is made for ch being valid unicode character; if you pass in an invalid character, the result is undefined.

PangoLanguage* Xfc::Pango::script_get_sample_language ( Script  script)

Given a script, finds a language tag that is reasonably representative of that script.

Parameters:
scriptA Pango::Script
Returns:
A PangoLanguage that is representative of the script, or null if no such language exists.

This will usually be the most widely spoken or used language written in that script: for instance, the sample language for Pango::SCRIPT_CYRILLIC is ru (Russian), the sample lanugage for Pango::SCRIPT_ARABIC is ar. For some scripts, no sample language will be returned because there is no language that is sufficiently representative. The best example of this is Pango::SCRIPT_HAN, where various different variants of written Chinese, Japanese, and Korean all use significantly different sets of Han characters and forms of shared characters. No sample language can be provided for many historical scripts as well.

Determines the direction of a character; either Pango::DIRECTION_LTR, Pango::DIRECTION_LTR, or Pango::DIRECTION_NEUTRAL.

Parameters:
chThe character to examine.
Returns:
The direction of a the character, as used in the Unicode bidirectional algorithm.
Xfce Foundation Classes
Copyright © 2004-2005 The XFC Development Team XFC