List of usage examples for com.itextpdf.text.pdf BaseFont getWidthPointKerned
public float getWidthPointKerned(String text, float fontSize)
String
in points taking kerning into account. From source file:bouttime.report.bracketsheet.BracketSheetUtil.java
License:Open Source License
public static void drawString(PdfContentByte cb, BaseFont bf, float x, float y, float fontSize, String string, boolean strikethrough) throws DocumentException, IOException { if (bf == null) { bf = BaseFont.createFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.EMBEDDED); }/*from w ww . j a v a 2s . c o m*/ drawString(cb, bf, x, y, fontSize, string); if (strikethrough) { float halfHeight = (bf.getAscentPoint(string, fontSize)) / 2; float width = bf.getWidthPointKerned(string, fontSize); drawHorizontalLine(cb, x, y + halfHeight, width, 1.5f, 0); } }
From source file:bouttime.report.bracketsheet.BracketSheetUtil.java
License:Open Source License
public static void drawString(PdfContentByte cb, BaseFont bf, float mid, float y, float fontSize, String string, float rotation, boolean strikethrough) throws DocumentException, IOException { if (bf == null) { bf = BaseFont.createFont(BaseFont.TIMES_ROMAN, BaseFont.CP1252, BaseFont.EMBEDDED); }//from w w w.ja va 2 s.c o m drawString(cb, bf, mid, y, fontSize, string, rotation); if (strikethrough) { float halfHeight = (bf.getAscentPoint(string, fontSize)) / 2; float width = bf.getWidthPointKerned(string, fontSize); if (rotation == 0) { drawHorizontalLine(cb, mid, y + halfHeight, width, 1.5f, 0); } else if (rotation == 90) { drawVerticalLine(cb, mid - halfHeight, y, width, 1.5f, 0); } } }