org.jhotdraw.contrib.zoom
Class ScalingGraphics.ScalingFontMetrics

java.lang.Object
  extended by java.awt.FontMetrics
      extended by org.jhotdraw.contrib.zoom.ScalingGraphics.ScalingFontMetrics
All Implemented Interfaces:
java.io.Serializable
Enclosing class:
ScalingGraphics

private class ScalingGraphics.ScalingFontMetrics
extends java.awt.FontMetrics

A scaling extension of the FontMetrics class. Measurements are performed on the actual, scaled font used on the screen, and then scaled back into user space. The object pretends to be measuring the font specified by the user when obtaining this FontMetrics object.


Field Summary
private  java.awt.FontMetrics real
          A FontMetrics object on the real, scaled font.
private  java.awt.Font userFont
          The font which the user thinks he is asking about.
 
Fields inherited from class java.awt.FontMetrics
font
 
Constructor Summary
ScalingGraphics.ScalingFontMetrics(java.awt.Font newUserFont, java.awt.FontMetrics newReal)
           
 
Method Summary
 int charsWidth(char[] data, int off, int len)
           
 int charWidth(char ch)
           
 int getAscent()
           
 java.awt.Font getFont()
           
 int getLeading()
           
 int getMaxAdvance()
           
 
Methods inherited from class java.awt.FontMetrics
bytesWidth, charWidth, getDescent, getFontRenderContext, getHeight, getLineMetrics, getLineMetrics, getLineMetrics, getLineMetrics, getMaxAscent, getMaxCharBounds, getMaxDecent, getMaxDescent, getStringBounds, getStringBounds, getStringBounds, getStringBounds, getWidths, hasUniformLineMetrics, stringWidth, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

real

private java.awt.FontMetrics real
A FontMetrics object on the real, scaled font. All queries are forwarded to this object, and the results scaled back into user space.


userFont

private java.awt.Font userFont
The font which the user thinks he is asking about.

Constructor Detail

ScalingGraphics.ScalingFontMetrics

public ScalingGraphics.ScalingFontMetrics(java.awt.Font newUserFont,
                                          java.awt.FontMetrics newReal)
Method Detail

getFont

public java.awt.Font getFont()
Overrides:
getFont in class java.awt.FontMetrics

getAscent

public int getAscent()
Overrides:
getAscent in class java.awt.FontMetrics

getLeading

public int getLeading()
Overrides:
getLeading in class java.awt.FontMetrics

getMaxAdvance

public int getMaxAdvance()
Overrides:
getMaxAdvance in class java.awt.FontMetrics

charWidth

public int charWidth(char ch)
Overrides:
charWidth in class java.awt.FontMetrics

charsWidth

public int charsWidth(char[] data,
                      int off,
                      int len)
Overrides:
charsWidth in class java.awt.FontMetrics