Browse Source

代码修改

final/10.0.3
kerry 6 years ago
parent
commit
755e8aa025
  1. 3
      fine-itext/src/com/fr/third/v2/lowagie/text/pdf/PdfFont.java

3
fine-itext/src/com/fr/third/v2/lowagie/text/pdf/PdfFont.java

@ -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()){

Loading…
Cancel
Save