GFC Logo GFC Title Logo
Reference Manual
Main Page  |  Namespace List  |  Alphabetical List  |  Class List  |  File List

GFC::Pango::GlyphString Class Reference

A PangoGlyphString C++ wrapper class. More...

#include <gfc/pango/glyph.hh>

Inheritance diagram for GFC::Pango::GlyphString:

GFC::G::Boxed GFC::Object GFC::Trackable List of all members.

Public Member Functions

Constructors
Accessors
Methods

Detailed Description

A PangoGlyphString C++ wrapper class.

GlyphString 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.


Constructor & Destructor Documentation

GFC::Pango::GlyphString::GlyphString const char *  text,
int  length,
const Analysis analysis
 

Given a segment of text and the corresponding Analysis structure returned from Pango::Context::itemize(), convert the characters in text into glyphs.

Parameters:
text The text to process.
length The length of the text in bytes.
analysis The Analysis structure from Pango::Context::Itemize().

You may also pass in only a substring of the item from Pango::Context::itemize(). This constructor calls pango_shape(). There is no shape() method.

GFC::Pango::GlyphString::GlyphString const String text,
const Analysis analysis
 

Given a segment of text and the corresponding Analysis structure returned from Pango::Context::itemize(), convert the characters in text into glyphs.

Parameters:
text The text to process.
analysis The Analysis structure from Pango::Context::Itemize().

You may also pass in only a substring of the item from Pango::Context::itemize(). This constructor calls pango_shape(). There is no shape() method.

GFC::Pango::GlyphString::GlyphString PangoGlyphString *  string  )  [explicit]
 

Construct a new glyph string from an existing PangoGlyphString.

Parameters:
string A pointer to a PangoGlyphString.

The string can be a newly created PangoGlyphString or an existing PangoGlyphString. The glyph string object created is a temporary object. It doesn't take over the ownership of PangoGlyphString and PangoGlyphString is not freed by the destructor.

GFC::Pango::GlyphString::GlyphString PangoGlyphString *  string,
bool  copy
 

Construct a new glyph string from an existing PangoGlyphString.

Parameters:
string A pointer to a PangoGlyphString.
copy Whether the GlyphString object should make a copy of PangoGlyphString or not.

The string can be a newly created PangoGlyphString or an existing PangoGlyphString. If copy is true GlyphString will make a copy of PangoGlyphString. If copy is false GlyphString wont make a copy but instead takes over the ownership of PangoGlyphString. Either way, the destructor will free PangoGlyphString when the GlyphString object is destroyed. This constructor is used by G::Boxed::wrap() to wrap PangoGlyphString objects in a C++ wrapper.

GFC::Pango::GlyphString::GlyphString const GlyphString src  ) 
 

Copy constructor.

Parameters:
src The source GlyphString.


Member Function Documentation

void GFC::Pango::GlyphString::extents const Font font,
Rectangle ink_rect,
Rectangle logical_rect,
int  start = 0,
int  end = -1
const
 

Compute the logical and ink extents of a sub-portion the glyph string, or the entire glyph string.

Parameters:
font A Font.
ink_rect The rectangle used to store the extents of the glyph string as drawn, or null to indicate that the result is not needed.
logical_rect The rectangle used to store the logical extents of the glyph string, or null to indicate that the result is not needed.
start The start index in bytes, or 0 for the start of the string.
end The end index in bytes, or -1 for the end of the 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).

See the documentation for Pango::Font::get_glyph_extents() for details about the interpretation of the rectangles.

void GFC::Pango::GlyphString::get_logical_widths const String text,
int  embedding_level,
std::vector< int > &  logical_widths
const
 

Given a GlyphString resulting from pango_shape() and the corresponding text, determine the screen width corresponding to each character.

Parameters:
text The text corresponding to the glyphs.
embedding_level The embedding level of the string.
logical_widths A reference to a vector of int to be filled in with the resulting character widths.

When multiple characters compose a single cluster, the width of the entire cluster is divided equally among the characters.

void GFC::Pango::GlyphString::get_logical_widths const char *  text,
int  length,
int  embedding_level,
std::vector< int > &  logical_widths
const
 

Given a GlyphString resulting from pango_shape() and the corresponding text, determine the screen width corresponding to each character.

Parameters:
text The text corresponding to the glyphs.
length The length of the text in bytes.
embedding_level The embedding level of the string.
logical_widths A reference to a vector of int to be filled in with the resulting character widths.

When multiple characters compose a single cluster, the width of the entire cluster is divided equally among the characters.

int GFC::Pango::GlyphString::index_to_x const String text,
const Analysis analysis,
int  index,
bool  trailing
 

Converts from a character position to an x position.

Parameters:
text The text for the run.
analysis The analysis information returned from Pango::Context::itemize().
index The byte index within text.
trailing Whether we should compute the result for the beginning or end of the character.
Returns:
The 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.

int GFC::Pango::GlyphString::index_to_x const char *  text,
int  length,
const Analysis analysis,
int  index,
bool  trailing
 

Converts from a character position to an x position.

Parameters:
text The text for the run.
length The length of the text in bytes.
analysis The analysis information returned from Pango::Context::itemize().
index The byte index within text.
trailing Whether we should compute the result for the beginning or end of the character.
Returns:
The 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.

int* GFC::Pango::GlyphString::log_clusters  )  const
 

For each glyph, returns the byte index of the starting character for the cluster.

The indices are relative to the start of the text corresponding to the GlyphString.

GlyphString& GFC::Pango::GlyphString::operator= const GlyphString src  ) 
 

Assignment operator.

Parameters:
src The source GlyphString.

void GFC::Pango::GlyphString::set_size int  length  ) 
 

Resize a glyph string to the given length.

Parameters:
length The new length of the string.

void GFC::Pango::GlyphString::x_to_index const String text,
const Analysis analysis,
int  x_pos,
int *  index,
bool *  trailing
 

Convert from an x offset to character position.

Parameters:
text The text for the run.
analysis The analysis information returned from Pango::Context::itemize().
x_pos The x offset (in GlyphUnit).
index The location to store calculated byte index within the text.
trailing The location to store whether the user clicked on the leading or trailing edge of the character.

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.

void GFC::Pango::GlyphString::x_to_index const char *  text,
int  length,
const Analysis analysis,
int  x_pos,
int *  index,
bool *  trailing
 

Convert from an x offset to character position.

Parameters:
text The text for the run.
length The length of the text in bytes.
analysis The analysis information returned from Pango::Context::itemize().
x_pos The x offset (in GlyphUnit).
index The location to store calculated byte index within the text.
trailing The location to store whether the user clicked on the leading or trailing edge of the character.

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.


The documentation for this class was generated from the following file:
Generated on Tue Aug 24 00:34:46 2004 for GFC-UI by doxygen 1.3.8