Using .otf fonts


Our designers defined several .otf fonts to be used for our Xamarin.Forms applications we develop:

  • NotoSansHK
  • NotoSansJP
  • NotoSansKR
  • NotoSansSC
  • NotoSansTC

Is it possible to use .otf fonts for exporting reports to pdf?
What would be your advice on which fonts should we use in order to support these languages and also keep the size of app and pdfs smallest possible?


OTF is a big spec, and if we support it or not depends in what is inside the otf file. We normally support otf fonts, but FlexCel doesn't support subsetting CFF fonts, so if there are CFF fonts inside the otf, subsetting won't work. (and while you could use the font without subsetting, that would result in huge files)

I've been looking at the noto* otf files and indeed, they use CFF inside.

So sadly those aren't supported. I just checked, and Excel doesn't support them either. If you export a file using those fonts to pdf from Excel (not using FlexCel at all), the text will be exported as images, not real text. You can see that the "used fonts" are empty, and if you edit the pdf, the text is just an image:

I can't really suggest alternatives myself because I don't speak any of those languages, but I am sure there are many korean, japanese, etc fonts which aren't CFF. Say, I know ms normally uses batang for korean: Batang font family - Typography | Microsoft Docs
but I don't know how good the font is, or the licensing issues with it. Someone who speaks korean will likely know better than I could. Same for the other languages.


Thanks for detailed info.
Do you maybe have a good source to find suitable font? This additional info regarding CFF is hard to find in the font collections...


To be honest, the only fonts I've ever seen using CFF are noto (not even all noto variants) and some rare mac fonts. Almost everything else should work. Google is always pushing the limits and not caring at all about backwards compatibility, so you could expect them to use a newer-cooler format most others don't support. But most of the others care about being compatible, so they just support ttf which is the standard.

Noto is important enough that we started some work in supporting CFF, but sadly there are other priorities that keep pushing this support back.

As said, I don't know what font are "nice" for those languages, but I tried for example:

It has a nice license (open font license) and worked fine here with FlexCel. I am almost sure that anything else you try that is not noto will work fine too.

Another idea: I wonder if you have tried converting the noto fonts from CFF to ttf? There are some online converters, a quick google shows stuff like this:

But I haven't tried it myself.

Hi again,

We are going live soon, so we need to reopen the pdf localization topic.
I've tried to use Google Fonts you suggested, just as an example.

I get the exception: {FlexCel.Core.FlexCelCoreException: The folder with truetype fonts: "/data/data/com.buchi.optima/files/.override/Fonts/" does not exist.

I put the font to all possible places I could think of:

I also subscribed to the following event, but handler never gets called.
No subsetting at the moment.

            pdfExporter.AllowOverwritingFiles = true;
            pdfExporter.FontEmbed = FlexCel.Pdf.TFontEmbed.Embed;
            //pdfExporter.FontSubset = FlexCel.Pdf.TFontSubset.Subset;
            pdfExporter.FontMapping = FlexCel.Pdf.TFontMapping.DontReplaceFonts;
            pdfExporter.UseExcelProperties = true;
            pdfExporter.BeforeNewPage += PdfExporter_BeforeNewPage;
            pdfExporter.GetFontFolder += FlexCelPdfExport_GetFontFolder;
  • My first question would be, what could be the reason for the GetFontFolder not to be called?
  • Second, if I can not make the handler work, where should I put the fonts, so the Fonts folder gets -
    created at expected location?


Some things I see:

  1. In your screenshot you seem to be using "Fonts" with F uppercase, but it is "fonts" without uppercase. See FlexCel Android Guide | FlexCel Studio for the .NET Framework documentation

2, The build action should be "Ansdroid Asset" again as said in the docs.

With those 2 things, I think you should get it to work. I made a small example here:

And it works as expected.

About the GetFonrFolder event, I am not sure on what can be happening, but indeed it won't be called if you have a Assets/fonts folders with fonts (the /fonts folder has priority, so FlexCel will use that directory before GetFontFolder is called.

I tried it with the code here:

And it worked as expected: the event is called and FlexCel looks into the "Shared Fonts" folder.
You can download the example here: