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

Load fonts from external folder #8338

Closed
DeadNews opened this issue Nov 28, 2020 · 7 comments · Fixed by #9856
Closed

Load fonts from external folder #8338

DeadNews opened this issue Nov 28, 2020 · 7 comments · Fixed by #9856
Labels
core:option-param-conf config, parameters, properties, options, shortcuts meta:feature-request

Comments

@DeadNews
Copy link
Contributor

Expected behavior of the wanted feature

Option like --sub-file-paths=, but for fonts folders.

For example:
sub-file-paths=subs:/or/absolute/path/to/
font-file-paths=subs/fonts:/or/absolute/path/to/

ffmpeg has similar functionality:
https://ffmpeg.org/ffmpeg-filters.html#subtitles-1

11.201 subtitles
Draw subtitles on top of input video using the libass library. 
...
fontsdir
    Set a directory path containing fonts that can be used by the filter. These fonts will be used in addition to whatever the font provider uses.
@guidocella
Copy link
Contributor

You can already load fonts from ~/.config/mpv/fonts, or do you want to customize that directory?

@DeadNews
Copy link
Contributor Author

Yes, I can load fonts from specific folders like ~/.fonts/, but required fonts for subtitles are in the subs/fonts folder I just downloaded.

  1. How will the fonts appear in specific folders if I don't copy them (or create a symlink) beforehand?
  2. Why do I need these fonts in specific folders all the time, if they are needed only during viewing with specific subtitles?

I want to be able to set a directory for loading additional fonts like in the ffmpeg example above.

@snylonue
Copy link

snylonue commented Jan 30, 2021

https://github.com/yzwduck/FontLoaderSub
might be of some help

@Akemi Akemi added the core:option-param-conf config, parameters, properties, options, shortcuts label Apr 30, 2021
@hooke007
Copy link
Contributor

recently the update of mpc remind me of this feature , unfortunately it hasn't been implemented in mpv.

@GribanovIvan
Copy link

Be really good just load fonts from SUBDIR/fonts with ignoring capitalization letters for "fonts" dir

fbriere added a commit to fbriere/mpv that referenced this issue Feb 11, 2022
These options make it possible to specify the directory that will be
passed to ass_set_fonts_dir(), akin to VLC's `--ssa-fontsdir` and
FFmpeg's `fontsdir`.

Fixes mpv-player#8338
@fbriere
Copy link
Contributor

fbriere commented Feb 11, 2022

To anyone interested, I have submitted PR #9856, which adds a --sub-fonts-dir option (along with its corresponding --osd-fonts-dir).

For the record, libass (which is in charge of loading the fonts) only supports a single directory¹, thus precluding a plural "paths" option.

Furthermore, since there's already a default location (~~/fonts), automatically selecting another one based on the presence or absence of a directory (as suggested by @GribanovIvan) would unfortunately be likely to break something. (That's too bad; I really liked the idea.) Thus, you will have to set the value yourself for each directory with use-filedir-conf or some other way².

¹ Despite what the documentation might seem to imply, this directory is not searched recursively, so we can't trick our way around this limitation.
² Not to toot my own horn, but my tree-profiles script can be rather useful in this situation.

@fbriere
Copy link
Contributor

fbriere commented Feb 16, 2022

automatically selecting another one based on the presence or absence of a directory would unfortunately be likely to break something.

I feel a bit embarrassed for not thinking about it right away, but this is something a script could easily do. So I wrote sub-fonts-dir-auto, which does exactly that (i.e. pick any Fonts directory if present, ignoring capitalization).

Vladdrako pushed a commit to Vladdrako/mpv that referenced this issue Jun 27, 2022
These options make it possible to specify the directory that will be
passed to ass_set_fonts_dir(), akin to VLC's `--ssa-fontsdir` and
FFmpeg's `fontsdir`.

Fixes mpv-player#8338
fbriere added a commit to fbriere/mpv that referenced this issue Feb 28, 2023
These options make it possible to specify the directory that will be
passed to ass_set_fonts_dir(), akin to VLC's `--ssa-fontsdir` and
FFmpeg's `fontsdir`.

Fixes mpv-player#8338
fbriere added a commit to fbriere/mpv that referenced this issue Feb 28, 2023
These options make it possible to specify the directory that will be
passed to ass_set_fonts_dir(), akin to VLC's `--ssa-fontsdir` and
FFmpeg's `fontsdir`.

Fixes mpv-player#8338
fbriere added a commit to fbriere/mpv that referenced this issue Feb 28, 2023
These options make it possible to specify the directory that will be
passed to ass_set_fonts_dir(), akin to VLC's `--ssa-fontsdir` and
FFmpeg's `fontsdir`.

Fixes mpv-player#8338
dyphire pushed a commit to dyphire/mpv that referenced this issue Feb 28, 2023
These options make it possible to specify the directory that will be
passed to ass_set_fonts_dir(), akin to VLC's `--ssa-fontsdir` and
FFmpeg's `fontsdir`.

Fixes mpv-player#8338
dyphire pushed a commit to dyphire/mpv that referenced this issue Feb 28, 2023
These options make it possible to specify the directory that will be
passed to ass_set_fonts_dir(), akin to VLC's `--ssa-fontsdir` and
FFmpeg's `fontsdir`.

Fixes mpv-player#8338
Dudemanguy pushed a commit that referenced this issue Mar 1, 2023
These options make it possible to specify the directory that will be
passed to ass_set_fonts_dir(), akin to VLC's `--ssa-fontsdir` and
FFmpeg's `fontsdir`.

Fixes #8338
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core:option-param-conf config, parameters, properties, options, shortcuts meta:feature-request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants