This is a migrated thread and some comments may be shown as answers.

FontEmbedding=None makes Bold text, Bold and Italic

3 Answers 389 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Charlie
Top achievements
Rank 2
Charlie asked on 16 Mar 2012, 09:38 PM
I am creating a report manually, by catching "ItemDataBinding" and inserting elements.  After the report is created, I call the method below:

public void RenderPdfReport(IReportDocument report, string documentPath)
{
    ReportProcessor reportProcessor = new ReportProcessor();
    Hashtable deviceInfo = new Hashtable();
    deviceInfo["FontEmbedding"] = "None";
    RenderingResult result = reportProcessor.RenderReport("PDF", report, deviceInfo);
    if (result.DocumentBytes == null)
        return;
 
    using (FileStream fs = new FileStream(documentPath, FileMode.Create))
    {
        fs.Write(result.DocumentBytes, 0, result.DocumentBytes.Length);
    }
}

Here's the deal.  To minimize the size of the PDF, I used this trick
deviceInfo["FontEmbedding"] = "None";
But - text that should be bold, is now bold and italic in the PDF.
If I set FontEmbedding to the default of "Subset", the bold text in the report is correct (just bold).
Am I doing something wrong?
Has anyone else seen this?
Thank you.

3 Answers, 1 is accepted

Sort by
0
Charlie
Top achievements
Rank 2
answered on 19 Mar 2012, 08:10 PM
I think I may have found something.
I downloaded the source for the latest internal build (5.3.12.131).
There is a method in PdfFontDictionary.cs -
void Initialize()
{
    this.BaseFont = this.drawingFont.Name.Replace(" ", "");
 
    if ((this.drawingFont.Style & (FontStyle.Bold | FontStyle.Italic)) != 0)
    {
        this.BaseFont += ",BoldItalic";
    }
    else if ((this.drawingFont.Style & FontStyle.Bold) != 0)
    {
        this.BaseFont += ",Bold";
    }
    else if ((this.drawingFont.Style & FontStyle.Italic) != 0)
    {
        this.BaseFont += ",Italic";
    }
 
    this.fontDescriptor.FontName = this.BaseFont;
}

Shouldn't the "if" statement be this instead?

if ((this.drawingFont.Style & (FontStyle.Bold | FontStyle.Italic)) == (FontStyle.Bold | FontStyle.Italic))

0
Accepted
Elian
Telerik team
answered on 21 Mar 2012, 04:55 PM
Hello Charlie,

You are correct. This is a known issue that appeared in 2012 Q1. It will be fixed for the upcoming service pack (which should be in a couple of weeks from now). 

Kind regards,
Elian
the Telerik team
NEW in Q1'12: Telerik Report Designer (Beta) for ad-hoc report creation. Download as part of Telerik Reporting Q1 2012. For questions and feedback, use the new Telerik Report Designer Forum.
0
Charlie
Top achievements
Rank 2
answered on 21 Mar 2012, 05:00 PM
Okay, thank you.  I assume that will be a service pack for the version 6 release.
Tags
General Discussions
Asked by
Charlie
Top achievements
Rank 2
Answers by
Charlie
Top achievements
Rank 2
Elian
Telerik team
Share this question
or