-
Notifications
You must be signed in to change notification settings - Fork 211
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
Font loading from directory keep system memory full #548
Comments
|
That said, |
this gives me a little more light i have recently fixed the kodi libass sources which where we had added a custom implementation to load fonts from directory with DirectWrite (by using same ass_set_fonts_dir) and it is very fast then i think we should do something similar also with Fontconfig and CoreText |
|
This was already discussed a while back: #510 (incidentally also related to and communicated to Kodi, but I don't expect anyone to know about all Kodi's tenthousands of issues). From your comment I infer that it is possible to add additional directories or additional single files to DirectWrite and Kodi is currently doing this via custom libass patches? If so and this isn't too complex and possible for all our DirectWrite-variants and also CoreText, then maayybe we could extend the currently Fontconfig specific argument of It would probably be good to make it more clear in our documentation that |
|
thanks for the meaning however, at least with DirectWrite it is possible to load fonts from a custom folder I have test with more than 2000 fonts in a kodi user fonts folder, this seems like a improvement over the original loading of "ass_set_fonts_dir" perhaps other providers could provide similar functionality to DirectWrite to use custom font collections sidenote, |
|
@CastagnaIT : I do not intend to fully review your patches, but I noticed that this bit: CastagnaIT@146f851, is likely wrong: it treats the font-dir differntly based on whether the build suppots DIrectWrite, but one may at runtime choose to use Fontconfig. |
|
you are looking in paxxi repo some comment above i have linked my repo where i have squashed the ass_directwrite.cpp is not used anymore, and not exists in my branch (on kodi branch is also not used)
you have asked to provide some information about our directwrite implementations yes i will have to change something here, exclude it when a font provider is used, this to fix also Kodi OS's like LibreElec that currenlty they also have this problem. (I'm realizing these inherent bugs in these last days) I was not knowledgeable enough to know the name of the other providers (discovered yesterday) and how works all whole things in libass, i am beginning to understand in these days a little more... hard to go into details, I'm not knowledgeable enough about how direct write works, ref: https://github.com/CastagnaIT/libass/blob/font_load/libass/ass_directwrite.c#L1477-L1501 when we set |
would be simpler modify libass sources if you add the support to clang-format like done on kodi sources |
|
i have reworked paxxi branch, you can see commits here: there is not much difference but a little more clean until further developments are made on this issue, |
|
As discussed, there's a clear solution to your problem: don't use |
i am not able to find a good solution for each type of OS, platforms and Kodi OS like LibreElec etc.. we need to say to libass to reads fonts from a specific user folder, we can provide a patched libass only for Windows OS where we exclude load_fonts_from_dir and we load fonts from the user folder directly with DirectWrite. For all other OS(linux distro, mac, raspbian, etc) and Kodi OS(LibreElec etc..) there are different situations, |
|
On any platform, you can ship fontconfig with a config file pointing at the directory of your choice. In actual usage, the usual solution is to just tell users to install fonts normally (so in |
|
the installation of fonts directly into the system is known, Can you link me a page with instructions for how to do add a folder in fontconfig e.g. for Ubuntu? |
|
another question with android case and IOS how can works? |
|
Am Tue, Sep 21, 2021 at 11:09:17 -0700 schrieb Stefano Gottardo:
the installation of fonts directly into the system is known,
but what Kodi authors would like to keep Fonts in a user folder to avoid installing fonts in the operating system
Can you link me a page with instructions for how to do add a folder in fontconfig e.g. for Ubuntu?
Do you think that a non-expert user can do fontconfig changes?
See fontconfig docs, especially the example configurations:
https://www.freedesktop.org/software/fontconfig/fontconfig-user.html
The configuration file can do many more things than just adding more folders;
if that's all you want to do, you'd likely just use a small config `<include>`ing
the system wide config and then adding an additional dir with `<dir>`.
For an example of a kinda regular systemwide fontconfig-config for Windows
see the configuration shipped with __recent__ versions of shinchiro's mpv-builds.
|
|
i have tried MPV as suggested |
|
i have discuss with kodi dev, |
|
On Wed, Sep 22, 2021 at 01:13:34 -0700, Stefano Gottardo wrote:
i have tried MPV as suggested […]
but not load any font from the specified folder
[…] am i missing something?
You likely forgot to tell mpv to use fontconfig as the fontprovider, see mpv
docs. Additional or otherwise it may be possible backslashes `\` are interpreted
as escape sequences; it's probably better to use forward slashes `/` in paths.
If that fails, check the mpv log (`--log-file=mpv.log`), make sure you
are using fontconfig and you should see which fonts.conf files it tries
to read.
|
MKV attachment fonts are normally added to libass using I can understand not wanting Fontconfig on macOS: after all, libass introduced a dedicated Core Text font provider not for nothing. But on Linux, for huge font directories, you should certainly prefer a custom |
A Kodi user has reported a problem on libass that causes system crashes on devices with limited memory 1/2 gb.
if you have a folder with many fonts 100/500/1000 etc...
or also few fonts but with large size (in mb) like often happen with asian languages
libass load and keep all these fonts in memory without release it
I have also tested on Windows with your provided libass script
i have set
ass_set_fonts_dirto a directory with 2000 fonts andwith the results in a ~800mb of ram occupied and never released
i think that if the load of all fonts is needed to get some type of metadata,
suggest to load the metadata and after release the font without kept it in memory
then if an ASS file need e.g. two fonts only then keep in memory only these two fonts
not whole 2000 fonts of the directory...
i would like to know if there is a possible alternative or are you already planning changes
Sidenote:
loading so many font files is slow also on fast systems should be improved somehow
The text was updated successfully, but these errors were encountered: