[Feature Request] Fonts as downloadable and upgradable resource addons for Kodi
Seen a lot of requests for new fonts for Kodi's core and its skins so suggest that you create a new binary addon type for Fonts and made them downloadable / upgradable from Team-Kodi's official repository, just like any other add-ons for Kodi.

Reason for Fonts as resource addons probably being a good idea is that it might make Kodi's core and skin installation packages smaller and adds the possibility to update or add a new fonts and languages in-between major releases.

This way any font addon can be installed on-demand when you change language in Kodi or install a new skin that request a other font as a dependency. And multiple skins/addons can share the same font files.

I'm sure this idea is not new but I just now read about the same concept being implemented in Android “O” new Features and APIs list so simply stole that idea from there:


"Android O and Android Support Library 26 let you request fonts from a provider application instead of bundling fonts into the APK or letting the APK download fonts. This feature reduces your APK size, increases the app installation success rate, and allows multiple apps to share the same font.

For more information about downloading fonts, refer to Downloadable Fonts.


Fonts in XML

Android O introduces a new feature, Fonts in XML, which lets you use fonts as resources. This means, there is no need to bundle fonts as assets. Fonts are compiled in R file and are automatically available in the system as a resource. You can then access these fonts with the help of a new resource type, font.

The Support Library 26 provides full support to this feature on devices running API versions 14 and higher.

For more information, about using fonts as resources and retrieving system fonts, see Fonts in XML.

I think we had the idea of font resource add-ons already over year ago and know that these would solve a lot of problems (install a certain font along with a language add-on etc), but we just haven't found a dev to work on it so far.
a very basic start can be found https://github.com/xbmc/xbmc/pull/12130
Not that I am poo pooing the idea as I was about to make the same request, but there are issues with changing out one font file for another in a skin.

I have just changed my skin to use Roboto font from the old font i was using (Ubuntu) and have found that the vertical sizing is not exactly the same and thus a number of text fields cut off some text. The difference is minor, but it does result in some text having desenders being cut off.

That's the downside of the idea, the upside on the other hand is that my skin saved 1/2M by the change of font. If you could save downloading a font resource because the file was already on the users system, the saving could be even greater. Might not be a big deal for one download, but there are only a limited number of different fonts being used by skins, so the savings in bandwidth to the Kodi servers would have to be huge.

Wyrm (AppTV)
If required a FULL debug log can now be submitted from the skin in settings->skin settings->support. Or follow instructions here if you can't access skin settings.

FAQ's located at :- http://kodi.wiki/view/Add-on:AppTV
right now that is not an issue, you'd just ship your own font with the skin and it will take precedence. but to make this truly usable for resolving language issues, it probably needs to be the other way around by default indeed.
@ironic_monkey - thanks a lot

the main idea of font resource add-ons is not to be able to use any font in our repo with every skin, because this might never work well due to different glyph width, kerning, relative size etc.. The main idea behind had been two things:
- reusable font's accross skins/skin versions in order to make skin updates etc smaller
- possibility to load special fallback fonts for languages with non-latin glyphs, as those atm have a veeeeery bad support throughout skins

One might say now, why not just ship these fonts with the Kodi binary package. Simply put - filesize. And by filesize I'm not talking about 3MB extra. The font we use in Estuary (Google Noto) has a total size of almost 1 GB!!! if you grab the entire package (JCK fonts are huge). So the idea was to have language add-ons define a required charset (or whatever fits best) and have Kodi download an apropriate font, ideally from the same font family currently being used by the skin, and use that. It's ofc needless to say that font resource add-ons are only the first step to achive this, as there is much much more work to be done unter the hood. Ideally our font rendering system would be able to load missing gylphs of a font from a generic default font (like when having UI in English but EPG data or the movie plot in traditional japanese), but we're nowhere near that AFAIK.
I general @notspiff thank you a lot and hopefully we can offer you a beer again no strings attached. So if you're willing we will be glad to have to have you again at a drink without any political agenda involved.
You are more than welcome!!
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe

