-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve custom fonts handling, document it
Closes #158 - Allow custom fonts for resources, document how to use them
- Loading branch information
Showing
23 changed files
with
120 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
127.0.0.1:80 { | ||
redir /api /api/ | ||
handle_path /api/* { | ||
reverse_proxy 127.0.0.1:8000 | ||
} | ||
|
||
handle_path /static/* { | ||
encode gzip | ||
root * /var/www/tekst/static | ||
file_server | ||
} | ||
|
||
reverse_proxy * 127.0.0.1:5173 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
DEFINE ADDITIONAL FONT FAMILIES HERE IN THIS FILE. | ||
PLEASE MAKE SURE THE PUBLIC PATH TO THE FONT FILES IS CORRECT. YOU SHOULD PLACE YOUR | ||
FONT FILES IN <WEB_STATIC_FILES>/FONTS/ AND REFERENCE THEM VIA THE PUBLIC PATH | ||
/static/fonts/... LIKE BELOW: | ||
@font-face { | ||
font-family: 'Noto Serif'; | ||
font-style: normal; | ||
font-weight: 400; | ||
font-display: swap; | ||
src: url('/fonts/Noto-Serif/Noto-Serif-Regular.eot'); | ||
src: | ||
url('/static/fonts/Noto-Serif/Noto-Serif-Regular.eot?#iefix') format('embedded-opentype'), | ||
url('/static/fonts/Noto-Serif/Noto-Serif-Regular.woff2') format('woff2'), | ||
url('/static/fonts/Noto-Serif/Noto-Serif-Regular.woff') format('woff'), | ||
url('/static/fonts/Noto-Serif/Noto-Serif-Regular.ttf') format('truetype'), | ||
url('/static/fonts/Noto-Serif/Noto-Serif-Regular.svg#NotoSerif') format('svg'); | ||
} | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
* | ||
!.gitignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,37 @@ | ||
# ======= | ||
# BUILDER | ||
# ======= | ||
|
||
FROM node:18.15-alpine AS builder | ||
|
||
ARG WEB_PATH | ||
ARG SERVER_URL | ||
ARG API_PATH | ||
|
||
ENV TEKST_SERVER_URL=$SERVER_URL \ | ||
TEKST_API_PATH=$API_PATH | ||
|
||
WORKDIR "/app" | ||
WORKDIR /app | ||
COPY . . | ||
RUN npm install && npm run build -- --base=$WEB_PATH | ||
|
||
|
||
# ================= | ||
# PROD CLIENT IMAGE | ||
# ================= | ||
|
||
FROM caddy:2.6-alpine AS prod | ||
|
||
ARG API_PATH | ||
ENV TEKST_API_PATH=$API_PATH | ||
|
||
WORKDIR "/var/www/html" | ||
WORKDIR /var/www/html | ||
COPY --from=builder /app/dist/ ./ | ||
COPY ./deploy/Caddyfile /etc/caddy/ | ||
|
||
VOLUME /var/www/tekst/static | ||
|
||
# 82:82 is alpine default for www-data | ||
RUN set -x && adduser -u 82 -D -S -G www-data www-data | ||
USER www-data | ||
|
||
EXPOSE 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
Tekst-Web/translations/help/deDE/adminSystemSettingsResourceFonts.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Individuelle Ressourcen-Schriftarten | ||
|
||
Sie können sich und anderen Benutzern die Möglichkeit geben, alternative Schriftarten für bestimmte Ressourcen zu verwenden. Dies kann etwa dann sinnvoll sein, wenn die Inhalte einer Ressource einen bestimmten Zeichensatz oder Diakritika verwenden, die durch die Standard-Schriftart für Inhalte nicht dargestellt werden können. | ||
|
||
Bitte entnehmen Sie dem Kapitel "Advanced Setup" der Dokumentation, wie zusätzliche Schriftarten eingerichtet werden können. |
5 changes: 5 additions & 0 deletions
5
Tekst-Web/translations/help/enUS/adminSystemSettingsResourceFonts.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Custom Resource Fonts | ||
|
||
You can provide yourself and other users with the option to use alternative fonts for specific resources. This can be useful when the content of a resource uses a specific character set or diacritics that cannot be displayed by the default font for content. | ||
|
||
Please refer to the advanced setup guide in the main documentation to learn how to do this. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Advanced Setup | ||
|
||
## Custom Resource Fonts | ||
|
||
You can provide yourself and other users with the option to use alternative fonts for specific resources. This can be useful when the content of a resource uses a specific character set or diacritics that cannot be displayed by the default font for content. | ||
|
||
To add additional fonts for resources, you need administrative access to the server on which the platform application is deployed. The setup of additional fonts is precisely described below. It is always recommended to create a backup of all application data before performing these steps. | ||
|
||
### Deployment with Docker | ||
|
||
1. In the `.env` file, set the value for `TEKST_WEB_STATIC_FILES` to a path under which you want to make additional static files available for the web client (e.g., `/var/www/tekst/static/`) and create the corresponding directories. | ||
2. Create a file `fonts.css` under this path. | ||
3. Also, create a folder `fonts` under this path, where you can store the additional fonts (possibly sorted into further subfolders). It is recommended to prepare each font in different formats optimized for web use (see also [here](https://developer.mozilla.org/en-US/docs/Learn/CSS/Styling_text/Web_fonts)!). Also, pay attention to the licensing of the fonts used and, if necessary, include the corresponding license file with the files. | ||
4. In the previously created `fonts.css`, create a complete `@font-face` definition for each of your fonts. See [here](https://developer.mozilla.org/en-US/docs/Learn/CSS/Styling_text/Web_fonts) again for details. As the public path to the files, specify `/static/fonts/<...>`, replacing `<...>` with the path within your previously created `fonts` folder. | ||
5. For the application to recognize the changed value in `.env`, it needs to be restarted (`docker-compose restart client`). | ||
6. The value used for `font-family` in the `@font-face` definition can now be entered as an additional font in the platform's system settings. Pay attention to identical spelling! This font can now be selected as a different font in the settings for each text-based resource. | ||
|
||
### Deployment without Docker | ||
|
||
1. Create a directory where you want to make additional static files available for the web client (e.g., `/var/www/tekst/static/`). | ||
2. Ensure that your web server makes this directory available as `/static` at the same address as the application, for example, `www.tekst-platform.org/static`. | ||
3. Follow steps 2 to 4, and 6 from the _Deployment with Docker_ instructions (see above). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Custom Resource Fonts | ||
|
||
You can provide yourself and other users with the option to use alternative fonts for specific resources. This can be useful when the content of a resource uses a specific character set or diacritics that cannot be displayed by the default font for content. | ||
|
||
Please refer to the advanced setup guide in the main documentation to learn how to do this. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters