List of usage examples for com.itextpdf.text.pdf BaseFont getAscentPoint
public float getAscentPoint(String text, float fontSize)
String
in points. 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 .ja v a2 s . c om 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); }// w w w . j ava 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); } } }
From source file:org.gephi.preview.plugin.renderers.EdgeLabelRenderer.java
License:Open Source License
private float getTextHeight(BaseFont baseFont, float fontSize, String text) { float ascend = baseFont.getAscentPoint(text, fontSize); float descend = baseFont.getDescentPoint(text, fontSize); return ascend + descend; }