org.gnu.pango

Class Layout

public class Layout extends GObject

Deprecated: This class is part of the java-gnome 2.x family of libraries, which, due to their inefficiency and complexity, are no longer being maintained and have been abandoned by the java-gnome project. This class may exist in java-gnome 4.0; look out for org.gnome.pango.Layout. As this package was never fully implemented in java-gnome 2.x, however, any new code written will have a considerably different public API.

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.

Constructor Summary
Layout(Context context)
Construct a new Layout with the given Context.
Layout(Layout layout)
Construct a new Layout that is a copy of the provided Layout.
Layout(Handle handle)
Construct a new Layout with a handle that has been returned from a native call.
Method Summary
voidcontextChanged()
Forces recomputation of any state in the Layout that might depend on the layout's context.
AlignmentgetAlignment()
Gets the alignment for the layout (how partial lines are positioned within the horizontal space available.)
AttrListgetAttributes()
Gets the attribute list for the layout, if any
ContextgetContext()
Retrieve the Context used for this Layout.
intgetHeight()
Return the logical height of the Layout in Pango units.
intgetIndent()
Gets the amount by which the first line should be shorter than the rest of the lines.
booleangetJustified()
Gets whether or not each complete line should be stretched to fill the entire width of the layout.
booleangetJustify()
Gets whether or not each complete line should be stretched to fill the entire width of the layout.
static LayoutgetLayoutFromHandle(Handle handle)
Static factory method that should only be used interally by Java-Gnome.
LayoutLinegetLine(int line)
Retrieves a particular line from a Layout.
intgetLineCount()
Retrieve the count of lines for the layout
intgetPixelHeight()
Return the logical height of the Layout in device units.
intgetPixelWidth()
Return the logical width of the Layout in device units.
booleangetSingleParagraphMode()
Obtains the value set by Layout.
intgetSpacing()
Gets the amount of spacing between the lines of the layout.
RectanglegetStrongCursorPosition(int index)
Given an index within a layout, determines the positions that of the strong cursor if the insertion point is at that index.
TabArraygetTabs()
Gets the current TabArray used by this layout.
StringgetText()
Gets the text in the layout.
RectanglegetWeakCursorPosition(int index)
Given an index within a layout, determines the positions that of the weak cursor if the insertion point is at that index.
intgetWidth()
Gets the width to which the lines of the PangoLayout should be wrapped.
WrapModegetWrap()
Get the wrap mode for the layout.
WrapModegetWrapMode()
Get the wrap mode for the layout.
RectangleindexToPos(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.
voidsetAlignment(Alignment alignment)
Sets the alignment for the layout (how partial lines are positioned within the horizontal space available.)
voidsetAttributes(AttrList attributes)
Sets the text attributes for a layout object
voidsetFontDescription(FontDescription desc)
Set the default font description for the layout.
voidsetIndent(int indent)
Sets the amount by which the first line should be shorter than the rest of the lines.
voidsetJustification(boolean justify)
Sets whether or not each complete line should be stretched to fill the entire width of the layout.
voidsetJustify(boolean justify)
Sets whether or not each complete line should be stretched to fill the entire width of the layout.
voidsetMarkup(String markup, char accelMarker)
Sets the layout text and attribute list from marked-up text (see markup format).
voidsetMarkup(String markup)
Same as Layout, but the markup text isn't scanned for accelerators.
voidsetSingleParagraphMode(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.
voidsetSpacing(int spacing)
Sets the amount of spacing between the lines of the layout.
voidsetTabs(TabArray tabs)
Sets the tabs to use for layout, overriding the default tabs (by default, tabs are every 8 spaces).
voidsetText(String text)
Set the text of the layout.
voidsetWidth(int width)
Sets the width to which the lines of the PangoLayout should be wrapped.
voidsetWrap(WrapMode wrap)
Sets the wrap style; the wrap style only has an effect if a width is set on the layout with LayoutTo turn off wrapping, set the width to -1.
voidsetWrapStyle(WrapMode wrap)
Sets the wrap style; the wrap style only has an effect if a width is set on the layout with LayoutTo turn off wrapping, set the width to -1.

Constructor Detail

Layout

public Layout(Context context)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Construct a new Layout with the given Context.

Parameters: context The context to use for the Layout construction.

Layout

public Layout(Layout layout)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Construct a new Layout that is a copy of the provided Layout.

Parameters: layout

Layout

public Layout(Handle handle)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Construct a new Layout with a handle that has been returned from a native call.

Parameters: handle The handle to the native resource.

Method Detail

contextChanged

public void contextChanged()

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Forces recomputation of any state in the Layout that might depend on the layout's context. This method should be called if you make changes to the context subsequent to creating the layout

getAlignment

public Alignment getAlignment()

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Gets the alignment for the layout (how partial lines are positioned within the horizontal space available.)

getAttributes

public AttrList getAttributes()

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Gets the attribute list for the layout, if any

getContext

public Context getContext()

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Retrieve the Context used for this Layout.

getHeight

public int getHeight()

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Return the logical height of the Layout in Pango units.

getIndent

public int getIndent()

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Gets the amount by which the first line should be shorter than the rest of the lines.

getJustified

public boolean getJustified()

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Gets whether or not each complete line should be stretched to fill the entire width of the layout.

getJustify

public boolean getJustify()

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Gets whether or not each complete line should be stretched to fill the entire width of the layout.

getLayoutFromHandle

public static Layout getLayoutFromHandle(Handle handle)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Static factory method that should only be used interally by Java-Gnome.

getLine

public LayoutLine getLine(int line)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Retrieves a particular line from a Layout.

Parameters: line the index of a line, which must be between 0 and pango_layout_get_line_count(layout) - 1, inclusive.

Returns: the requested LayoutLine.

getLineCount

public int getLineCount()

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Retrieve the count of lines for the layout

getPixelHeight

public int getPixelHeight()

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Return the logical height of the Layout in device units.

getPixelWidth

public int getPixelWidth()

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Return the logical width of the Layout in device units.

getSingleParagraphMode

public boolean getSingleParagraphMode()

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Obtains the value set by Layout.

getSpacing

public int getSpacing()

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Gets the amount of spacing between the lines of the layout.

Returns: the spacing (in thousandths of a device unit)

getStrongCursorPosition

public Rectangle getStrongCursorPosition(int index)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Given an index within a layout, determines the positions that of the strong cursor if the insertion point is at that index. 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.

Parameters: index

getTabs

public TabArray getTabs()

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Gets the current TabArray used by this layout. If no TabArray has been set, then the default tabs are in use and null is returned. Default tabs are every 8 spaces.

getText

public String getText()

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Gets the text in the layout.

getWeakCursorPosition

public Rectangle getWeakCursorPosition(int index)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Given an index within a layout, determines the positions that of the weak cursor if the insertion point is at that index. The position of each cursor is stored as a zero-width rectangle. The weak cursor location is the location where characters of the directionality opposite to the base direction of the layout are inserted.

Parameters: index

getWidth

public int getWidth()

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Gets the width to which the lines of the PangoLayout should be wrapped.

getWrap

public WrapMode getWrap()

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Get the wrap mode for the layout.

getWrapMode

public WrapMode getWrapMode()

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Get the wrap mode for the layout.

indexToPos

public Rectangle indexToPos(int index)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Converts from an index within a Layout to the onscreen position corresponding to the grapheme at that index, which is represented as rectangle. Note that pos->x is always the leading edge of the grapheme and pos->x + pos->width the trailing edge of the grapheme. If the directionality of the grapheme is right-to-left, then pos->width will be negative.

Parameters: index

setAlignment

public void setAlignment(Alignment alignment)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Sets the alignment for the layout (how partial lines are positioned within the horizontal space available.)

setAttributes

public void setAttributes(AttrList attributes)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Sets the text attributes for a layout object

setFontDescription

public void setFontDescription(FontDescription desc)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

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

setIndent

public void setIndent(int indent)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Sets the amount by which the first line should be shorter than the rest of the lines. This may 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

setJustification

public void setJustification(boolean justify)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Sets whether or not each complete line should be stretched to fill the entire width of the layout. This stretching is typically done by adding whitespace, but for some scripts (such as Arabic), the justification is done by extending the characters.

setJustify

public void setJustify(boolean justify)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Sets whether or not each complete line should be stretched to fill the entire width of the layout. This stretching is typically done by adding whitespace, but for some scripts (such as Arabic), the justification is done by extending the characters.

setMarkup

public void setMarkup(String markup, char accelMarker)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Sets the layout text and attribute list from marked-up text (see markup format). Replaces the current text and attribute list.

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 LOW attribute. Two accelMarker characters following each other produce a single literal accelMarker character.

Parameters: markup some marked-up text accelMarker : marker for accelerators in the text

setMarkup

public void setMarkup(String markup)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Same as Layout, but the markup text isn't scanned for accelerators.

setSingleParagraphMode

public void setSingleParagraphMode(boolean setting)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

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. Used when you want to allow editing of newlines on a single text line.

setSpacing

public void setSpacing(int spacing)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Sets the amount of spacing between the lines of the layout.

setTabs

public void setTabs(TabArray tabs)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Sets the tabs to use for layout, overriding the default tabs (by default, tabs are every 8 spaces).

setText

public void setText(String text)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Set the text of the layout.

setWidth

public void setWidth(int width)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Sets the width to which the lines of the PangoLayout should be wrapped.

setWrap

public void setWrap(WrapMode wrap)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Sets the wrap style; the wrap style only has an effect if a width is set on the layout with LayoutTo turn off wrapping, set the width to -1.

setWrapStyle

public void setWrapStyle(WrapMode wrap)

Deprecated: Superceeded by java-gnome 4.0; this method or constant will no doubt exist conceptually, but it may have a different name or signature in order that the presented API is an algorithmic mapping of the underlying native libraries.

Sets the wrap style; the wrap style only has an effect if a width is set on the layout with LayoutTo turn off wrapping, set the width to -1.