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

Private fonts hot found?

12 Answers 817 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Sparky
Top achievements
Rank 1
Sparky asked on 23 May 2017, 02:07 PM

Hi, I have this section in my web.config file:

 

  <Telerik.Reporting>
    <privateFonts>
      <add fontFamily="Arial Narrow" path="~\Fonts\ARIALN.TTF" />
    </privateFonts>
  </Telerik.Reporting>

..and when I start the web application from VS2015 in debug mode, when the first report rendering starts, it throws and exception, and from it's description I can see that the report processing engine looks for fonts in:

C:\\Program Files (x86)\\IIS Express\\~\\Fonts\\ARIALN.TTF

I have also tried "path=Fonts\ARIALN.TTF" and it looks in C:\\Program Files (x86)\\IIS Express\\Fonts\\ARIALN.TTF

 

Please tell me how to setup my web.config file in order for fonts to be located in the "Fonts" sundirectory of my application?

12 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 25 May 2017, 12:27 PM
Hello Spartak,

Below is a quote from my response in your support ticket on the same question.
Please modify the project in the attachment to reproduce the problem. The project uses Telerik Reporting R2 2017 v11.1.17.503 and the following configuration:
<configuration>
  <configSections>
    <section
        name="Telerik.Reporting"
        type="Telerik.Reporting.Configuration.ReportingConfigurationSection, Telerik.Reporting, Version=11.1.17.503, Culture=neutral, PublicKeyToken=a9d7983dfcc261be"
        allowLocation="true"
        allowDefinition="Everywhere"/>
  </configSections>
  <Telerik.Reporting>
    <privateFonts>
      <add fontFamily="One Way" path="~\Fonts\oneway.TTF" />
    </privateFonts>
  </Telerik.Reporting>
The Fonts folder is in the structure of the project and it has the TTF file in it.
The mentioned project is available as an attachment in your support ticket.


Please let us continue the discussion in one of both threads in order to keep a better track on the exchanged information.
Thank you for your understanding.

Regards,
Stef
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
answered on 17 Jan 2018, 07:31 AM

Hello Stef,

I have exactly the same problem in my web application.

When I specify path="~\Fonts\ocrb10.ttf", Telerik Reporting looks for the font at C:\Windows\System32\InetSrv\~\Fonts\ocrb10.ttf.

When I specify path="Fonts\ocrb10.ttf", Telerik Reporting looks for the font at C:\Windows\System32\InetSrv\Fonts\ocrb10.ttf.

When I specify path="\Fonts\ocrb10.ttf", Telerik Reporting looks for the font at C:\Fonts\ocrb10.ttf.

What can I do to have the looked at the Fonts subfolder of the application?

 

The configuration file contains the following:

<Telerik.Reporting>
  <privateFonts>
    <add fontFamily="OCRB10" path="~\Fonts\ocrb10.ttf" />
  </privateFonts>
</Telerik.Reporting>

0
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
answered on 18 Jan 2018, 06:02 AM

Hello,

I have tried to change the current directory with

Directory.SetCurrentDirectory(HttpRuntime.AppDomainAppPath);

at the application startup.

This works on my development machine, but not on the production machine. When I try to generate a report, I now have the following error message.

