pango-sharp0.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.VoidTo be added
To be added: an object of type 'string'
To be addedMethodSystem.VoidSet the text of the layout.
To be added: an object of type 'string'
To be addedMethodPango.LayoutLineRetrieves a particular line.
the index of a line.
the requested , or null if the index is out of range.To be addedMethodSystem.VoidTo be added
To be added: an object of type 'int&'
To be added: an object of type 'int&'
To be addedMethodPango.LayoutTo be addedTo be added: an object of type 'Pango.Layout'To be addedMethodSystem.VoidTo be addedTo be addedMethodSystem.VoidDetermine the logical width and height of a in device units.
To be added: an object of type 'int&'
To be added: an object of type 'int&'
To be addedMethodSystem.VoidDisposes the resources associated with the object.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 .To be addedPropertySystem.Int32To be addedTo be added: an object of type 'int'To be addedPropertySystem.Int32Return the lines of the layout as a list.
To be added: an object of type 'int'
To be added: an object of type 'int'To be addedPropertyPango.AlignmentThe amount by which the first line should be shorter than the rest of the lines.
the amount by which to indent.
To be added: an object of type 'Pango.Alignment'The value 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.PropertyPango.TabArrayThe alignment for the layout.
The new alignment.
The current alignment.Specifies how partial lines are positioned within the horizontal space available.PropertySystem.BooleanThe 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.PropertyPango.ContextWhether or not to treat newlines and similar characters as paragraph separators.To be added: an object of type 'Pango.Context'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.LayoutIterthe used for this layout.To be added: an object of type 'Pango.LayoutIter'To be addedPropertyPango.AttrListAn iterator to iterate over the visual extents of the layout.
To be added: an object of type 'Pango.AttrList'
a new .To be addedPropertySystem.Int32To be added
To be added: an object of type 'int'
To be added: an object of type 'int'To be addedPropertySystem.BooleanThe amount of spacing between the lines of the layout.
the amount of spacing.
To be added: an object of type 'bool'To be addedPropertySystem.Int32Sets 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.
To be added: an object of type 'int'This stretching is typically done by adding whitespace, but for some scripts (such as Arabic), the justification is done by extending the characters.PropertySystem.StringSets the width to which the lines of the Layout should be wrapped.To be added: an object of type 'string'To be addedPropertyPango.WrapModeTo be added
To be added: an object of type 'Pango.WrapMode'
To be added: an object of type 'Pango.WrapMode'To be addedPropertyPango.FontDescriptionSets the .
To be added: an object of type 'Pango.FontDescription'
To be added: an object of type 'Pango.FontDescription'The wrap style only has an effect if a width is set on the layout. To turn off wrapping, set the width to -1.MethodSystem.VoidTo be added
a
a
a
a
a
a To be addedMethodSystem.BooleanComputes 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.
a If count is positive, then the new strong cursor position will be one position to the right of the old cursor position. If count is position then the new strong cursor position will be one position to the left of the old cursor position.In the presence of bidirection 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 to MoveCursorVisually() may move the cursor over multiple characters when multiple characters combine to form a single grapheme.PropertyGLib.GTypeGType Property.a Returns the native value for .ConstructorConvert from X and Y position within a layout to the byte index to the character at that logical position.
the X offset from the left edge of the layout.
true if the coordinates were inside text.If the position is not inside the layout, the closest position is chosen (the x/y position will be clamped inside the layout). If a closest position is chosen, then the function returns false; on an exact hit, it returns true.PropertyPango.LayoutLine[]The count of lines for the layout.The count of lines for the layout.MethodSystem.VoidTo be added
a
a To be addedMethodPango.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.Int32To be added
a a To be addedMethodSystem.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.
MethodSystem.VoidTo be added
a
a
a To be added