Use TTF in Lovelace

:man_shrugging:
I donā€™t even have anything that can open woff2 files.

One thing though. This file-name: DJBGetDigital.woff2 should be all lower case. As per step 3:

Iā€™ll edit the step to highlight that.

Thanks! Now its up and rundning! :+1::pray:

1 Like

Hi,
sorry if i disturb @tom_l
But in HA ver.2020.12.0 dont work to add a font in the style.
Is possible or is my problem :slight_smile:

Sorry, no idea. I have not updated from 0.118.

Many, thanksā€¦
When you update send me a feedbak :slight_smile:

I just updated and my font imports are still working.

Ok now workā€¦ delete cache in all browser :slight_smile:
Sorry if i disturb.
Many thanks! @tom_l

1 Like

Thanks for this Tom! Got it working on the first try with these steps :slight_smile

One question though, can we add more fonts?

I tried, but it doesnā€™t seem to work for me, the DJBGetDigital font is working, but the other 2 fonts Iā€™ve added are not showing.

Edit; Adding the additional fonts to fonts.css like this works:

@font-face {
  font-family: "Moon2.0";
  src: url(/local/fonts/moon20-regular.woff2) format('woff2');
}

@font-face {
  font-family: "NexaLight";
  src: url(/local/fonts/nexalight.woff2) format('woff2');
}

@font-face {
  font-family: "DJBGetDigital";
  src: url(/local/fonts/djbgetdigital.woff2) format('woff2');
}

@font-face {
  font-family: "ProductSans";
  src: url(/local/fonts/productsansregular.woff2) format('woff2');
}

Thanks, your way worked great for me! Now I can customize the font of cards.
Is there any way to replace the font globally? The menu and popup cards still have the default font. There is a way described by @apop but I canā€™t get it to work: How to Lovelace CSS

Edit: works now. One has to set the font via the theme:

themes:
  yorthemename:
  # Main colors that can be changed
    primary-font-family: "yourfontname"
    paper-font-common-base_-_font-family: "var(--primary-font-family)"
    paper-font-common-code_-_font-family: "var(--primary-font-family)"
    paper-font-body1_-_font-family: "var(--primary-font-family)"
    paper-font-subhead_-_font-family: "var(--primary-font-family)"
    paper-font-headline_-_font-family: "var(--primary-font-family)"
    paper-font-caption_-_font-family: "var(--primary-font-family)"
    paper-font-title_-_font-family: "var(--primary-font-family)"
1 Like

Hey good job getting this across.

Thanks, I had a lot of help.

I skimmed the thread but Iā€™m not sure what Iā€™m missing.

  • Created /fonts/ in /www/, uploaded MyFont.otf
  • Add resource: /local/fonts/MyFont.otf
  • Themes:
mytheme:
  primary-font-family: "MyFont"
  ha-card-header-font-family: "var(--primary-font-family)"
  ...etc
  • Created fonts.css in /www/fonts/:
@font-face {
  font-family: "MyFont";
  src: url(/local/fonts/MyFont.otf) format('otf');
}

Still just shows Times, I think? Some serifed common font, everywhere. The font Iā€™m uploading is san serif so itā€™s obvious itā€™s not working.

How is fonts.css supposed to be loaded?

Magic, I assume. Honestly I have no idea what that file does or at least is supposed to do. Is it necessary? It so I assume I need the css loader from above.

Follow all the instructions in this post: Use TTF in Lovelace - #33 by tom_l

Hi @tom_l , just arriving here via forum searchā€¦
In your instructions - thank you - you write:

5. Add the following to your Configuration / Lovelace Dashboards / Resources:

ā€¦ what files need to change , where are they ? Beginner here and this is first card mod ever!

card-mod or editing files arenā€™t relevant to that step. Just go into the configuration UI. (Also make sure you have advanced mode on)

? was that to me, no comprende! ?

Yes, I was talking to you. Here is a Spanish translation of what I said:

card-mod o el proceso de editar archivos no son relevantos para ese paso. Solo entra en la interfaz de configuraciĆ³n. (TambiĆ©n asegĆŗrate de tener activado el modo avanzado)

Thanks to all of you for this, iā€™m now able to use Original font that appears on the display of my Onkyo TX-NR609 :slight_smile:
I associate Custom button-card with the above css trick.

    styles:
      card:
        - height: 75px
      name:
        - font-family: LED Dot-Matrix
        - font-size: 42px

And the Dot Matrix is available free here: 30 Free Digital, Dot Matrix Fonts Ā· 1001 Fonts
Examples of use for my Onkyo remote on smartphone:

Capture d'Ć©cran 2023-12-28 105341