Skip to content

libass Font Setup

WangBin edited this page Aug 27, 2015 · 7 revisions

libass should work for desktop and mobile devices now with the correct font setup.

Dirs

AppDir: executable dir

AppFontsDir: QStandardPaths::writableLocation(QStandardPaths::DataLocation)+"/fonts" or QDesktopServices::storageLocation(QDesktopServices::DataLocation)+"/fonts". The value may vary from different Qt versions.

FontsDir: QStandardPaths::standardLocations(QStandardPaths::FontsLocation).first() or QDesktopServices::storageLocation(QDesktopServices::FontsLocation). Usually it's system fonts dir and not writable

Default Font and Fonts Dir Look Up

  • If AppDir/fonts has (ttf, otf) fonts: use it as libass(FontConfig) fonts dir.
  • has default.ttf: use default.ttf as default font
  • AppFontsDir (no fonts in AppDir/fonts)
  • no fonts: If has a valid qrc:/fonts/default.ttf, extract to AppFontsDir and use it as default font, the dir is set as fontsdir
  • has default.ttf: use it as default font
  • FontsDir (no fonts in AppFontsDir and no default.ttf in qrc)

Disable FontConfig

If there is a default font set, it's able to use the font and disable FontConfig. Disabling FontConfig will skip font cache generating and speed up the font load. The effect is notable on windows and android(no other device tested, but should be the same).

  • QML API:

    Subtitle.fontFile and Subtitle.fontFileForced

  • C++ API:

    SubtitleFilter.setFontFile(const QString&) and SubtitleFilter.setFontFileForced(bool)

Clone this wiki locally