
Hi all!
I'm using the latest version of Xamarin.Documents.Fixed from NuGet (2020.2.615) and I'm trying to create a PDF in a Xamarin.Forms application using RadFixedDocument. Everything works fine except I cannot insert the degree symbol in the document.
This is my code:
var valueCell = row.Cells.AddTableCell(); //row is a TableRow
var valueCellBlock = valueCell.Blocks.AddBlock();
valueCellBlock.InsertText("36 °C");
The resulting document contains the text "36 C", without the ° symbol.
So, how should I pass the degree symbol in order to include it in the document?
Kindest regards.
5 Answers, 1 is accepted
Hello Marco,
The described behavior seems to be related to the fact that the PdfProcessing library fails to retrieve the font data and a fallback mechanism is triggered to use a font (Helvetica) that doesn't contain this special degree symbol.
When using the Telerik Document Processing`s .NET Standard binaries/NuGets and want to export a document to PDF format, the PdfProcessing needs to have access to the font data so that it can read it and add it to the PDF file. That is why, to allow the library to create and use fonts, you will need to provide an implementation of the FontsProviderBase abstract class and set this implementation to the FontsProvider property of FixedExtensibilityManager. For more information and examples you can check the Cross-Platform Support help article.
I am attaching a sample console application that demonstrates this approach. Please, feel free to modify it in a way closer to your scenario.
Regards,
Martin
Progress Telerik
Our thoughts here at Progress are with those affected by the outbreak.

Hi!
Thank you for the response. So, neither font available in the FontsRepository contains the degree symbol? I'm asking this because, as I'm on Android, to use your solution I have to embed the font directly in the application, that I prefer to avoid because I need to display only a single special symbol.
Thank you again for your support.
Hi Marco,
Another option if you don't want to embed a font is to set the special symbol using one of the 14 Standard Fonts from the FontsRepository (check the following code snippet). More information you can find in the Fonts help article. In this case, a possible option could be the Symbol font.
valueCellBlock.InsertText(new FontFamily(FontsRepository.Helvetica.Name), "36 ");
valueCellBlock.InsertText(new FontFamily(FontsRepository.Symbol.Name),"°");
valueCellBlock.InsertText(new FontFamily(FontsRepository.Helvetica.Name), "C");
I hope this solution is suitable for your scenario.
Regards,
Martin
Progress Telerik

Hi!
This solution works like a charm, thank you very much!
Unfortunately, I have found another little issue, this time with accented letters like à, è, ò, etc. Neither they appear in the PDF. Should I use the Symbol font also in this case?
Hello Marco,
Currently, the Standard fonts are exported always with StandardEncoding that does not allow the export of some special characters which do not fit in the first 255 glyph definitions in the font (as the mentioned à, è, ò). We have an item logged in our backlog to provide such functionality: PdfProcessing: Export Standard fonts with Custom encoding. You can cast your vote for the implementation as well as subscribe to the task by clicking the Follow button so you can receive updates about status changes
The implementation of this feature would allow exporting characters that do not fit in the first 255 glyph definitions. What I can suggest as a workaround until the functionality is implemented is to use a font that defines the glyphs in its 255 definitions. An example of such a font is Arial but this would require this font to be embedded. I am sorry for the inconvenience this missing functionality might be causing you.
Regards,
Martin
Progress Telerik