I realise this is the very first part of the journey on font resources and thus there will be problems, but post was more a +1 from a skin writer (with justifications). I and a number of skin writers are now including animated lyrics support in our skins and as a result are all using the same fonts to achieve the effect. So apart from reducing the size of our skins in the repo by making those fonts a resource, the reuse of already loaded font resources can only save large amounts of bandwidth to the servers.

As far as the point of view of skin writers. Loading fonts from a resource entry in addons.xml, win, more than welcomed. Loading missing glyphs from a system default font, win, again welcomed. Allowing users to override our font selection, loss, expect pushback.

As to the idea of non latin font handling, yes could do with additional work in skins. In my case I offer the option to use Arial font to try to help. The biggest reason for not including non latin versions of fonts in skins is that the size of these fonts are huge. If we had a way to prompt users to load a required font much as we have "installaddon()" to install a addon on demand, this could go a long way to help this situation. Maybe as a solution to this issue a check could be made in the font selection of settings menu for the require font file. If missing prompt user to download the required file.

@notspiff, also a huge thanks from me on your work on this. Font handling and rendering could do with some work, so its nice to see someone take this on. Just be warned you have probably just opened a large can of worms.

If required a FULL debug log can now be submitted from the skin in settings->skin settings->support. Or follow instructions here if you can't access skin settings.

FAQ's located at :- http://kodi.wiki/view/Add-on:AppTV
(2017-05-19, 17:18)da-anda Wrote: The font we use in Estuary (Google Noto) has a total size of almost 1 GB!!! if you grab the entire package (JCK fonts are huge).

That's kind of a function of how Google packages their fonts. If you can live with just Noto Sans in a single weight (regular) the main size driver is the CJK glyphs, we're talking about 16Mb and you can add in most other actually used scripts and it's probably 18-20Mb. So if you also want bold double that.

scott s.
just tested it on Windows - works fine so far.
What additional metadata properties/information might you want to declare about the capabilities fonts that could be enclosed in each addon.xml for every Font Addon?

Supported characters? Languages the font can fully support? Glyph width? Original source? License? Maybe also follow W3C standard for CSS font property?
for starters we'd most likely need something like supported charsets/languages and cuts (bold, italic ... as AFAIK our font engine can't simmulate those). I'd not go into other visual aspects for now, this could be done later if needed. Or do you have any other idea on how to find a suitable font depending on the characters that should be rendered on screen? I'm not at all a font expert.
This is what I think would be most useful to designer, though not necessarily end user:

Font family
Font style/weight
Em size
Unicode blocks covered

Note that users set a language/locale for the UI, collation, and input but library contents are often multi-language and hence multi-script. Having "language-specific" fonts I think will result in significant font management overhead.

scott s.
not language specific fonts, but character set specific ones. Also not necessarily specific, but we somehow need to know which font to grab/use when we find a character/language unsupported by the current font.
From what I see, Google, for purposes of CSS/XML coding, provides noto fonts indexed by "language" which contain the union of all scripts required by a language. I don't think the noto fonts represent at all a partitioning of unicode, rather many to many. The set of unicode code points is partitioned into "scripts" and "symbols/punctuation". There's no way I know of to know if some arbitrary font contains all the code points needed to express some language. I suppose a skinner (who presumably knows the coverage of a font that is used in a skin) could specify a way to form a "composite" font from a collection of font resources. I don't see how the application could do this, except for a default composite font (I assume based on the existing arial.ttf that is delivered with Kodi). Maybe that should be the first effort -- developing a default composite font and from that export methods that skinners could use with their font resources of choice.

scott s.
Thread Rating:
  • 0 Vote(s) - 0 Average

Logout Mark Read Team Forum Stats Members Help
Fonts as downloadable and upgradable resource addons for Kodi00