Kodi Community Forum

Full Version: Skin Help for Using Fonts for Use By My Skin
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Newbie learning to create skins ... Ive been looking for days and cannot figure this one out.  Any information you can provide would be greatly appreciated.  I am creating my own skin, I want to add my own font names and fonts to be used by my skin... regardless of what the Kodi Skin has defined.  Basically, I want to define my fonts only in my skin overriding the Kodi skin.  i understand that I will need to add a Font.xml file as well as define the fonts... somewhere... do I need a Fonts Folder? can someone help me determine where the fonts folder as well as the font.xml needs to be placed in order for my skin to use these at run-time ?
the font files (.ttf) need to be placed in the skin.whatever/fonts folder.
the Font.xml file should be stored alongside all the other .xml files of the skin.

https://kodi.wiki/view/Fonts
thank you for reply.  I understand thats where it would need to go if it was for a skin.whatever -- however how about an add on that allows for skinning? I would like to skin an add on and have it's own set of fonts, even if not defined in the skin.
I don't think currently addons can force a use of their own fonts.

scott s.
.
thank you.  I do know that in the addon/skin I have the ability to define my own Font.xml file to define font size, etc... I understand you are saying I cannot define the font.ttf  ... So when creating the Font.xml, how do I know what Font.ttf to define in the Font.xml ? Example below... What if the skin.whatever  does not have the  RobotoCondensed-Regular.ttf ??

<?xml version="1.0" encoding="UTF-8"?>
<!-- Foundation -->
<fonts>
    <fontset id="Default" unicode="true">

        <!-- Standard Fonts -->
        <font>
            <name>MY_font_medium</name>
            <filename>RobotoCondensed-Regular.ttf</filename>
            <size>38</size>
        </font>
If the skin doesn't have it then you can't use it.
Thank you Hitcher.  I am ok with that, but how do I reference the Font that is available in the skin?  I would like to create my own custom size fonts, but if the font does not exist, then not sure how to create my FontSet in the Font.xml file.... is there some Skin Variable or something that I would use instead of the xxxx.ttf value? so would <filename>RobotoCondensed-Regular.ttf</filename> become <filename>ActiveFontNameVariable</filename>
The only required font in a font.xml is font13.
okay.  I would like to create my own font.xml with various sizes to use.  I understand that I cannot override the skin font .... Let me ask this.  Is there a default font.ttf that is always available for use regardless of the kodi skin used? Perhaps Arial.ttf or something?
(2018-08-08, 13:22)Hitcher Wrote: [ -> ]If the skin doesn't have it then you can't use it.

Yes you can. Though all skins include font ttf files in /fonts, this is not necessary. See the wiki. Any font referenced by name in <skin.name>/xml/Font.xml can be used, provided the respective font ttf file is put in ./kodi/media/fonts and named exactly as referenced in <skin.name>/xml/Font.xml.
(NOTE: You must take care to name the font correctly in Font.xml. If you don't hand-edit the naming the numerical string provided in idloc="" takes precedence, reading its value from <skin.name>/languages/<...>/strings.po, which of course is a value having nothing to do with your custom font.)

IMHO the wiki should also state that centralizing fonts is the correct approach, and that the current practice of including in every single font the exact same font(s) (Roboto, Roboto-Bold, Ubuntu/Ubuntu-M, Arial, etc) is inefficient, impedes maintenance, and should be dropped.

Come to think of it, the same approach should govern backgrounds. It makes little sense to duplicate the exact same SKINDEFAULT.jpg, mediaoverlay.jpg, tv.jpg etc in each and every skin you use, rather then centralize them all in .kodi/media.

Perhaps the biggest benefit of centralization of your fonts & backgrounds is that nothing gets lost upon a skin upgrade. The skins reside in the folder .kodi/addons; any change in them doesn't affect the folder .kodi/media.
There's a lot of been done in Kodi 20 as regards fonts.  Note that fonts include UI/skin fonts (with addons included if they have UI interaction) and subtitle fonts.

From my POV the bigger font issue is i18n as so many skins only support latin and maybe greek or cyrillic or hebrew scripts in their fonts.  One improvement is to reference fonts by their font family rather than filename, this allows for better font substitution when the preferred font is missing a glyph mapping for a unicode codepoint.

There's a PR not approved yet but would allow for language resources to provide UI font files based on Google Noto Sans approach (language resource would have the language-specific Noto Sans ttf file included).  But if you prefer Roboto or San Francisco because of native platform that might not help.

Also Kodi 20 features text shaping via harfbuzz library so fonts need the appropriate otf features (GSUB and GPOS) to support scripts which benefit from shaping.

scott s.
.