diff --git a/README.md b/README.md index 6c65ba1..bcb2913 100644 --- a/README.md +++ b/README.md @@ -42,3 +42,36 @@ Option `logotopmargin` (Images category, e.g. `15px` or `0px`) sets the top padding of the header logos, applied in `custom_header.twig`. Use `0px` to align a logo exactly with the top of the screen. +## Custom fonts per variant + +LimeSurvey only knows its core font packages (`application/config/fonts.php`), +so a theme cannot register a `font-*` package itself. Instead a variant ships +its own font files and css: + +1. Put the font files in the variant's `files/fonts/` (e.g. `my-custom-font.woff2`). +2. Create `css/variant.css` in the variant with the `@font-face` and the body + class rule (the selected font is applied as `font-` on ``): + ```css + @font-face { + font-family: 'My Custom Font'; + src: url('../files/fonts/my-custom-font.woff2') format('woff2'); + font-weight: 400; font-style: normal; + } + body.font-my_custom_font { + font-family: 'My Custom Font', Arial, sans-serif; + } + ``` + (`../files/...` works because the asset manager copies the whole theme dir.) +3. In `variants/.json` declare the css file and the dropdown entry: + ```json + { + "files_add": { "css": ["css/variant.css"], "js": [] }, + "fontOptions": [ { "value": "my_custom_font", "label": "My Custom Font" } ] + } + ``` + `build.php` appends the css to the `` list and the font to the + "Custom (this theme)" optgroup of the font dropdown (`data-font-package` + stays `websafe`, so no nonexistent package is requested — the real font is + loaded by the variant's own css). +4. Run `php variants/build.php ` and upload/reset as usual. + diff --git a/config.xml b/config.xml index 80371cb..0859735 100644 --- a/config.xml +++ b/config.xml @@ -109,10 +109,44 @@ #5e1c64 #ffffff lightyellow - + + opensans + + +