pangomm 2.54.0
|
A Pango::LayoutLine represents one of the lines resulting from laying out a paragraph via Pango::Layout. More...
#include <pangomm/layoutline.h>
Public Member Functions | |
void | reference () const |
Increment the reference count for this object. | |
void | unreference () const |
Decrement the reference count for this object. | |
PangoLayoutLine * | gobj () |
Provides access to the underlying C instance. | |
const PangoLayoutLine * | gobj () const |
Provides access to the underlying C instance. | |
PangoLayoutLine * | gobj_copy () const |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs. | |
LayoutLine ()=delete | |
LayoutLine (const LayoutLine &)=delete | |
LayoutLine & | operator= (const LayoutLine &)=delete |
bool | is_paragraph_start () const |
Returns whether this is the first line of the paragraph. | |
Direction | get_resolved_direction () const |
Returns the resolved direction of the line. | |
bool | x_to_index (int x_pos, int & index, int &trailing) const |
Converts from x offset to the byte index of the corresponding character within the text of the layout. | |
int | index_to_x (int index, bool trailing) const |
Converts an index within a line to a x position. | |
std::vector< std::pair< int, int > > | get_x_ranges (int start_index, int end_index) const |
Get a list of visual ranges corresponding to a given logical range. | |
void | get_extents (Rectangle &ink_rect, Rectangle &logical_rect) const |
Compute the logical and ink extents of a layout line. | |
int | get_height () const |
Computes the height of the line, as the maximum of the heights of fonts used in this line. | |
Rectangle | get_ink_extents () const |
Compute the ink extents of a layout line. | |
Rectangle | get_logical_extents () const |
Compute the logical extents of a layout line. | |
void | get_pixel_extents (Rectangle &ink_rect, Rectangle &logical_rect) const |
Compute the logical and ink extents of a layout line. | |
Rectangle | get_pixel_ink_extents () const |
Compute the ink extents of a layout line in device units. | |
Rectangle | get_pixel_logical_extents () const |
Compute the logical extents of a layout line in device units. | |
void | show_in_cairo_context (const Cairo::RefPtr< Cairo::Context > &context) |
Draws this LayoutLine in the specified Cairo context. | |
void | add_to_cairo_context (const Cairo::RefPtr< Cairo::Context > &context) |
Adds the text in this LayoutLine to the current path in the specified Cairo context. | |
Glib::RefPtr< Pango::Layout > | get_layout () |
Glib::RefPtr< const Pango::Layout > | get_layout () const |
int | get_length () const |
int | get_start_index () const |
Protected Member Functions | |
void | operator delete (void *, std::size_t) |
Related Symbols | |
(Note that these are not member symbols.) | |
Glib::RefPtr< Pango::LayoutLine > | wrap (PangoLayoutLine *object, bool take_copy=false) |
A Glib::wrap() method for this object. | |
A Pango::LayoutLine represents one of the lines resulting from laying out a paragraph via Pango::Layout.
Pango::LayoutLine objects are obtained by calling Pango::Layout::get_line() and are only valid until the text, attributes, or settings of the parent Pango::Layout are modified. Routines for rendering Pango::Layout objects are provided in code specific to each rendering system.
|
delete |
|
delete |
Adds the text in this LayoutLine to the current path in the specified Cairo context.
The origin of the glyphs (the left edge of the line) will be at the current point of the cairo context.
context | A Cairo context. |
Compute the logical and ink extents of a layout line.
See the documentation for Pango::Font::get_glyph_extents() for details about the interpretation of the rectangles.
int Pango::LayoutLine::get_height | ( | ) | const |
Computes the height of the line, as the maximum of the heights of fonts used in this line.
Note that the actual baseline-to-baseline distance between lines of text is influenced by other factors, such as Pango::Layout::set_spacing() and Pango::Layout::set_line_spacing().
Rectangle Pango::LayoutLine::get_ink_extents | ( | ) | const |
Compute the ink extents of a layout line.
Glib::RefPtr< Pango::Layout > Pango::LayoutLine::get_layout | ( | ) |
Glib::RefPtr< const Pango::Layout > Pango::LayoutLine::get_layout | ( | ) | const |
int Pango::LayoutLine::get_length | ( | ) | const |
Rectangle Pango::LayoutLine::get_logical_extents | ( | ) | const |
Compute the logical extents of a layout line.
Compute the logical and ink extents of a layout line.
See the documentation for Pango::Font::get_glyph_extents() for details about the interpretation of the rectangles. The returned rectangles are in device units, as opposed to get_extents(), which returns the extents in units of device unit / PANGO_SCALE.
Rectangle Pango::LayoutLine::get_pixel_ink_extents | ( | ) | const |
Compute the ink extents of a layout line in device units.
Rectangle Pango::LayoutLine::get_pixel_logical_extents | ( | ) | const |
Compute the logical extents of a layout line in device units.
Direction Pango::LayoutLine::get_resolved_direction | ( | ) | const |
Returns the resolved direction of the line.
int Pango::LayoutLine::get_start_index | ( | ) | const |
std::vector< std::pair< int, int > > Pango::LayoutLine::get_x_ranges | ( | int | start_index, |
int | end_index | ||
) | const |
Get a list of visual ranges corresponding to a given logical range.
This list is not necessarily minimal - there may be consecutive ranges which are adjacent. The ranges will be sorted from left to right. The ranges are with respect to the left edge of the entire layout, not with respect to the line.
start_index | The start byte index of the logical range. If the value of start_index is less than the start index for the line, then the first range will extend all the way to the leading edge of the layout. Otherwise it will start at the leading edge of the first character. |
end_index | The end byte index of the logical range. If the value of end_index is greater than the end index for the line, then the last range will extend all the way to the trailing edge of the layout. Otherwise, it will end at the trailing edge of the last character. |
PangoLayoutLine * Pango::LayoutLine::gobj | ( | ) |
Provides access to the underlying C instance.
const PangoLayoutLine * Pango::LayoutLine::gobj | ( | ) | const |
Provides access to the underlying C instance.
PangoLayoutLine * Pango::LayoutLine::gobj_copy | ( | ) | const |
Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
Converts an index within a line to a x position.
index | Byte offset of a grapheme within the layout. |
trailing | A boolean indicating the edge of the grapheme to retrieve the position of. If false , the trailing edge of the grapheme, if true the leading of the grapheme. |
bool Pango::LayoutLine::is_paragraph_start | ( | ) | const |
Returns whether this is the first line of the paragraph.
true
if this is the first line.
|
delete |
void Pango::LayoutLine::reference | ( | ) | const |
Increment the reference count for this object.
You should never need to do this manually - use the object via a RefPtr instead.
Draws this LayoutLine in the specified Cairo context.
The origin of the glyphs (the left edge of the line) will be drawn at the current point of the cairo context.
context | A Cairo context. |
void Pango::LayoutLine::unreference | ( | ) | const |
Decrement the reference count for this object.
You should never need to do this manually - use the object via a RefPtr instead.
Converts from x offset to the byte index of the corresponding character within the text of the layout.
If x_pos is outside the line, index and trailing will point to the very first or very last position in the line. This determination is based on the resolved direction of the paragraph; for example, if the resolved direction is right-to-left, then an X position to the right of the line (after it) results in 0 being stored in index and trailing. An X position to the left of the line results in index pointing to the (logical) last grapheme in the line and trailing being set to the number of characters in that grapheme. The reverse is true for a left-to-right line.
x_pos | The X offset (in Pango units) from the left edge of the line. |
index | Location to store calculated byte index for the grapheme in which the user clicked. |
trailing | Location to store an integer indicating where in the grapheme the user clicked. It will either be zero, or the number of characters in the grapheme. 0 represents the leading edge of the grapheme. |
false
if x_pos was outside the line, true
if inside.
|
related |
A Glib::wrap() method for this object.
object | The C instance. |
take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref. |