List of usage examples for com.lowagie.text.pdf BaseFont UNDERLINE_THICKNESS
int UNDERLINE_THICKNESS
To view the source code for com.lowagie.text.pdf BaseFont UNDERLINE_THICKNESS.
Click Source Link
From source file:org.eclipse.birt.report.engine.layout.pdf.font.FontInfo.java
License:Open Source License
protected void setupFontSize() { if (bf == null) { lineWidth = 1;/*from w w w.j a v a2 s . c om*/ fontHeight = fontSize; baselinePosition = fontSize; underlinePosition = fontSize; linethroughPosition = fontSize / 2; overlinePosition = 0; return; } float ascent = bf.getFontDescriptor(BaseFont.AWT_ASCENT, fontSize); float descent = bf.getFontDescriptor(BaseFont.AWT_DESCENT, fontSize); if (BaseFont.FONT_TYPE_T1 == bf.getFontType()) { // uses the FontBBox for Type1 font, refer to the implementation // of free type API ascent = bf.getFontDescriptor(BaseFont.BBOXURY, fontSize); descent = bf.getFontDescriptor(BaseFont.BBOXLLY, fontSize); } if (descent > 0) { // In some cases, the Type1 font (perhaps loading from PFM?) return // positive descent descent = -descent; } float baseline = bf.getFontDescriptor(BaseFont.UNDERLINE_POSITION, fontSize); float baseline_thickness = bf.getFontDescriptor(BaseFont.UNDERLINE_THICKNESS, fontSize); float strike = bf.getFontDescriptor(BaseFont.STRIKETHROUGH_POSITION, fontSize); float strike_thickness = bf.getFontDescriptor(BaseFont.STRIKETHROUGH_THICKNESS, fontSize); lineWidth = baseline_thickness; if (lineWidth == 0) { lineWidth = strike_thickness; if (lineWidth == 0) { lineWidth = fontSize / 20; } } fontHeight = ascent - descent; //TODO: the -lineWidth/2 should be move to the draw function baselinePosition = ascent - lineWidth / 2; underlinePosition = ascent - baseline - lineWidth / 2; if (strike == 0) { linethroughPosition = fontHeight / 2 - lineWidth / 2; } else { linethroughPosition = ascent - strike - lineWidth / 2; } //TODO: overline is not same with the HTML, we need change it in future. overlinePosition = 0; }