|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.gnu.glib.GObject
org.gnu.pango.Layout
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 this structure provide a high-level driver for formatting entire paragraphs of text at once.
The PangoLayout structure represents and entire paragraph of text. It is initialized with a PangoContext, 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.
Field Summary |
Fields inherited from class org.gnu.glib.GObject |
eventsInitialized |
Constructor Summary | |
Layout(Context context)
Construct a new Layout with the given Context. |
|
Layout(Handle handle)
Construct a new Layout with a handle that has been returned from a native call. |
|
Layout(Layout layout)
Construct a new Layout that is a copy of the provided Layout. |
Method Summary | |
void |
contextChanged()
Forces recomputation of any state in the Layout that might depend on the layout's context. |
Alignment |
getAlignment()
Gets the alignment for the layout (how partial lines are positioned within the horizontal space available.) |
AttrList |
getAttributes()
Gets the attribute list for the layout, if any |
Context |
getContext()
Retrieve the Context used for this Layout. |
int |
getHeight()
Return the logical height of the Layout in Pango units. |
int |
getIndent()
Gets the amount by which the first line should be shorter than the rest of the lines. |
boolean |
getJustified()
Gets whether or not each complete line should be stretched to fill the entire width of the layout. |
LayoutLine |
getLine(int line)
Retrieves a particular line from a PangoLayout. |
int |
getLineCount()
Retrieve the count of lines for the layout |
int |
getPixelHeight()
Return the logical height of the Layout in device units. |
int |
getPixelWidth()
Return the logical width of the Layout in device units. |
boolean |
getSingleParagraphMode()
Obtains the value set by setSingleParagraphMode(boolean) . |
int |
getSpacing()
Gets the amount of spacing between the lines of the layout. |
Rectangle |
getStrongCursorPosition(int index)
Given an index within a layout, determines the positions that of the strong cursor if the insertion point is at that index. |
TabArray |
getTabs()
Retrieve the tabs used for this layout. |
java.lang.String |
getText()
Gets the text in the layout. |
Rectangle |
getWeakCursorPosition(int index)
Given an index within a layout, determines the positions that of the weak cursor if the insertion point is at that index. |
int |
getWidth()
Gets the width to which the lines of the PangoLayout should be wrapped. |
WrapMode |
getWrapMode()
Get the wrap mode for the layout. |
Rectangle |
indexToPos(int index)
Converts from an index within a Layout to the onscreen position corresponding to the grapheme at that index, which is represented as rectangle. |
protected static void |
pango_layout_context_changed(Handle layout)
|
protected static Handle |
pango_layout_copy(Handle src)
|
protected static int |
pango_layout_get_alignment(Handle layout)
|
protected static Handle |
pango_layout_get_attributes(Handle layout)
|
protected static Handle |
pango_layout_get_context(Handle layout)
|
protected static void |
pango_layout_get_cursor_pos(Handle layout,
int index,
Handle strongPos,
Handle weakPos)
|
protected static void |
pango_layout_get_extents(Handle layout,
Handle inkRect,
Handle logicalRect)
|
protected static int |
pango_layout_get_indent(Handle layout)
|
protected static boolean |
pango_layout_get_justify(Handle layout)
|
protected static int |
pango_layout_get_line_count(Handle layout)
|
protected static Handle |
pango_layout_get_line(Handle layout,
int line)
|
protected static void |
pango_layout_get_pixel_extents(Handle layout,
Handle inkRect,
Handle logicalRect)
|
protected static void |
pango_layout_get_pixel_size(Handle layout,
int[] width,
int[] height)
|
protected static boolean |
pango_layout_get_single_paragraph_mode(Handle layout)
|
protected static void |
pango_layout_get_size(Handle layout,
int[] width,
int[] height)
|
protected static int |
pango_layout_get_spacing(Handle layout)
|
protected static Handle |
pango_layout_get_tabs(Handle layout)
|
protected static java.lang.String |
pango_layout_get_text(Handle layout)
|
protected static int |
pango_layout_get_type()
|
protected static int |
pango_layout_get_width(Handle layout)
|
protected static int |
pango_layout_get_wrap(Handle layout)
|
protected static void |
pango_layout_index_to_pos(Handle layout,
int index,
Handle pos)
|
protected static void |
pango_layout_move_cursor_visually(Handle layout,
boolean strong,
int oldIndex,
int oldTrailing,
int direction,
int[] newIndex,
int[] newTrailing)
|
protected static Handle |
pango_layout_new(Handle context)
|
protected static void |
pango_layout_set_alignment(Handle layout,
int alignment)
|
protected static void |
pango_layout_set_attributes(Handle layout,
Handle attrs)
|
protected static void |
pango_layout_set_font_description(Handle layout,
Handle desc)
|
protected static void |
pango_layout_set_indent(Handle layout,
int indent)
|
protected static void |
pango_layout_set_justify(Handle layout,
boolean justify)
|
protected static void |
pango_layout_set_markup_with_accel(Handle layout,
java.lang.String markup,
int length,
byte accelMarker,
byte accelChar)
|
protected static void |
pango_layout_set_markup(Handle layout,
java.lang.String markup,
int length)
|
protected static void |
pango_layout_set_single_paragraph_mode(Handle layout,
boolean setting)
|
protected static void |
pango_layout_set_spacing(Handle layout,
int spacing)
|
protected static void |
pango_layout_set_tabs(Handle layout,
Handle tabs)
|
protected static void |
pango_layout_set_text(Handle layout,
java.lang.String text,
int length)
|
protected static void |
pango_layout_set_width(Handle layout,
int width)
|
protected static void |
pango_layout_set_wrap(Handle layout,
int wrap)
|
protected static boolean |
pango_layout_xy_to_index(Handle layout,
int x,
int y,
int[] index,
int[] trailing)
|
void |
setAlignment(Alignment alignment)
Sets the alignment for the layout (how partial lines are positioned within the horizontal space available.) |
void |
setAttributes(AttrList attributes)
Sets the text attributes for a layout object |
void |
setFontDescription(FontDescription desc)
Set the default font description for the layout. |
void |
setIndent(int indent)
Sets the amount by which the first line should be shorter than the rest of the lines. |
void |
setJustification(boolean justify)
Sets whether or not each complete line should be stretched to fill the entire width of the layout. |
void |
setMarkup(java.lang.String markup)
Same as setMarkup(String, char) , but the markup text isn't
scanned for accelerators. |
void |
setMarkup(java.lang.String markup,
char accelMarker)
Sets the layout text and attribute list from marked-up text (see markup format). |
void |
setSingleParagraphMode(boolean setting)
If setting is 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. |
void |
setSpacing(int spacing)
Sets the amount of spacing between the lines of the layout. |
void |
setTabs(TabArray tabs)
Sets the tabs to use for layout, overriding the default tabs (by default, tabs are every 8 spaces). |
void |
setText(java.lang.String text)
Set the text of the layout. |
void |
setWidth(int width)
Sets the width to which the lines of the PangoLayout should be wrapped. |
void |
setWrapStyle(WrapMode wrap)
Sets the wrap style; the wrap style only has an effect if a width is set on the layout with setWidth(int) To turn off wrapping, set
the width to -1. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Layout(Context context)
context
- The context to use for the Layout construction.public Layout(Layout layout)
layout
- public Layout(Handle handle)
handle
- The handle to the native resource.Method Detail |
public Context getContext()
public void contextChanged()
public void setText(java.lang.String text)
public java.lang.String getText()
public void setMarkup(java.lang.String markup, char accelMarker)
If accelMarker is nonzero, the given character will mark the character
following it as an accelerator. For example, the accel marker might be an
ampersand or underscore. All characters marked as an accelerator will
receive a Underline.LOW
attribute. Two accelMarker characters
following each other produce a single literal accelMarker character.
markup
- some marked-up textaccelMarker
- : marker for accelerators in the textpublic void setMarkup(java.lang.String markup)
setMarkup(String, char)
, but the markup text isn't
scanned for accelerators.
public void setAttributes(AttrList attributes)
public AttrList getAttributes()
public void setFontDescription(FontDescription desc)
public void setWidth(int width)
public int getWidth()
public void setWrapStyle(WrapMode wrap)
setWidth(int)
To turn off wrapping, set
the width to -1.
public WrapMode getWrapMode()
public void setIndent(int indent)
public int getIndent()
public int getSpacing()
public void setSpacing(int spacing)
public void setJustification(boolean justify)
public boolean getJustified()
public void setAlignment(Alignment alignment)
public Alignment getAlignment()
public void setTabs(TabArray tabs)
public TabArray getTabs()
public void setSingleParagraphMode(boolean setting)
public boolean getSingleParagraphMode()
setSingleParagraphMode(boolean)
.
public int getLineCount()
public LayoutLine getLine(int line)
line
- the index of a line, which must be between 0 and
pango_layout_get_line_count(layout) - 1, inclusive.
public Rectangle indexToPos(int index)
index
- public Rectangle getStrongCursorPosition(int index)
index
- public Rectangle getWeakCursorPosition(int index)
index
- public int getHeight()
public int getPixelWidth()
public int getPixelHeight()
protected static final int pango_layout_get_type()
protected static final Handle pango_layout_new(Handle context)
protected static final Handle pango_layout_copy(Handle src)
protected static final Handle pango_layout_get_context(Handle layout)
protected static final void pango_layout_set_attributes(Handle layout, Handle attrs)
protected static final Handle pango_layout_get_attributes(Handle layout)
protected static final void pango_layout_set_text(Handle layout, java.lang.String text, int length)
protected static final java.lang.String pango_layout_get_text(Handle layout)
protected static final void pango_layout_set_markup(Handle layout, java.lang.String markup, int length)
protected static final void pango_layout_set_markup_with_accel(Handle layout, java.lang.String markup, int length, byte accelMarker, byte accelChar)
protected static final void pango_layout_set_font_description(Handle layout, Handle desc)
protected static final void pango_layout_set_width(Handle layout, int width)
protected static final int pango_layout_get_width(Handle layout)
protected static final void pango_layout_set_wrap(Handle layout, int wrap)
protected static final int pango_layout_get_wrap(Handle layout)
protected static final void pango_layout_set_indent(Handle layout, int indent)
protected static final int pango_layout_get_indent(Handle layout)
protected static final void pango_layout_set_spacing(Handle layout, int spacing)
protected static final int pango_layout_get_spacing(Handle layout)
protected static final void pango_layout_set_justify(Handle layout, boolean justify)
protected static final boolean pango_layout_get_justify(Handle layout)
protected static final void pango_layout_set_alignment(Handle layout, int alignment)
protected static final int pango_layout_get_alignment(Handle layout)
protected static final void pango_layout_set_tabs(Handle layout, Handle tabs)
protected static final Handle pango_layout_get_tabs(Handle layout)
protected static final void pango_layout_set_single_paragraph_mode(Handle layout, boolean setting)
protected static final boolean pango_layout_get_single_paragraph_mode(Handle layout)
protected static final void pango_layout_context_changed(Handle layout)
protected static final void pango_layout_index_to_pos(Handle layout, int index, Handle pos)
protected static final void pango_layout_get_cursor_pos(Handle layout, int index, Handle strongPos, Handle weakPos)
protected static final void pango_layout_move_cursor_visually(Handle layout, boolean strong, int oldIndex, int oldTrailing, int direction, int[] newIndex, int[] newTrailing)
protected static final boolean pango_layout_xy_to_index(Handle layout, int x, int y, int[] index, int[] trailing)
protected static final void pango_layout_get_extents(Handle layout, Handle inkRect, Handle logicalRect)
protected static final void pango_layout_get_pixel_extents(Handle layout, Handle inkRect, Handle logicalRect)
protected static final void pango_layout_get_size(Handle layout, int[] width, int[] height)
protected static final void pango_layout_get_pixel_size(Handle layout, int[] width, int[] height)
protected static final int pango_layout_get_line_count(Handle layout)
protected static final Handle pango_layout_get_line(Handle layout, int line)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |