|
|
@ -74,6 +74,7 @@ import java.awt.geom.AffineTransform; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
public class PdfFont implements Comparable { |
|
|
|
public class PdfFont implements Comparable { |
|
|
|
|
|
|
|
private static final int ONE_THOUSAND = 1000 ; |
|
|
|
|
|
|
|
|
|
|
|
private Font oriFont; |
|
|
|
private Font oriFont; |
|
|
|
|
|
|
|
|
|
|
@ -169,7 +170,7 @@ public class PdfFont implements Comparable { |
|
|
|
|
|
|
|
|
|
|
|
float width(String s) { |
|
|
|
float width(String s) { |
|
|
|
java.awt.Font font = this.getAwtFont(); |
|
|
|
java.awt.Font font = this.getAwtFont(); |
|
|
|
float scale = 1000 / font.getSize2D(); |
|
|
|
float scale = ONE_THOUSAND / font.getSize2D(); |
|
|
|
java.awt.Font derivedFont = font.deriveFont(AffineTransform.getScaleInstance(scale, scale)); |
|
|
|
java.awt.Font derivedFont = font.deriveFont(AffineTransform.getScaleInstance(scale, scale)); |
|
|
|
double width = derivedFont.getStringBounds(s, new FontRenderContext(new AffineTransform(), true, true)).getWidth(); |
|
|
|
double width = derivedFont.getStringBounds(s, new FontRenderContext(new AffineTransform(), true, true)).getWidth(); |
|
|
|
if (derivedFont.isTransformed()){ |
|
|
|
if (derivedFont.isTransformed()){ |
|
|
|