A collection of methods to deal with various text related activities.
A collection of methods to deal with various text related activities.
(*draw-tabbed-text s x y g e start-offset)
Draws the given text, expanding any tabs that are contained using the given tab expansion technique. This particular implementation renders in a 1.1 style coordinate system where ints are used and 72dpi is assumed.
s - the source of the text - javax.swing.text.Segment
x - the X origin >= 0 - int
y - the Y origin >= 0 - int
g - the graphics context - java.awt.Graphics
e - how to expand the tabs. If this value is null, tabs will be expanded as a space character. - javax.swing.text.TabExpander
start-offset - starting offset of the text in the document >= 0 - int
returns: the X location at the end of the rendered text - int
Draws the given text, expanding any tabs that are contained using the given tab expansion technique. This particular implementation renders in a 1.1 style coordinate system where ints are used and 72dpi is assumed. s - the source of the text - `javax.swing.text.Segment` x - the X origin >= 0 - `int` y - the Y origin >= 0 - `int` g - the graphics context - `java.awt.Graphics` e - how to expand the tabs. If this value is null, tabs will be expanded as a space character. - `javax.swing.text.TabExpander` start-offset - starting offset of the text in the document >= 0 - `int` returns: the X location at the end of the rendered text - `int`
(*get-break-location s metrics x-0 x e start-offset)
Determine where to break the given text to fit within the given span. This tries to find a word boundary.
s - the source of the text - javax.swing.text.Segment
metrics - the font metrics to use for the calculation - java.awt.FontMetrics
x-0 - the starting view location representing the start of the given text. - int
x - the target view location to translate to an offset into the text. - int
e - how to expand the tabs. If this value is null, tabs will be expanded as a space character. - javax.swing.text.TabExpander
start-offset - starting offset in the document of the text - int
returns: the offset into the given text - int
Determine where to break the given text to fit within the given span. This tries to find a word boundary. s - the source of the text - `javax.swing.text.Segment` metrics - the font metrics to use for the calculation - `java.awt.FontMetrics` x-0 - the starting view location representing the start of the given text. - `int` x - the target view location to translate to an offset into the text. - `int` e - how to expand the tabs. If this value is null, tabs will be expanded as a space character. - `javax.swing.text.TabExpander` start-offset - starting offset in the document of the text - `int` returns: the offset into the given text - `int`
(*get-next-word c offs)
Determines the start of the next word for the given location. Uses BreakIterator.getWordInstance() to actually get the words.
c - the editor - javax.swing.text.JTextComponent
offs - the offset in the document >= 0 - int
returns: the location in the model of the word start >= 0 - int
throws: javax.swing.text.BadLocationException - if the offset is out of range
Determines the start of the next word for the given location. Uses BreakIterator.getWordInstance() to actually get the words. c - the editor - `javax.swing.text.JTextComponent` offs - the offset in the document >= 0 - `int` returns: the location in the model of the word start >= 0 - `int` throws: javax.swing.text.BadLocationException - if the offset is out of range
(*get-paragraph-element c offs)
Determines the element to use for a paragraph/line.
c - the editor - javax.swing.text.JTextComponent
offs - the starting offset in the document >= 0 - int
returns: the element - javax.swing.text.Element
Determines the element to use for a paragraph/line. c - the editor - `javax.swing.text.JTextComponent` offs - the starting offset in the document >= 0 - `int` returns: the element - `javax.swing.text.Element`
(*get-position-above c offs x)
Determines the position in the model that is closest to the given view location in the row above. The component given must have a size to compute the result. If the component doesn't have a size a value of -1 will be returned.
c - the editor - javax.swing.text.JTextComponent
offs - the offset in the document >= 0 - int
x - the X coordinate >= 0 - int
returns: the position >= 0 if the request can be computed, otherwise
a value of -1 will be returned. - int
throws: javax.swing.text.BadLocationException - if the offset is out of range
Determines the position in the model that is closest to the given view location in the row above. The component given must have a size to compute the result. If the component doesn't have a size a value of -1 will be returned. c - the editor - `javax.swing.text.JTextComponent` offs - the offset in the document >= 0 - `int` x - the X coordinate >= 0 - `int` returns: the position >= 0 if the request can be computed, otherwise a value of -1 will be returned. - `int` throws: javax.swing.text.BadLocationException - if the offset is out of range
(*get-position-below c offs x)
Determines the position in the model that is closest to the given view location in the row below. The component given must have a size to compute the result. If the component doesn't have a size a value of -1 will be returned.
c - the editor - javax.swing.text.JTextComponent
offs - the offset in the document >= 0 - int
x - the X coordinate >= 0 - int
returns: the position >= 0 if the request can be computed, otherwise
a value of -1 will be returned. - int
throws: javax.swing.text.BadLocationException - if the offset is out of range
Determines the position in the model that is closest to the given view location in the row below. The component given must have a size to compute the result. If the component doesn't have a size a value of -1 will be returned. c - the editor - `javax.swing.text.JTextComponent` offs - the offset in the document >= 0 - `int` x - the X coordinate >= 0 - `int` returns: the position >= 0 if the request can be computed, otherwise a value of -1 will be returned. - `int` throws: javax.swing.text.BadLocationException - if the offset is out of range
(*get-previous-word c offs)
Determine the start of the prev word for the given location. Uses BreakIterator.getWordInstance() to actually get the words.
c - the editor - javax.swing.text.JTextComponent
offs - the offset in the document >= 0 - int
returns: the location in the model of the word start >= 0 - int
throws: javax.swing.text.BadLocationException - if the offset is out of range
Determine the start of the prev word for the given location. Uses BreakIterator.getWordInstance() to actually get the words. c - the editor - `javax.swing.text.JTextComponent` offs - the offset in the document >= 0 - `int` returns: the location in the model of the word start >= 0 - `int` throws: javax.swing.text.BadLocationException - if the offset is out of range
(*get-row-end c offs)
Determines the ending row model position of the row that contains the specified model position. The component given must have a size to compute the result. If the component doesn't have a size a value of -1 will be returned.
c - the editor - javax.swing.text.JTextComponent
offs - the offset in the document >= 0 - int
returns: the position >= 0 if the request can be computed, otherwise
a value of -1 will be returned. - int
throws: javax.swing.text.BadLocationException - if the offset is out of range
Determines the ending row model position of the row that contains the specified model position. The component given must have a size to compute the result. If the component doesn't have a size a value of -1 will be returned. c - the editor - `javax.swing.text.JTextComponent` offs - the offset in the document >= 0 - `int` returns: the position >= 0 if the request can be computed, otherwise a value of -1 will be returned. - `int` throws: javax.swing.text.BadLocationException - if the offset is out of range
(*get-row-start c offs)
Determines the starting row model position of the row that contains the specified model position. The component given must have a size to compute the result. If the component doesn't have a size a value of -1 will be returned.
c - the editor - javax.swing.text.JTextComponent
offs - the offset in the document >= 0 - int
returns: the position >= 0 if the request can be computed, otherwise
a value of -1 will be returned. - int
throws: javax.swing.text.BadLocationException - if the offset is out of range
Determines the starting row model position of the row that contains the specified model position. The component given must have a size to compute the result. If the component doesn't have a size a value of -1 will be returned. c - the editor - `javax.swing.text.JTextComponent` offs - the offset in the document >= 0 - `int` returns: the position >= 0 if the request can be computed, otherwise a value of -1 will be returned. - `int` throws: javax.swing.text.BadLocationException - if the offset is out of range
(*get-tabbed-text-offset s metrics x-0 x e start-offset)
(*get-tabbed-text-offset s metrics x-0 x e start-offset round)
Determines the relative offset into the given text that best represents the given span in the view coordinate system. This is implemented in a 1.1 style coordinate system where ints are used and 72dpi is assumed.
s - the source of the text - javax.swing.text.Segment
metrics - the font metrics to use for the calculation - java.awt.FontMetrics
x-0 - the starting view location representing the start of the given text >= 0. - int
x - the target view location to translate to an offset into the text >= 0. - int
e - how to expand the tabs. If this value is null, tabs will be expanded as a space character. - javax.swing.text.TabExpander
start-offset - starting offset of the text in the document >= 0 - int
returns: the offset into the text >= 0 - int
Determines the relative offset into the given text that best represents the given span in the view coordinate system. This is implemented in a 1.1 style coordinate system where ints are used and 72dpi is assumed. s - the source of the text - `javax.swing.text.Segment` metrics - the font metrics to use for the calculation - `java.awt.FontMetrics` x-0 - the starting view location representing the start of the given text >= 0. - `int` x - the target view location to translate to an offset into the text >= 0. - `int` e - how to expand the tabs. If this value is null, tabs will be expanded as a space character. - `javax.swing.text.TabExpander` start-offset - starting offset of the text in the document >= 0 - `int` returns: the offset into the text >= 0 - `int`
(*get-tabbed-text-width s metrics x e start-offset)
Determines the width of the given segment of text taking tabs into consideration. This is implemented in a 1.1 style coordinate system where ints are used and 72dpi is assumed.
s - the source of the text - javax.swing.text.Segment
metrics - the font metrics to use for the calculation - java.awt.FontMetrics
x - the X origin >= 0 - int
e - how to expand the tabs. If this value is null, tabs will be expanded as a space character. - javax.swing.text.TabExpander
start-offset - starting offset of the text in the document >= 0 - int
returns: the width of the text - int
Determines the width of the given segment of text taking tabs into consideration. This is implemented in a 1.1 style coordinate system where ints are used and 72dpi is assumed. s - the source of the text - `javax.swing.text.Segment` metrics - the font metrics to use for the calculation - `java.awt.FontMetrics` x - the X origin >= 0 - `int` e - how to expand the tabs. If this value is null, tabs will be expanded as a space character. - `javax.swing.text.TabExpander` start-offset - starting offset of the text in the document >= 0 - `int` returns: the width of the text - `int`
(*get-word-end c offs)
Determines the end of a word for the given location. Uses BreakIterator.getWordInstance() to actually get the words.
c - the editor - javax.swing.text.JTextComponent
offs - the offset in the document >= 0 - int
returns: the location in the model of the word end >= 0 - int
throws: javax.swing.text.BadLocationException - if the offset is out of range
Determines the end of a word for the given location. Uses BreakIterator.getWordInstance() to actually get the words. c - the editor - `javax.swing.text.JTextComponent` offs - the offset in the document >= 0 - `int` returns: the location in the model of the word end >= 0 - `int` throws: javax.swing.text.BadLocationException - if the offset is out of range
(*get-word-start c offs)
Determines the start of a word for the given model location. Uses BreakIterator.getWordInstance() to actually get the words.
c - the editor - javax.swing.text.JTextComponent
offs - the offset in the document >= 0 - int
returns: the location in the model of the word start >= 0 - int
throws: javax.swing.text.BadLocationException - if the offset is out of range
Determines the start of a word for the given model location. Uses BreakIterator.getWordInstance() to actually get the words. c - the editor - `javax.swing.text.JTextComponent` offs - the offset in the document >= 0 - `int` returns: the location in the model of the word start >= 0 - `int` throws: javax.swing.text.BadLocationException - if the offset is out of range
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close