How to add custom fonts in a theme: различия между версиями

Материал из База знаний Центра ПУСК МФТИ
1>Tim@horizoneducationnetwork.org
м →‎top: clean up, typos fixed: eg: → e.g.:
 
м 1 версия импортирована
 
(нет различий)

Текущая версия от 18:18, 14 октября 2024

Create a new directory in your theme and call it fonts. Then add all your custom fonts into this directory' e.g.: moodle/theme/yourtheme/fonts/

In your themes CSS file add the following:

 @font-face { /* where FontName and fontname represents the name of the font you want to add */
     font-family: 'FontName';
     src: url([[font:theme|fontname.eot]]);
     src: url([[font:theme|fontname.eot]]) format('embedded-opentype'),
          url([[font:theme|fontname.woff]]) format('woff'),
          url([[font:theme|fontname.woff2]]) format('woff2'),
          url([[font:theme|fontname.ttf]]) format('truetype'),
          url([[font:theme|fontname.svg]]) format('svg');
     font-weight: normal;
     font-style: normal;
   }

Next ADD the name of your font wherever you want that font to be used in your stylesheet

For example:

   #page-header h1 { font-family: FontName;}

es:Como añadir fonts personalizados dentro de un tema