44 |
import java.awt.Graphics; |
import java.awt.Graphics; |
45 |
import java.awt.Rectangle; |
import java.awt.Rectangle; |
46 |
import java.awt.Shape; |
import java.awt.Shape; |
47 |
|
import java.awt.Toolkit; |
48 |
import java.text.BreakIterator; |
import java.text.BreakIterator; |
49 |
|
|
50 |
import javax.swing.SwingConstants; |
import javax.swing.SwingConstants; |
72 |
*/ |
*/ |
73 |
public GlyphPainter() |
public GlyphPainter() |
74 |
{ |
{ |
75 |
|
// Nothing to do here. |
76 |
} |
} |
77 |
|
|
78 |
/** |
/** |
260 |
public float getHeight(GlyphView view) |
public float getHeight(GlyphView view) |
261 |
{ |
{ |
262 |
Font font = view.getFont(); |
Font font = view.getFont(); |
263 |
FontMetrics metrics = view.getContainer().getFontMetrics(font); |
FontMetrics metrics = Toolkit.getDefaultToolkit().getFontMetrics(font); |
264 |
float height = metrics.getHeight(); |
float height = metrics.getHeight(); |
265 |
return height; |
return height; |
266 |
} |
} |
379 |
{ |
{ |
380 |
Element el = view.getElement(); |
Element el = view.getElement(); |
381 |
Font font = view.getFont(); |
Font font = view.getFont(); |
382 |
FontMetrics fm = view.getContainer().getFontMetrics(font); |
FontMetrics fm = Toolkit.getDefaultToolkit().getFontMetrics(font); |
383 |
Segment txt = view.getText(p0, p1); |
Segment txt = view.getText(p0, p1); |
384 |
int span = Utilities.getTabbedTextWidth(txt, fm, (int) x, te, p0); |
int span = Utilities.getTabbedTextWidth(txt, fm, (int) x, te, p0); |
385 |
return span; |
return span; |
666 |
} |
} |
667 |
catch (BadLocationException ex) |
catch (BadLocationException ex) |
668 |
{ |
{ |
669 |
throw new AssertionError("BadLocationException must not be thrown " |
AssertionError ae; |
670 |
+ "here"); |
ae = new AssertionError("BadLocationException must not be thrown " |
671 |
|
+ "here"); |
672 |
|
ae.initCause(ex); |
673 |
|
throw ae; |
674 |
} |
} |
675 |
FontMetrics fm = null; // Fetch font metrics somewhere. |
FontMetrics fm = null; // Fetch font metrics somewhere. |
676 |
return Utilities.getTabbedTextWidth(seg, fm, 0, null, p0); |
return Utilities.getTabbedTextWidth(seg, fm, 0, null, p0); |
717 |
} |
} |
718 |
catch (BadLocationException ex) |
catch (BadLocationException ex) |
719 |
{ |
{ |
720 |
throw new AssertionError("BadLocationException should not be " |
AssertionError ae; |
721 |
+ "thrown here. p0 = " + p0 + ", p1 = " + p1); |
ae = new AssertionError("BadLocationException should not be " |
722 |
|
+ "thrown here. p0 = " + p0 + ", p1 = " + p1); |
723 |
|
ae.initCause(ex); |
724 |
|
throw ae; |
725 |
} |
} |
726 |
|
|
727 |
return txt; |
return txt; |