Browse Source

REPORT-24915 REPORT-24809 PDF导出粗体字体过粗;html显示 数据导出pdf没有加粗

bugfix/10.0
Hugh.C 5 years ago
parent
commit
72ee152063
  1. 14
      fine-itext-old/src/com/fr/third/com/lowagie/text/pdf/PdfGraphics2D.java

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

@ -382,7 +382,10 @@ public class PdfGraphics2D extends Graphics2D {
// value. When they are the same value then we are normally dealing
// with a single font that has been made into an italic or bold
// font.
if (font.isItalic() && font.getFontName().equals(font.getName())) {
if (font.isItalic())
//awt.font只要样式,不验证是否安装,真实绘制的字体是 baseFont
// && font.getFontName().equals(font.getName()))
{
float angle = baseFont.getFontDescriptor(BaseFont.ITALICANGLE, 1000);
float angle2 = font.getItalicAngle();
// We don't have an italic version of this font so we need
@ -419,10 +422,13 @@ public class PdfGraphics2D extends Graphics2D {
weight = (font.isBold()) ? TextAttribute.WEIGHT_BOLD
: TextAttribute.WEIGHT_REGULAR;
}
if ((font.isBold() || (weight.floatValue() >= TextAttribute.WEIGHT_SEMIBOLD.floatValue()))
&& (font.getFontName().equals(font.getName()))) {
if ((font.isBold() || (weight.floatValue() >= TextAttribute.WEIGHT_SEMIBOLD.floatValue())))
//awt.font只要样式,不验证是否安装,真实绘制的字体是 baseFont
// && (font.getFontName().equals(font.getName())))
{
// Simulate a bold font.
float strokeWidth = font.getSize2D() * (weight.floatValue() - TextAttribute.WEIGHT_REGULAR.floatValue()) / 30f;
// 30有点粗 ,换成40
float strokeWidth = font.getSize2D() * (weight.floatValue() - TextAttribute.WEIGHT_REGULAR.floatValue()) / 40f;
if (strokeWidth != 1) {
if(realPaint instanceof Color){
cb.setTextRenderingMode(PdfContentByte.TEXT_RENDER_MODE_FILL_STROKE);

Loading…
Cancel
Save