Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download missing fonts at runtime #13

Open
6 tasks
ViliusSutkus89 opened this issue Dec 18, 2019 · 2 comments
Open
6 tasks

Download missing fonts at runtime #13

ViliusSutkus89 opened this issue Dec 18, 2019 · 2 comments
Labels
enhancement New feature or request

Comments

@ViliusSutkus89
Copy link
Collaborator

Continuation of Fontconfig work started on #8.

Android devices have some fonts installed. List varies.

PDF expects a list of 14 fonts:

  • Monospace: Courier, Courier Bold, Courier Oblique, Courier Bold-Oblique
  • Sans-Serif: Helvetica, Helvetica Bold, Helvetica Oblique, Helvetica Bold-Oblique
  • Serif: Times Roman, Times Bold, Times Italic, Times Bold-Italic
  • Symbol
  • Zapf Dingbats

Symbol and Zapf Dingbats were not found on tested devices, but they are quite small (both totalling under 100kb), so were included in this library in commit 8dd1207

Most fonts have (metrically compatible ??) replacement fonts available on the device. Keyword being "most", Courier (monospace) only has base verson, but not bold or oblique (italic ??).

TODO:

  • At app runtime go through the base14 font list and check if font provided by Fontconfig has the right properties: serif, sans-serif, monospace, bold, italic
  • Research if this check can be done by querying Fontconfig functions or another alternative needed.
  • Already linking against libFontforge, can use it to visually measure how wide the letters are to determine if font is monospace. https://stackoverflow.com/questions/34511603/check-whether-a-font-is-monospaced
  • Research if "Android font download" infrastructure can provide actual .ttf/.otf whatever else files or is it only Java/Kotlin objects that are not available for C++ apps.
  • If "Android font download" is unusable - download from fonts.google.com.
  • Generate fontconfig rule for newly downloaded font.
@ViliusSutkus89 ViliusSutkus89 added the enhancement New feature or request label Dec 18, 2019
@TomTasche
Copy link
Member

Is this something we should log and get fixed upstream?

@ViliusSutkus89
Copy link
Collaborator Author

ViliusSutkus89 commented Dec 19, 2019

I doubt it. If you lack fonts on your desktop, it means your desktop is broken and you as the end user can fix it: install fonts package, adjust settings, et cetera.
Android end users have no such options. Device gets shipped with some fonts and if the app wants to use different fonts it has to either bundle them with the app or download them at runtime.

ViliusSutkus89 pushed a commit that referenced this issue Jul 19, 2020
Fontforge update (update pdf2htmlEX's dependence upon fontforge to fontforge version 20190801) in the pdf2htmlEX development repository
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants