Oxygen XML Editor 14.2 Author API

ro.sync.exml.view.graphics
Interface FontMetrics


@API(type=NOT_EXTENDABLE,
     src=PRIVATE)
public interface FontMetrics

Common font metrics


Method Summary
 int charsWidth(char[] chars, int off, int len)
          Returns the total advance width for showing the specified array of characters in this Font.
 int charWidth(char c)
          Get the char width
 int getAscent()
          The font ascent is the distance from the font's baseline to the top of most alphanumeric characters.
 int getCorrectedBreakYForWrappedString(ro.sync.exml.view.graphics.AttributedString aStr, int wrappingWidth, int initialBreak)
          Gets the y coordinate where the given wrapped string bounds can be split without cutting off a text line.
 int getDescent()
          The font descent is the distance from the font's baseline to the bottom of most alphanumeric characters with descenders.
 int getHeight()
           
 int getLeading()
          Determines the standard leading of the Font described by this FontMetrics object.
 Rectangle getWrappedStringBounds(ro.sync.exml.view.graphics.AttributedString aStr, int wrappingWidth)
          Gets the bounds of a string that is wrapped at the wrappingWidth.
 int stringWidth(java.lang.String text)
          Returns the total advance width for showing the specified String in this Font.
 

Method Detail

charsWidth

int charsWidth(char[] chars,
               int off,
               int len)
Returns the total advance width for showing the specified array of characters in this Font.

Parameters:
chars - the array of characters to be measured
off - the start offset of the characters in the array
len - the number of characters to be measured from the array
Returns:
the advance width of the subarray of the specified char array in the font described by this FontMetrics object.

getAscent

int getAscent()
The font ascent is the distance from the font's baseline to the top of most alphanumeric characters.

Returns:
The font ascent.

getDescent

int getDescent()
The font descent is the distance from the font's baseline to the bottom of most alphanumeric characters with descenders.

Returns:
The ont descent.

stringWidth

int stringWidth(java.lang.String text)
Returns the total advance width for showing the specified String in this Font.

Parameters:
text - The text.
Returns:
The width of the text.

getHeight

int getHeight()
Returns:
The font height

charWidth

int charWidth(char c)
Get the char width

Parameters:
c - The char
Returns:
The char width

getLeading

int getLeading()
Determines the standard leading of the Font described by this FontMetrics object. The standard leading, or interline spacing, is the logical amount of space to be reserved between the descent of one line of text and the ascent of the next line. The height metric is calculated to include this extra space.

Returns:
the standard leading of the Font.

getWrappedStringBounds

Rectangle getWrappedStringBounds(ro.sync.exml.view.graphics.AttributedString aStr,
                                 int wrappingWidth)
Gets the bounds of a string that is wrapped at the wrappingWidth. Takes into account newlines.

Parameters:
aStr - The text, as an attributed string. The {TextAttribute#FONT} and {TextAttribute#FOREGROUND} contain values that are instances of Font and Color.
wrappingWidth - The maximum width of the text.
Returns:
The bounds of the wrapped string.

getCorrectedBreakYForWrappedString

int getCorrectedBreakYForWrappedString(ro.sync.exml.view.graphics.AttributedString aStr,
                                       int wrappingWidth,
                                       int initialBreak)
Gets the y coordinate where the given wrapped string bounds can be split without cutting off a text line. If the given initial break Y is inside a text line, the resulting break will point to the top of the text line. Otherwise -1 is returned.

Parameters:
aStr - The text, as an attributed string. The {TextAttribute#FONT} and {TextAttribute#FOREGROUND} contain values that are instances of Font and Color.
wrappingWidth - The maximum width of the text.
initialBreak - The initial break Y coordinate.
Returns:
The corrected Y break coordinate or -1 if the initial break is not placed inside a text line.

Oxygen XML Editor 14.2 Author API

© Copyright SyncRO Soft SRL 2002 - 2013. All rights reserved.