java.lang.Object
org.gjt.sp.jedit.syntax.Token
org.gjt.sp.jedit.syntax.Chunk
A syntax token with extra information required for painting it
on screen.
- Since:
- jEdit 4.1pre1
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic FontderiveSubstFont(Font mainFont, Font candidateFont) Derives a font to match the main font for purposes of font substitution.static FontgetSubstFont(int codepoint) Returns the first font which can display a character from configured substitution candidates, or null if there is no such font.static floatConverts an offset in a chunk list into an x co-ordinate.static floatpaintChunkBackgrounds(Chunk chunks, Graphics2D gfx, float x, float y, float lineHeight) Paints the background highlights of a chunk list.static floatpaintChunkList(Chunk chunks, Graphics2D gfx, float x, float y, boolean glyphVector) Paints a chunk list.static voidReload internal configuration based on the given properties.booleanReturns true if font substitution was used in the layout of this chunk.static intConverts an x co-ordinate in a chunk list into an offset.Methods inherited from class org.gjt.sp.jedit.syntax.Token
isCommentOrLiteral, stringToToken, tokenToString, toString
-
Field Details
-
EMPTY_FONT_ARRAY
-
EMPTY_GLYPH_VECTOR_ARRAY
-
-
Method Details
-
paintChunkList
public static float paintChunkList(Chunk chunks, Graphics2D gfx, float x, float y, boolean glyphVector) Paints a chunk list.- Parameters:
chunks- The chunk listgfx- The graphics contextx- The x co-ordinatey- The y co-ordinateglyphVector- true if we want to use glyphVector, false if we want to use drawString- Returns:
- The width of the painted text
- Since:
- jEdit 4.2pre1
-
paintChunkBackgrounds
public static float paintChunkBackgrounds(Chunk chunks, Graphics2D gfx, float x, float y, float lineHeight) Paints the background highlights of a chunk list.- Parameters:
chunks- The chunk listgfx- The graphics contextx- The x co-ordinatey- The y co-ordinate- Returns:
- The width of the painted backgrounds
- Since:
- jEdit 4.2pre1
-
offsetToX
Converts an offset in a chunk list into an x co-ordinate.- Parameters:
chunks- The chunk listoffset- The offset- Since:
- jEdit 4.1pre1
-
xToOffset
Converts an x co-ordinate in a chunk list into an offset.- Parameters:
chunks- The chunk listx- The x co-ordinateround- Round up to next letter if past the middle of a letter?- Returns:
- The offset within the line, or -1 if the x co-ordinate is too far to the right
- Since:
- jEdit 4.1pre1
-
propertiesChanged
Reload internal configuration based on the given properties.- Parameters:
props- Configuration properties.- Since:
- jEdit 4.4pre1
-
getSubstFont
Returns the first font which can display a character from configured substitution candidates, or null if there is no such font. -
deriveSubstFont
Derives a font to match the main font for purposes of font substitution. Preserves any transformations from main font. For system-fallback fonts, derives size and style from main font.- Parameters:
mainFont- Font to derive fromcandidateFont- Font to transform
-
usedFontSubstitution
public boolean usedFontSubstitution()Returns true if font substitution was used in the layout of this chunk. If substitution was not used, the chunk may be assumed to be composed of one glyph using a single font.
-