Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF

TOPIC:

trouble with fallback fonts 5 years 8 months ago #14055

  • arlomedia
  • arlomedia's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 56
  • Thank you received: 1
Since updating my view library from 2.9.11 to the latest 3.15.3, I'm having issues with text not displaying on my users' devices. For example, a German user with an Android 4.4.2 device sees all text except characters with umlauts (ä, ö, ü). Other users with Android 5.1.1 and 6.0.1 see annotations and background colors, but no text at all. I submitted help tickets with examples to Radaee and they said these issues are all because of font embedding, and directed me back to the forum for further help.

In the help ticket, they said I could either distribute the DroidSans font with my app, or change the default fallback font to Arimo in Global.java. They said DroidSans is better for Asian text and Arimo is better for European, so I would like to use Arimo. However, it looks like that is already the default in Global.java. I haven't changed anything in Global.java except adding my license code. I think this is the relevant code:
// set default font for fixed width font with empty collection.
if (!setDefaultFont(null, "Arimo", true) &&
          !setDefaultFont(null, "DroidSansFallback", true) && face_name != null)
{
	setDefaultFont(null, face_name, true);
}
// set default font for non-fixed width font with empty collection.
if (!setDefaultFont(null, "Arimo", false) &&
          !setDefaultFont(null, "DroidSansFallback", false) && face_name != null)
{
	setDefaultFont(null, face_name, false);
}

Is this already using Arimo as the fallback font, and if not, what do I need to change?

Please Log in or Create an account to join the conversation.

trouble with fallback fonts 5 years 7 months ago #14056

  • support
  • support's Avatar
  • Offline
  • Administrator
  • Administrator
  • Posts: 692
  • Thank you received: 59
Arimo family is better for application size but doesn't contains asian glyphs.
DroidSansFallback is a huge font (>5mb) which contains many glyphs from non-latin charsets.
Are you distributing fonts assets in your package?

Please Log in or Create an account to join the conversation.

trouble with fallback fonts 5 years 7 months ago #14058

  • goldkyo
  • goldkyo's Avatar
  • Offline
  • New Member
  • New Member
  • Posts: 18
  • Thank you received: 2
A supplement, the code
setDefaultFont(null, "Arimo", true)
Does not load the font resource, but only set the loaded font resource as default font. By loading the font resource correctly, you should:
1. Place the font file arimo.ttf in your project resource folder.
2. Load the font resource with:
load_truetype_font( res, R.raw.arimo, new File(files, "arimo.ttf") )

Please Log in or Create an account to join the conversation.

trouble with fallback fonts 5 years 7 months ago #14062

  • arlomedia
  • arlomedia's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 56
  • Thank you received: 1
I think I'm including the Arimo font. In my project files, ViewLib/res/raw has all the arimo, cousine and tinos fonts that came with the library. And Global.java contains the load_truetype_font lines for each file.

I haven't been able to test the fallback fonts on my own devices because I don't have a PDF file with fonts that are neither installed on my devices nor embedded into the file. I tried making a PDF with some unusual fonts from Word and from Illustrator, but both applications always embed the fonts and don't give an option to turn that off. Could someone share a PDF I can test with, along with a screen shot of how the fonts are supposed to look so I can see if the fallback fonts are appearing?

Please Log in or Create an account to join the conversation.

trouble with fallback fonts 5 years 7 months ago #14070

  • arlomedia
  • arlomedia's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 56
  • Thank you received: 1
I think I might understand what's happening here. Does the fallback font only work if there is a fontfileMapping entry for the original font in the PDF file? Radaee support said that the file referenced Arial-BoldMT, while the Global.java file only has a fontfileMapping for ArialMT. I assumed the fallback font would cover any font in the PDF file, but if that's not the case, that would explain why this user's file isn't displaying correctly.

Please Log in or Create an account to join the conversation.

trouble with fallback fonts 5 years 7 months ago #14073

  • arlomedia
  • arlomedia's Avatar Topic Author
  • Offline
  • Senior Member
  • Senior Member
  • Posts: 56
  • Thank you received: 1
Well now I'm even more confused. The Knowledge Base suggests that the viewer will use substitute fonts even if they are not specifically mapped with fontfileMapping commands:

www.radaeepdf.com/support/knowledge-base?view=kb&kbartid=5

But I can't explain these situations:

1) One user's file uses TimesNewRomanPS-ItalicMT. I mapped this to Tinos Italic in my Global.java file. But on the user's Android 4.4 device, the text displays in a sans-serif font (Tinos is serif), and characters with umlauts don't display at all.

2) Another user's file uses ArialMT. This was already mapped to Arimo on my Global.java file. But on the user's Android 6.0 device, the text doesn't display at all.

3) Another user's file uses CourierNewPSMT. That is not mapped in my Global.java file. But on the user's device (I don't have an Android version number for this user), the text doesn't display at all. This one would make sense except for the behavior described in the knowledge base and observed in example 1.

What am I not understanding about how this is supposed to work? And why did these files display fine for these users with the old library version 2.9?

Please Log in or Create an account to join the conversation.

Powered by Kunena Forum