javax.swing.text
Class GlyphView.GlyphPainter
- GlyphView
An abstract base implementation for a glyph painter for
GlyphView
.
abstract float | getAscent(GlyphView v) - Returns the ascent of the font that is used by this glyph painter.
|
abstract int | getBoundedPosition(GlyphView v, int p0, float x, float len) - Determines the model offset, so that the text between
p0
and this offset fits within the span starting at x with
the length of len .
|
abstract float | getDescent(GlyphView v) - Returns the descent of the font that is used by this glyph painter.
|
abstract float | getHeight(GlyphView view) - Returns the full height of the rendered text.
|
int | getNextVisualPositionFrom(GlyphView v, int pos, Position.Bias b, Shape a, int direction, Position.Bias[] biasRet) - Returns the model location that should be used to place a caret when
moving the caret through the document.
|
GlyphView.GlyphPainter | getPainter(GlyphView v, int p0, int p1) - Returns a painter that can be used to render the specified glyph view.
|
abstract float | getSpan(GlyphView view, int p0, int p1, TabExpander te, float x) - Determine the span of the glyphs from location
p0 to
location p1 .
|
abstract Shape | modelToView(GlyphView view, int pos, Position.Bias b, Shape a) - Maps a position in the document into the coordinate space of the View.
|
abstract void | paint(GlyphView view, Graphics g, Shape a, int p0, int p1) - Paints the glyphs.
|
abstract int | viewToModel(GlyphView v, float x, float y, Shape a, Position.Bias[] biasRet) - Maps a visual position into a document location.
|
clone , equals , extends Object> getClass , finalize , hashCode , notify , notifyAll , toString , wait , wait , wait |
GlyphPainter
public GlyphPainter()
Creates a new GlyphPainer
.
getAscent
public abstract float getAscent(GlyphView v)
Returns the ascent of the font that is used by this glyph painter.
- the ascent of the font that is used by this glyph painter
getBoundedPosition
public abstract int getBoundedPosition(GlyphView v,
int p0,
float x,
float len)
Determines the model offset, so that the text between p0
and this offset fits within the span starting at x
with
the length of len
.
v
- the glyph viewp0
- the starting offset in the modelx
- the start location in the viewlen
- the length of the span in the view
getDescent
public abstract float getDescent(GlyphView v)
Returns the descent of the font that is used by this glyph painter.
- the descent of the font that is used by this glyph painter
getHeight
public abstract float getHeight(GlyphView view)
Returns the full height of the rendered text.
- the full height of the rendered text
getPainter
public GlyphView.GlyphPainter getPainter(GlyphView v,
int p0,
int p1)
Returns a painter that can be used to render the specified glyph view.
If this glyph painter is stateful, then it should return a new instance.
However, if this painter is stateless it should return itself. The
default behaviour is to return itself.
v
- the glyph view for which to create a painterp0
- the start offset of the rendered areap1
- the end offset of the rendered area
- a painter that can be used to render the specified glyph view
getSpan
public abstract float getSpan(GlyphView view,
int p0,
int p1,
TabExpander te,
float x)
Determine the span of the glyphs from location p0
to
location p1
. If te
is not null
,
then TABs are expanded using this TabExpander
.
The parameter x
is the location at which the view is
located (this is important when using TAB expansion).
view
- the glyph viewp0
- the starting location in the document modelp1
- the end location in the document modelte
- the tab expander to usex
- the location at which the view is located
- the span of the glyphs from location
p0
to
location p1
, possibly using TAB expansion
modelToView
public abstract Shape modelToView(GlyphView view,
int pos,
Position.Bias b,
Shape a)
throws BadLocationException
Maps a position in the document into the coordinate space of the View.
The output rectangle usually reflects the font height but has a width
of zero.
view
- the glyph viewpos
- the position of the character in the modelb
- either Position.Bias.Forward
or
Position.Bias.Backward
depending on the preferred
direction bias. If null
this defaults to
Position.Bias.Forward
a
- the area that is occupied by the view
- a rectangle that gives the location of the document position
inside the view coordinate space
paint
public abstract void paint(GlyphView view,
Graphics g,
Shape a,
int p0,
int p1)
Paints the glyphs.
view
- the glyph view to paintg
- the graphics context to use for paintinga
- the allocation of the glyph viewp0
- the start position (in the model) from which to paintp1
- the end position (in the model) to which to paint
viewToModel
public abstract int viewToModel(GlyphView v,
float x,
float y,
Shape a,
Position.Bias[] biasRet)
Maps a visual position into a document location.
v
- the glyph viewx
- the X coordinate of the visual positiony
- the Y coordinate of the visual positiona
- the allocated regionbiasRet
- filled with the bias of the model location on method exit
- the model location that represents the specified view location
GlyphView.java -- A view to render styled text
Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.