Hello,
I am using pdfium in my flutter project. No third party wrappers, just a compiled binary that is used via dart:ffi.
I need to display pdf with non-embedded Arial font on android device. This font is not available on the device, and the replacement font does not display Cyrillic characters. This behaviour can be seen if you open the attached pdf via google drive on android.
Based on the documentation, I can pass the font search paths to the m_pUserFontPaths field during initialisation, but that doesn't change anything. I used application documents directory and app-specific external storage (for the sake of experiment) as my font storage folder. The files Arial.ttf and ArialMT.ttf were in them. The fonts are definitely available and valid, they can be used with FPDFText_LoadFont, the added cyrillic text is displayed correctly.
The following questions have arisen:
1. Is it accurate that pdfium can access the specified font directory? The passed list of strings looks like this
["/data/user/0/
com.example.app/app_flutter", nullptr]
Maybe it is necessary to put fonts somewhere else? If something goes wrong at this stage, is error information available somewhere? (FPDF_GetLastError does not report anything)
2. I found out that pdfium for objects with missing Arial font defines the font as Chrom Sans OTF (this is what FPDFFont_GetFontName function returns). What is that? The name of a substitution font?
3. From the description, it appears that FPDFText_LoadFont loads the font into the document and it becomes embedded. However, after such loading the problematic Cyrillic is still not displayed. Only the text added afterwards will be displayed correctly. Is this expected behaviour?
4. Are there any workarounds? For example, assigning a custom font as the default font. Or search all text objects and replace the font with the result of FPDFText_LoadFont execution.
Any help would be appreciated.