pango-sharp[00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 71 EB 6C 55 75 52 9C BF 72 44 F7 A6 EA 05 62 84 F9 EA E0 3B CF F2 CC 13 2C 9C 49 0A B3 09 EA B0 B5 6B CE 44 9D F5 03 D9 C0 A8 1E 52 05 85 CD BE 70 E2 FB 90 43 4B AC 04 FA 62 22 A8 00 98 B7 A1 A7 B3 AF 99 1A 41 23 24 BB 43 25 F6 B8 65 BB 64 EB F6 D1 C2 06 D5 73 2D DF BC 70 A7 38 9E E5 3E 0C 24 6E 32 79 74 1A D0 05 03 E4 98 42 E1 9B F3 7B 19 8B 40 21 26 CB 36 89 C2 EA 64 96 A4 7C B4]1.0.0.0neutralGtk# is thread aware, but not thread safe; See the Gtk# Thread Programming for details.High-level driver for formatting entire paragraphs of text at once.While complete access to the layout capabilities of Pango is provided using the detailed interfaces for itemization and shaping, using that functionality directly involves writing a fairly large amount of code. The objects and functions in provide a high-level driver for formatting entire paragraphs of text at once.The represents and entire paragraph of text. It is initialized with a , UTF-8 string and set of attributes for that string. Once that is done, the set of formatted lines can be extracted from the object, the layout can be rendered, and conversion between logical character positions within the layout's text, and the physical position of the resulting glyphs can be made.There are also a number of parameters to adjust the formatting of a . It is possible, as well, to ignore the 2-D setup, and simply treat the results of a as a list of lines.
using System;
using Gtk;
using Pango;
class LayoutSample : DrawingArea
{
Pango.Layout layout;
static void Main ()
{
Application.Init ();
new LayoutSample ();
Application.Run ();
}
LayoutSample ()
{
Window win = new Window ("Layout sample");
win.SetDefaultSize (400, 300);
win.DeleteEvent += OnWinDelete;
this.Realized += OnRealized;
this.ExposeEvent += OnExposed;
win.Add (this);
win.ShowAll ();
}
void OnExposed (object o, ExposeEventArgs args)
{
this.GdkWindow.DrawLayout (this.Style.TextGC (StateType.Normal), 100, 150, layout);
}
void OnRealized (object o, EventArgs args)
{
layout = new Pango.Layout (this.PangoContext);
layout.Wrap = Pango.WrapMode.Word;
layout.FontDescription = FontDescription.FromString ("Tahoma 16");
layout.SetMarkup ("Hello Pango.Layout");
}
void OnWinDelete (object o, DeleteEventArgs args)
{
Application.Quit ();
}
}
GLib.ObjectGLib.IWrapperSystem.IDisposableMethodSystem.VoidDisposes the resources associated with the object.MethodSystem.VoidComputes a new cursor position from an old position and a count of positions to move visually.
whether the moving cursor is the strong cursor or the weak cursor. The strong cursor is the cursor corresponding to text insertion in the base direction for the layout.
the byte index of the grapheme for the old index
if 0, the cursor was at the trailing edge of the grapheme indicated by old_index, if > 0, the cursor was at the leading edge.
direction to move cursor. A negative value indicates motion to the left.
location to store the new cursor byte index. A value of -1 indicates that the cursor has been moved off the beginning of the layout. A value of G_MAXINT indicates that the cursor has been moved off the end of the layout.
number of characters to move forward from the location returned for to get the position where the cursor should be displayed. This allows distinguishing the position at the beginning of one line from the position at the end of the preceding line. is always on the line where the cursor should be displayed.
If is positive, then the new strong cursor position will be one position to the right of the old cursor position. If is negative then the new strong cursor position will be one position to the left of the old cursor position.
In the presence of bi-directional text, the correspondence between logical and visual order will depend on the direction of the current run, and there may be jumps when the cursor is moved off of the end of a run.
Motion here is in cursor positions, not in characters, so a single call may move the cursor over multiple characters when multiple characters combine to form a single grapheme.
MethodSystem.VoidSet the text of the layout.
an object of type MethodSystem.VoidDetermine the logical width and height of a in device units.
an object of type
an object of type MethodSystem.VoidComputes the logical and ink extents
rectangle used to store the extents of the layout as drawn or to indicate that the result is not needed.
rectangle used to store the logical extents of the layout or to indicate that the result is not needed.
Logical extents are usually what you want for positioning things. The extents are given in layout coordinates; layout coordinates begin at the top left corner of the layout.MethodPango.RectangleObtains the graphical position of an offset in the .
a byte offset within the text buffer.
a representing the position of the grapheme associated with .
The X coordinate of the resulting represents the leading edge of the grapheme. If the direction of the grapheme is right to left, the Width value will be negative.
MethodSystem.VoidSets the layout text and attribute list from marked-up text (see markup format).
marked-up text
Replaces the current text and attribute list.
MethodSystem.VoidCompute the logical and ink extents of layout.
Rectangle used to store the extents of the layout as drawn.
Rectangle used to store the logical extents of the layout.
Logical extents are usually what you want for positioning things. The extents are given in layout coordinates; layout coordinates begin at the top left corner of the layout.
MethodPango.LayoutCopies an existing layout into a new one.an object of type MethodSystem.VoidDetermines the logical width and height of a in Pango units (device units divided by ).
location to store the logical width, or
location to store the logical height, or This is simply a convenience function around .MethodSystem.VoidGiven an index within a layout, determines the positions that of the strong and weak cursors if the insertion point is at that index.
the byte index of the cursor
location to store the strong cursor position (may be )
location to store the weak cursor position (may be )
The position of each cursor is stored as a zero-width rectangle. The strong cursor location is the location where characters of the directionality equal to the base direction of the layout are inserted. The weak cursor location is the location where characters of the directionality opposite to the base direction of the layout are inserted.MethodSystem.BooleanConvert from X and Y position within a layout to the byte index to the character at that logical position.
a , the X offset (in thousandths of a device unit) from the left edge of the layout.
a , the Y offset (in thousandths of a device unit) from the top edge of the layout.
a for storing the calculated byte index
a to store where in the grapheme the user clicked. It will either
be zero or the number of characters in the grapheme. 0 represents the trailing edge of the grapheme.
a , true if the coordinates are inside the Layout.MethodSystem.VoidForces recomputation of any state in the that might depend on the layout's context.This function should be called if you make changes to the context subsequent to creating the layout.MethodPango.LayoutLineRetrieves a particular line.
the index of a line.
the requested , or null if the index is out of range.This layout line can be referenced and retained, but will become invalid
if changes are made to the Layout.
ConstructorInternal constructor
Pointer to the C object.
An instance of Layout, wrapping the C object.This is an internal constructor and should not be used by user code.ConstructorCreate a new PangoLayout object with attributes initialized to default values for a particular .
a .
a new .ConstructorCreate a new PangoLayout object with attributes initialized to default values for a particular .
a .
a new .PropertyGLib.GTypeGType Property.a Returns the native value for .PropertyPango.FontDescriptionSet the default font description for the layout. If no font
description is set on the layout, the font description from
the layout's context is used.a PropertyPango.WrapModeGets or sets the wrap mode
the new wrap mode
Active wrap mode.The wrap mode only has an effect if a width is set on the layout using . To turn off wrapping, set the width to -1.PropertySystem.StringSets the text of the layout.a in UTF-8 encoding.PropertySystem.Int32Sets the width to which the lines of the Layout should be wrapped.an object of type PropertyPango.AlignmentSet or return the alignment for lines within the layout that do not take up the full width.
a object.
an object of type an object of type PropertySystem.BooleanSets whether or not each complete line should be stretched to fill the entire width of the layout.
whether the lines in the layout should be justified.
an object of type This stretching is typically done by adding whitespace, but for some scripts (such as Arabic), the justification is done by extending the characters.PropertySystem.Int32the amount of spacing between the lines of the layout.
the amount of spacing (in )
the amount of spacing (in ) PropertyPango.AttrListSets/gets the text attributes for a Layout object.
an object of type a PropertyPango.LayoutIterAn iterator to iterate over the visual extents of the layout.
an object of type a new .PropertyPango.Contextthe used for this layout.an object of type PropertySystem.BooleanWhether or not to treat newlines and similar characters as paragraph separators.an object of type If set to true, do not treat newlines and similar characters as paragraph separators; instead, keep all text in a single paragraph, and display a glyph for paragraph separator characters.Used when you want to allow editing of newlines on a single text line.PropertyPango.TabArrayThe tabs to use for the layout.
the tabs to use for the layout.
the current used by this layout. If no has been set, then the default tabs are in use and null is returned.By default, tabs are every 8 spaces.Setting new tabs overrides the default tabs. If Tabs is set to null, the default tabs are reinstated.PropertySystem.Int32Set or return the amount by which the first line should be shorter than the rest of the lines.
an object of type , the new indent
an object of type The value can be negative, in which case the subsequent lines will be shorter than the first line. (However, in either case, the entire width of the layout will be given by the value.PropertySystem.Int32Retrieves the count of lines for the layout.An integer, the line countPropertyPango.LayoutLine[]The count of lines for the layout.The count of lines for the layout.PropertyPango.LogAttr[]Retrieves an array of logical attributes for each character in the layout.a MethodSystem.VoidSets the text of a Layout includSets the layout text and attribute list from marked-up text with an accelerator marker (see markup format).
marked-up text
the character following this char is underlined.
returns a parsed accelerator char from the marked-up text.
Replaces the current text and attribute list.