malcolmrigg / wizard-clock-card

A wizarding clock Lovelace component for Home Assistant
53 stars 13 forks source link

Fonts #17

Open cm-mojo opened 1 month ago

cm-mojo commented 1 month ago

Hi, can you explain how to format using the font store in the www/custom-lovelace folder? i have downloaded BITCBLKAD.ttf but can't get it used in the dashboard

malcolmrigg commented 1 month ago

Hi - the example in the readme shows you how to configure it, basically copy the font into your www/custom-lovelace folder then put something like this in the config for the card:

fontname: itcblkad_font fontface: >- font-family: itcblkad_font; src: local(itcblkad_font), url('/local/custom-lovelace/ITCBLKAD.TTF') format('opentype');

("ITCBLKAD.TTF" is the font file I used - you may need to change the above config to match your "BITCBLKAD.ttf" file, and perhaps the name of the font in the font-family/fontname bits too).

Note that the "www" folder in your config folder maps to the URL "/local/" which is why the URL doesn't have the "www" in it.

cm-mojo commented 1 month ago

this is the folder the ttf is in:

image

and this is the config:

fontname: bitcblkad_font fontface: >- font-family: bitcblkad_font; src: local(bitcblkad_font), url('/local/custom-lovelace/BITCBLKAD.ttf') format('opentype'); width: 500

Still doesn't work....not sure what I'm doing wrong

malcolmrigg commented 1 month ago

Sorry, I'm really not an expert on web fonts, I figured it out by experimenting and looking at how other people did it. Maybe try experimenting with the format option - although opentype worked for me your particular version of the font looks like it could be truetype?

Also, maybe try incrementing the version number in the resources (as if you were updating to a new version of the code). You could also try adding the font file itself to the resources as a stylesheet. Not sure what else to suggest, maybe there's a webfont guru out there that'll be able to help...

cm-mojo commented 1 month ago

no worries, thanks - just wanted to make sure I wasn't missing something obvious

cm-mojo commented 1 month ago

can you upload the font you have used to see if I can mimic the behaviour?

malcolmrigg commented 1 month ago

can you upload the font you have used to see if I can mimic the behaviour?

Sorry, I doubt it, it's not mine to distribute. I believe it was installed on my windows laptop though, so if you have a windows machine you might be able to find it there, or I'm sure a quick internet search will find you a copy.