Revision 11140 trunk/libraries/libFMap/src/com/iver/cit/gvsig/fmap/core/symbols/SimpleTextSymbol.java
SimpleTextSymbol.java | ||
---|---|---|
136 | 136 |
public void drawInsideRectangle(Graphics2D g, |
137 | 137 |
AffineTransform scaleInstance, Rectangle r) { |
138 | 138 |
FontRenderContext frc = g.getFontRenderContext(); |
139 |
GlyphVector gv = font.createGlyphVector(frc, text); |
|
140 |
float fontSize = getFont().getSize(); |
|
139 |
float fontSize = getFont().getSize(); |
|
141 | 140 |
float fontScaleFactor = (float) ((getText().length()*fontSize) * 0.8) // text length with a 20% margin |
142 | 141 |
/ r.width; |
143 |
|
|
142 |
g.setColor(Color.BLUE); |
|
143 |
g.draw(r); |
|
144 |
g.translate(r.x, r.y); |
|
144 | 145 |
fontSize = fontSize / fontScaleFactor; |
145 |
// if (fontSize > r.height) |
|
146 |
// fontSize = r.height; |
|
147 |
g.setFont(getFont().deriveFont(fontSize)); |
|
148 |
g.drawString(getText(), r.x*0.9F, ( r.height*0.5F) + (fontSize)); |
|
149 |
// g.drawString(getText(), r.x, r.height);//( r.height*0.5F) + (fontSize*0.5F)); |
|
150 |
|
|
151 |
|
|
146 |
if (fontSize > r.height) |
|
147 |
fontSize = r.height; |
|
148 |
g.setFont(new Font(getFont().getName(), getFont().getStyle(), (int)fontSize)); |
|
149 |
g.drawString(getText(), 0, fontSize); |
|
150 |
g.translate(-r.x, -r.y); |
|
152 | 151 |
} |
153 | 152 |
|
154 | 153 |
public int getOnePointRgb() { |
Also available in: Unified diff