Error: System.TypeInitializationException: The type initializer for 'Telerik.Reporting.Processing.Common.FontContainer' threw an exception. ---> System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Windows\SysWOW64\inetsrv\Fonts\ocrb10.ttf'.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
   at Telerik.Reporting.Processing.Common.FontContainer.AddFontCore(String filePath, String absolutePath, String fontFamily, String fontStyle)
   at Telerik.Reporting.Processing.Common.FontContainer.AddFont(String filePath, String fontFamily, String fontStyle)
   at Telerik.Reporting.Processing.Common.FontContainer.InitializePrivateFontCollection()
   at Telerik.Reporting.Processing.Common.FontContainer..ctor()
   at Telerik.Reporting.Processing.Common.FontContainer..cctor()
   --- End of inner exception stack trace ---
   at Telerik.Reporting.Drawing.FontExtensions.GetStyle(IFont font)
   at Telerik.Reporting.Drawing.FontExtensions.ToGdiFont(IFont font)
   at Telerik.Reporting.Processing.GdiFontInfoCache.CreateValue(IFont font)
   at Telerik.Reporting.Processing.GdiFontCache`1.GetValue(IFont font)
   at Telerik.Reporting.Processing.MeasureContext.CalculateLineHeight(IFont font)
   at Telerik.Reporting.Processing.TextRenderer.MeasureText(IMeasureContext context, String text, IFont font, RectangleF layoutRectangle, TextFormat textFormat, Boolean multiline, Int32& charactersFitted)
   at Telerik.Reporting.Processing.TextBoxUtil.MeasureTextContainer(ITextContainer textContainer, RectangleF layoutBounds, IMeasureContext context)
   at Telerik.Reporting.Processing.TextBox.MeasureItem(IMeasureContext context, SizeLU availableClientSize, Boolean canGrow)
   at Telerik.Reporting.Processing.TextBox.MeasureItem(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.TextBox.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureChildItems(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.ReportSectionBase.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.StackLayout.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.Group.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.StackLayout.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.Report.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.SubReport.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureChildItems(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.AbsolutePositionLayout.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.ReportSectionBase.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.StackLayout.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.Group.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.StackLayout.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.Report.MeasureContent(IMeasureContext context, SizeLU availableClientSize)
   at Telerik.Reporting.Processing.LayoutElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.VisualElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Processing.ProcessingElement.MeasureCore(IMeasureContext context, SizeLU availableSize)
   at Telerik.Reporting.Paging.PhysicalPageLayout.PhysicalPageMeasurement.MeasureRoot(LayoutElement root, IMeasureContext measureContext, PageSettings pageSettings)
   at Telerik.Reporting.BaseRendering.RenderingExtensionBase.MeasureRootCore(LayoutElement root, IMeasureContext measureContext, PageSettings pageSettings)
   at Telerik.Reporting.BaseRendering.RenderingExtensionBase.Render(LayoutElement root, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback, PageSettings pageSettings)
   at Telerik.Reporting.BaseRendering.RenderingExtensionBase.Render(Report report, Hashtable renderingContext, Hashtable deviceInfo, CreateStream createStreamCallback, EvaluateHeaderFooterExpressions evalHeaderFooterCallback)
   at Telerik.Reporting.Processing.ReportProcessor.RenderCore(ExtensionInfo extensionInfo, IList`1 processingReports, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback)
   at Telerik.Reporting.Processing.ReportProcessor.ProcessAndRender(String format, ReportSource reportSource, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback)
   at Telerik.Reporting.Processing.ReportProcessor.ProcessAndRenderStateless(String format, ReportSource reportSource, Hashtable deviceInfo, IRenderingContext renderingContext, CreateStream createStreamCallback)
   at Telerik.Reporting.Processing.ReportProcessor.RenderReport(String format, ReportSource reportSource, Hashtable deviceInfo)
   at Asloca.Reports.PdfReportInfo.GeneratePdf(IReportDocument Report, String DocTitle)
   at Asloca.Reports.BvrReportInfo.Generate()
   at Asloca.Member.PrintBvrService.ProcessRequest(HttpContext Context, XElement Request, LoggedOnUser User)
   at Asloca.Net.XmlRequestHttpHandler.ProcessRequest(HttpContext Context, XElement Request, LoggedOnUser User, Int32 No)

0
Peter
Telerik team
answered on 19 Jan 2018, 01:23 PM
Hi Patrick,

The PrivateFonts font container depends on the HttpContext.Current.Server.MapPath(filePath) to resolve the font filepath. Do you invoke the ReportProcessor.RenderReport from a custom Thread/Task? If this is the case make sure the HttpContext.Current is passed to the thread. How to do this is explained in this stackoverflow article.

Regards,
Peter
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
answered on 19 Jan 2018, 01:35 PM

Hi Peter,

Thank you for your answer.

Unfortunately, the link to the stackoverflow article is not correct: it links to a screenshot.

Regards

0
Peter
Telerik team
answered on 19 Jan 2018, 01:41 PM
Hi Patrick,

I have fixed the link. I hope it helps.

Regards,
Peter
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
answered on 22 Jan 2018, 05:37 AM

Hello Peter,

I no more have the error message saying that the font is not found, but the report is not correct.

For example, where the OCR-B content should be 042>892848142971320180001305052+ 010080961
It is displayed as 153􀀡9􀀜3959253􀀜82431291112416163􀀎 121191􀀜72􀀡

It seems that the Unicode value of each char is incremented by 1!

Do you have an explanation?

Regards

0
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
answered on 22 Jan 2018, 05:42 AM

Pater, an additional note:

The problem is only on the production system, on my development PC the result is correct, with the same font! But the font was installed on my PC and not on the production system.

Do I need to add other font files (.afm, .pfb, .pfm)?

Regards

0
Katia
Telerik team
answered on 25 Jan 2018, 07:39 AM
Hi Patrick,

TTF is supported font type. Considering that it is embedded correctly by the application, the produced result should be the same in both environments. 

We would need to check the settings of the report where the font is used, the application configuration file where the font is embedded and the font itself in order to provide you further suggestions. You can send this information in a new support ticket.


Regards,
Katia
Progress Telerik
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
0
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
answered on 25 Jan 2018, 07:55 AM

Hi Katia,

Support ticket created.

Regards

0
Naureen
Top achievements
Rank 1
answered on 27 Aug 2019, 03:49 PM

Hi,

Does the private fonts support otf type? 

0
Todor
Telerik team
answered on 30 Aug 2019, 11:56 AM

Hello Naureen,

Officially we support only TTF fonts.

You may test with OTF as GDI+ we use internally supports OTF - check the table at the bottom of Creating a Private Font Collection Microsoft article. We cannot guarantee that reports will be rendered correctly with fonts other than TTF though.

Regards,
Todor
Progress Telerik

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Tags
General Discussions
Asked by
Sparky
Top achievements
Rank 1
Answers by
Stef
Telerik team
Patrick
Top achievements
Rank 2
Iron
Iron
Iron
Peter
Telerik team
Katia
Telerik team
Naureen
Top achievements
Rank 1
Todor
Telerik team
Share this question
or