Adding fonts

Started by djoos5, December 11, 2017, 04:31:09 PM

Previous topic - Next topic

djoos5

I am running the 2.1 Beta 2 and I want to add a font.

I found the following instructions on a different thread but I am running into challenges. The instructions for the GenericControls.template and editor.js do not work - the searched code to be replaced is not in the php files.

I would appreciate any guidance on what has changed to affect adding a font. I have uploaded the font and updated my index.css, but I do not know what to do with the next two step.

Thanks for any help!


Quote from: Gluz on September 29, 2017, 05:18:42 PM
If they are free to use on a web page as well, and don't have a code like Google Fonts to use them as web fonts, then you have to download them to your computer, upload them to your theme directory in a new directory in /Themes/your_theme/fonts (so, inside there should be the files .ttf)



Next, open the file /Themes/your_theme/css/index.css and add this to the beginning:
change the name to the actual name of the file and the name of the font
@font-face {
    font-family: 'here-the-name-of-the-font';
    src: url('../fonts/here-the-name-of-the-file.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

(this is for the page to load the font)



Then open the file /Themes/default/GenericControls.template.php:
Code (Search) Select
,
\'courier\': \'Courier\',

Code (Replace) Select
,
\'courier\': \'Courier\',
\'here-the-name-of-the-font\': \'here how it should appear\',




Finally open the file /Themes/default/scripts/editor.js:
Code (Search) Select

'Arial',

Code (Replace) Select

'here how it should appear',
'Arial',




With this, the fonts should appear in the editor and selecting them to use in a post should make them appear for almost everyone, as I said, some fonts have issues in some devices.

Advertisement: