fonts.md 1.6 KB

Fonts

!> Fonts cannot be manipulated at all on Backtivisda. It is necessary to use the git project (see ticket #185).

Add a font

  1. Download the font onto your computer.

  2. Convert it into several formats, ideally .otf, .woff and .ttf. To do this, download this script and run :

    python3 fonts-manipulator/cli.py -i myfont.ttf --otf --woff --ttf
    
  3. Adds the various files to the static/fonts folder (they can be grouped into sub-folders)

  4. Open the local/data/fonts.json file (here for version v1.0.11) and add a :

    {
    "version": "1.0.11",
    "fonts": [
    {
      "css": {
        "font-style": "normal",
        "font-weight": "normal",
        "font-display": null,
        "unicode-range": null
      },
      "fontName": "< font name>", // used in css
      "directory": "./<your font name>",
      "formats": {
        "otf": "<font name>.otf", // complete path static/fonts/<your font name>/<font name>.otf
        "woff": "<font name>.woff",
        "ttf": "<font name>.ttf"
      },
      "name": "<label font name>", // to display
      "loaded": false,
      "italic": false,
      "bold": false,
      "alwaysLoaded": true, // if your want is heavy and speacific (eg. chinese font), set alwaysLoaded: false
      "default": true
    },
    ...
    ]
    }
    
  5. To test, you need to recompile Aktivisda, either by using continuous integration or by running :

    npm run serve:aktivisda
    
  6. Don't forget to commit changes (files fonts and font.json)