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

Allow updating the available font list #49

Open
adamunion opened this issue Jun 22, 2019 · 3 comments
Open

Allow updating the available font list #49

adamunion opened this issue Jun 22, 2019 · 3 comments
Labels

Comments

@adamunion
Copy link
Contributor

If I initialize an instance with the subUrl option and a given font, JSO renders fine.

However, if I use setTrack with another font, the render is not updated to use the new font. The text and other style properties are updated, just not the font.

Both fonts have been specified in the availableFonts option.

Currently the only workaround I have is to dispose and reinitialize JSO.

@TheOneric
Copy link
Member

iinm, availableFonts is currently only sent to the worker on init, meaning later changes have no effect.
So I guess this is a feature request to allow adding new fonts and possibly removing old fonts later on (which seems reasonable).

@TheOneric TheOneric changed the title setTrack is not using correct font Allow updating the font list Aug 7, 2021
@TheOneric TheOneric changed the title Allow updating the font list Allow updating the available font list Aug 7, 2021
@incidentist
Copy link

I think you misunderstand the bug. What I'm running into is: I initialize JSO with availableFonts: {"font 1": "/path/to/font1.ttf", "font 2": "/path/to/font2.ttf"} and a subUrl that only uses font 1. Later on, I use setTrack to specify a new subtitles file that only uses font2. This should switch to font 2 in the rendering, but it does not. I do not want to change the value of availableFonts, I want to be able to change which fonts are used in the subtitles.

Here's a detailed timeline of the bug I notice:

  1. I run setTrack(font2subs) (the subs are a data url, not http, if that makes any difference)
  2. I notice a network request to fetch the font 2 ttf file, but the rendering does not change.
  3. I run setTrack(font1subs) and it changes back to font 1 instantly
  4. I run setTrack(font2subs) and it changes back to font 2 instantly.

So it seems that, when the font changes, if it has to download the font, it forgets to refresh the render after it downloads.

@chenyangxx
Copy link

I think you misunderstand the bug. What I'm running into is: I initialize JSO with availableFonts: {"font 1": "/path/to/font1.ttf", "font 2": "/path/to/font2.ttf"} and a subUrl that only uses font 1. Later on, I use setTrack to specify a new subtitles file that only uses font2. This should switch to font 2 in the rendering, but it does not. I do not want to change the value of availableFonts, I want to be able to change which fonts are used in the subtitles.

Here's a detailed timeline of the bug I notice:

  1. I run setTrack(font2subs) (the subs are a data url, not http, if that makes any difference)
  2. I notice a network request to fetch the font 2 ttf file, but the rendering does not change.
  3. I run setTrack(font1subs) and it changes back to font 1 instantly
  4. I run setTrack(font2subs) and it changes back to font 2 instantly.

So it seems that, when the font changes, if it has to download the font, it forgets to refresh the render after it downloads.

@incidentist Encountered the same problem 😄, have you solved it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants