26

Is there a way to use custom fonts in an Apple tvOS TVML based application? I've tried the @font-face at-rule to no avail.

<document>
<head>
    <style>
      @font-face {
        font-family: 'My Awesome Font';
        font-weight: 600;
        src: url("${this.BASEURL}/resources/fonts/awesome-font-bold.otf"); 
      }
    </style>
</head>
...
</document>
Aodh
  • 662
  • 1
  • 7
  • 24
  • 1
    I would very much like to know this swell. I can't find it mentioned in the [docs](https://developer.apple.com/library/prerelease/tvos/documentation/LanguagesUtilities/Conceptual/ATV_Template_Guide/ITMLStyles.html#//apple_ref/doc/uid/TP40015064-CH11-SW1) However it is mentioned in the [interface guidelines](https://developer.apple.com/tvos/human-interface-guidelines/visual-design/#typography) – mcabe Sep 29 '15 at 13:28
  • Guidelines covers tvOS apps in general, Native apps can have any fonts they like. – Ivan Solntsev Oct 21 '15 at 11:53
  • Have you read the answer for this question http://stackoverflow.com/questions/35734894/set-font-family-in-tvml/38692663#38692663 ? – Roman Podymov Sep 06 '16 at 08:25

1 Answers1

4

It's not possible to set the font-family in tvOS using Apple's provided TVML styles. You can however use the TVElementFactory class to extend upon TVML to create new markup elements.

This article from Shopgate describes the process. They've also put together a repository with a sample project.

Joe Longstreet
  • 372
  • 1
  • 5
  • 21
  • the shopgate it's a very good one however it's in swift and requires some love to integrate. – amok Apr 24 '16 at 23:21