Browse Source

REPORT-108658 预览与导出pdf字体颜色不一致

【问题原因】字体填充颜色其实是一样的,但导出pdf后,字体存在黑色描边。
导出pdf时,若字体为粗体,会对字体进行描边。描边的颜色会使用到realPaint的颜色。在创建Graphics的时候,没有对realPaint进行初始化,正常情况下,是使用setPaint对其进行赋值。若此后再进行绘制,且没有调用setPaint方法,realPaint则为null,当字体为粗体时,会使用之前的颜色对其进行描边,字体颜色看起来会显示异常。
【改动思路】创建时,使用当前的realPaint进行初始化。
final/11.0
Leo.Qin 12 months ago
parent
commit
9620fc93b3
  1. 1
      fine-itext-old/src/main/java/com/fr/third/com/lowagie/text/pdf/PdfGraphics2D.java

1
fine-itext-old/src/main/java/com/fr/third/com/lowagie/text/pdf/PdfGraphics2D.java

@ -916,6 +916,7 @@ public class PdfGraphics2D extends Graphics2D {
g2.baseFonts = this.baseFonts; g2.baseFonts = this.baseFonts;
g2.fontMapper = this.fontMapper; g2.fontMapper = this.fontMapper;
g2.paint = this.paint; g2.paint = this.paint;
g2.realPaint = this.realPaint;
g2.fillGState = this.fillGState; g2.fillGState = this.fillGState;
g2.currentFillGState = this.currentFillGState; g2.currentFillGState = this.currentFillGState;
g2.strokeGState = this.strokeGState; g2.strokeGState = this.strokeGState;

Loading…
Cancel
Save