Skip to content

Download missing fonts at runtime #13

Open
@ViliusSutkus89

Description

@ViliusSutkus89

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions