|
|
@ -169,12 +169,15 @@ public class PdfFont implements Comparable { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
float width(String s) { |
|
|
|
float width(String s) { |
|
|
|
|
|
|
|
double width = 0.0d; |
|
|
|
java.awt.Font font = this.getAwtFont(); |
|
|
|
java.awt.Font font = this.getAwtFont(); |
|
|
|
float scale = ONE_THOUSAND / font.getSize2D(); |
|
|
|
if (font.getSize2D() > 0) { |
|
|
|
java.awt.Font derivedFont = font.deriveFont(AffineTransform.getScaleInstance(scale, scale)); |
|
|
|
float scale = ONE_THOUSAND / font.getSize2D(); |
|
|
|
double width = derivedFont.getStringBounds(s, new FontRenderContext(new AffineTransform(), true, true)).getWidth(); |
|
|
|
java.awt.Font derivedFont = font.deriveFont(AffineTransform.getScaleInstance(scale, scale)); |
|
|
|
if (derivedFont.isTransformed()){ |
|
|
|
width = derivedFont.getStringBounds(s, new FontRenderContext(new AffineTransform(), true, true)).getWidth(); |
|
|
|
width /= scale; |
|
|
|
if (derivedFont.isTransformed()){ |
|
|
|
|
|
|
|
width /= scale; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (image == null) |
|
|
|
if (image == null) |
|
|
|
return (float) width * hScale; |
|
|
|
return (float) width * hScale; |
|
|
|