Skip to content

libass Font Setup

WangBin edited this page Jan 12, 2016 · 7 revisions

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

Dirs

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

  • executable_dir/fonts
  • "assets:/fonts" (will copy to appFontsDir to let libass read)
  • qrc ":/fonts" (will copy to appFontsDir to let libass read)
  • appFontsDir
  • fontsDir

If fonts dir contains "default.ttf", it will be the default font if default font is not set.

Disable Font Provider

If there is a default font set, it's able to use the font and disable font provider (for example fontconfig). Disabling font provider will skip font cache generating(fontconfig), font lookup 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