{
cb = textSpec.getContentByte();
}
final BaseFontFontMetrics baseFontRecord = textSpec.getFontMetrics();
final BaseFont baseFont = baseFontRecord.getBaseFont();
final float ascent = baseFont.getFontDescriptor(BaseFont.BBOXURY, textSpec.getFontSize());
final float y2 = (float) (StrictGeomUtility.toExternalValue(posY) + ascent);
final float y = globalHeight - y2;
final AffineTransform affineTransform = textSpec.getGraphics().getTransform();
final float translateX = (float) affineTransform.getTranslateX();
final FontNativeContext nativeContext = baseFontRecord.getNativeContext();
if (baseFontRecord.isTrueTypeFont() && textSpec.isBold() && nativeContext.isNativeBold() == false)
{
final float strokeWidth = textSpec.getFontSize() / 30.0f; // right from iText ...
if (strokeWidth == 1)
{
cb.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL);
}
else
{
cb.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE);
cb.setLineWidth(strokeWidth);
}
}
else
{
cb.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL);
}
// if the font does not declare to be italics already, emulate it ..
if (baseFontRecord.isTrueTypeFont() && textSpec.isItalics() && nativeContext.isNativeItalics() == false)
{
final float italicAngle =
baseFont.getFontDescriptor(BaseFont.ITALICANGLE, textSpec.getFontSize());
if (italicAngle == 0)
{
// italics requested, but the font itself does not supply italics gylphs.
cb.setTextMatrix(1, 0, PdfLogicalPageDrawable.ITALIC_ANGLE, 1, x1 + translateX, y);
}