summaryrefslogtreecommitdiff
path: root/src/displayapp/fonts/README.md
blob: 18fa618e70e0773d4581c7fba5ac8a0597c3b2cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Fonts

* [Jetbrains Mono](https://www.jetbrains.com/fr-fr/lp/mono/)
* [Awesome font from LVGL](https://lvgl.io/assets/others/FontAwesome5-Solid+Brands+Regular.woff)
* [Open Sans Light from Google](https://fonts.google.com/specimen/Open+Sans)

## Generate the fonts:

* Make sure you have installed lv_font_conv, and it's in the PATH
  * `npm i lv_font_conv`
  * `export PATH="$PATH:$PWD/node_modules/.bin"`
  * *OR* globally: 
  * `npm i -g lv_font_conv`
  * `export PATH="$PATH:$HOME/.local/bin"` (if not already in the path)
  * or in any other path you choose.
* run the `generate.py` script, while in the folder.
  * it has a `-h` flag to show usage, nontheless: `python generate.py fonts.json`

### How to add new symbols:

* Browse [this cheatsheet](https://fontawesome.com/cheatsheet/free/solid) and pick symbols
* For each symbol, add its hex code (0xf641 for the 'Ad' icon, for example) to the *Range* list (or the symbol list when its simple enough) in the `fonts.json` file
* * Convert this hex value into a UTF-8 code
  using [this site](http://www.ltg.ed.ac.uk/~richard/utf-8.cgi?input=f185&mode=hex)
* Define the new symbols in `src/displayapp/screens/Symbols.h`:

```
static constexpr const char* newSymbol = "\xEF\x86\x85";
```

### the config file format:

inside `fonts`, there is a dictionary of fonts,
and for each font there is:
* sources - list of file,range(,symbols) wanted (as a dictionary of those)
* bpp - bits per pixel.
* size - size.
* patches - list of extra "patches" to run, either string to file which should be run, or list of arguments (with first one being the command being run)
* features - optional. dictionary of extra file,range fonts to be included when the feature is enabled. (for example: a extra language)
* compress - optional. default disabled. add `"compress": true` to enable

### Navigation font

`navigtion.ttf` is created with the web app [icomoon](https://icomoon.io/app) by importing the svg files from `src/displayapp/icons/navigation/unique` and generating the font. `lv_font_navi_80.json` is a project file for the site, which you can import to add or remove icons.