Jump to content
Changes to the Jaspersoft community edition download ×

ST-Song font can simulate bold, why *.ttf can not?


welkinhu

Recommended Posts

My reports need CJK fonts which do not have bold and italy sytle in PDF. but iText can simulate them. I have success simulate them via pdfFontName="STSong-Light,Bold".

Code:

<staticText>
<reportElement x="140" y="17" width="121" height="21" key="staticText-1"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font fontName="Arial Unicode MS" pdfFontName="STSong-Light,Bold" size="12" isBold="true" isPdfEmbedded ="true" pdfEncoding ="UniGB-UCS2-H"/>
</textElement>
<text><![CDATA[sT Song 粗体 Bold]]></text>
</staticText>

But when I change ST-Song to one font from ARIALUNI.TTF, I can not simulate bold & style.

The problem code:

Code:
[code]
<staticText>
<reportElement x="131" y="59" width="119" height="21" key="staticText-5"/>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None"rightBorderColor="#000000" bottomBorder="None" bottomBorderColor="#000000"/>
<textElement>
<font fontName="Arial Unicode MS" pdfFontName="ARIALUNI.TTF,Bold" size="12" isBold="true" pdfEncoding ="Identity-H"/>
</textElement>
<text><![CDATA[ArialUNI粗体 Bold]]></text>
</staticText>

 

Now I have to write some java code, preapre a font map for filling in order to simulate bold of Arial Unicode.

Could I do the similar way like pdfFontName="STSong-Light,Bold".

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi,

 

The PDF exporter can receive a FONT_MAP parameter which can contain PdfFont objects. You could set the flag called isPdfSimulatedBold on those mappings to instruct the exporter to try simulate bold for fonts that do not have such style themselves.

 

Check the supplied /demo/samples/fonts sample for details.

 

I hope this helps.

Teodor

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...