I just downloaded the latest version of iText and
a patch has been added to PdfGraphics2D since my last version.
It is in the drawString method, line 431 and attempts to simulate a bold
font.
This new patch does not check to see if the current color has transparency
and so renders in full color no matter what.
Below is another patch for the same section that fixes this:
if (strokeWidth != 1) {
if(realPaint instanceof Color){
cb.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE);
cb.setLineWidth(strokeWidth);
Color color = (Color)realPaint;
int alpha = color.getAlpha();
if (alpha != currentStrokeGState) {
currentStrokeGState = alpha;
PdfGState gs = strokeGState[alpha];
if (gs == null) {
gs = new PdfGState();
gs.setStrokeOpacity(alpha / 255f);
strokeGState[alpha] = gs;
}
cb.setGState(gs);
}
cb.setColorStroke(color);
restoreTextRenderingMode = true;
}
}
If there is a better / safer way to accomplish this, please let me know and
I will update
my branch.
-Bill Ensley
www.bearprinting.com
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions
Buy the iText book: http://www.1t3xt.com/docs/book.php