|
|
|
@ -97,6 +97,8 @@ public class PdfChunk {
|
|
|
|
|
|
|
|
|
|
private boolean breakTag = false; |
|
|
|
|
|
|
|
|
|
public final static float SUB_PERCENT = 5f/6; |
|
|
|
|
|
|
|
|
|
public float getHeight() { |
|
|
|
|
return height; |
|
|
|
|
} |
|
|
|
@ -254,9 +256,7 @@ public class PdfChunk {
|
|
|
|
|
// italic simulation
|
|
|
|
|
if ((style & Font.ITALIC) != 0) |
|
|
|
|
attributes.put(Chunk.SKEW, new float[]{0, ITALIC_ANGLE}); |
|
|
|
|
FontMetrics metrics = FontDesignMetrics.getMetrics(new java.awt.Font(f.getFontName(), f.getStyle(), (int) (f.getSize() * FONT_SCALE))); |
|
|
|
|
font = new PdfFont(f, f.getSize()); |
|
|
|
|
height = metrics.getHeight() / FONT_SCALE + indent.getTop() + indent.getBottom(); |
|
|
|
|
|
|
|
|
|
// other style possibilities
|
|
|
|
|
HashMap attr = chunk.getAttributes(); |
|
|
|
|
if (attr != null) { |
|
|
|
@ -274,6 +274,11 @@ public class PdfChunk {
|
|
|
|
|
attributes.put(Chunk.GENERICTAG, chunk.getContent()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
//考虑下上下标
|
|
|
|
|
int fontSize = (int) (f.getSize() * FONT_SCALE * (getTextRise() != 0 ? SUB_PERCENT : 1)); |
|
|
|
|
FontMetrics metrics = FontDesignMetrics.getMetrics(new java.awt.Font(f.getFontName(), f.getStyle(), fontSize)); |
|
|
|
|
font = new PdfFont(f, f.getSize()); |
|
|
|
|
height = metrics.getHeight() / FONT_SCALE + indent.getTop() + indent.getBottom(); |
|
|
|
|
if (f.isUnderlined()) { |
|
|
|
|
Object obj[] = {null, new float[]{0, 1f / 15, 0, -1f / 3, 0}}; |
|
|
|
|
Object unders[][] = Utilities.addToArray((Object[][])attributes.get(Chunk.UNDERLINE), obj); |
|
|
|
|