From 583ba7321bb7865645946832b97748c619b378d4 Mon Sep 17 00:00:00 2001 From: subframe7536 <1667077010@qq.com> Date: Sun, 8 Dec 2024 00:55:15 +0800 Subject: [PATCH] Add dockerfile --- Dockerfile | 24 ++++++++++++++++++++++++ README.md | 34 ++++++++++++++++++++++++++++------ requirements.txt | 1 + 3 files changed, 53 insertions(+), 6 deletions(-) create mode 100644 Dockerfile create mode 100644 requirements.txt diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..12877bd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ +FROM python:3.11-slim + +# Install system dependencies including FontForge +RUN apt-get update \ + && apt-get install -y fontforge \ + && rm -rf /var/lib/apt/lists/* + +# Set working directory +WORKDIR /app + +# Copy the project files +COPY . . + +# Install Python dependencies +RUN pip install -r requirements.txt + +# Create volume mount point for output +VOLUME /app/fonts + +# Default build arguments +ENV BUILD_ARGS="" + +# Run the build script with optional arguments +ENTRYPOINT ["sh", "-c", "python build.py $BUILD_ARGS"] diff --git a/README.md b/README.md index e6b1557..5e03458 100644 --- a/README.md +++ b/README.md @@ -51,18 +51,40 @@ You can checkout old version [here](https://github.com/subframe7536/maple-font/t ### Font Hint -- *`hinted font`* is used for low resolution screen to have better render effect. From my experience, if your screen resolution is lower or equal than 1080P, it is recommended to use "hinted font". +- *`Hinted font`* is used for low resolution screen to have better render effect. From my experience, if your screen resolution is lower or equal than 1080P, it is recommended to use "hinted font". - In this case, you can choose `MapleMono-TTF-AutoHint` / `MapleMono-NF` / `MapleMono-NF-CN`, etc. -- *`unhinted font`* is used for high resolution screen (e.g. for Mac), when using "hinted font", it will blur your text or make it looks weird. +- *`Unhinted font`* is used for high resolution screen (e.g. for Mac), when using "hinted font", it will blur your text or make it looks weird. - In this case, you can choose `MapleMono-OTF` / `MapleMono-TTF` / `MapleMono-NF-unhinted` / `MapleMono-NF-CN-unhinted`, etc. ## Custom Build +### Github Actions + +You can use [Github Actions](https://github.com/subframe7536/maple-font/actions) to build the font. + +1. Fork the repo +2. (Optional) Change the content in `config.json` +3. Go to Actions tab +4. Click on `Custom Build` menu item on the left +5. Click on `Run workflow` button with options setup +6. Wait for the build to finish +7. Download the font archives from Releases + +### Docker + +```shell +git clone https://github.com/subframe7536/maple-font --depth 1 -b variable +docker build -t maple-font . +docker run -v "$(pwd)/fonts:/app/fonts" -e BUILD_ARGS="--normal" maple-font +``` + +### Local + Clone the repo and run on your local machine. Make sure you have `python3` and `pip` installed ```shell git clone https://github.com/subframe7536/maple-font --depth 1 -b variable -pip install foundrytools-cli +pip install -r requirements.txt python build.py ``` @@ -70,7 +92,7 @@ python build.py If you have trouble installing the dependencies, just create a new Github codespace on `variable` branch and run the commands there -### Customize +### Options You can change build config in `config.json` - For custom `font-patcher` args, `font-forge` (and maybe `python3-fontforge` as well) is needed @@ -79,7 +101,7 @@ You can change build config in `config.json` Add `--normal` flag in `build.py` for common config, make the font just like `JetBrains Mono` (with slashed zero). -#### Font Feature Freeze Options +#### Font Feature Freeze - `enable`: Move ligature rules to `calt`, which will enable the features without setting up `cvXX` / `ssXX` / `zero` in font features config, just as default ligatures - `disable`: Remove the features in `cvXX` / `ssXX` / `zero`, which will no longer effect, even if you enable it manually @@ -95,7 +117,7 @@ If you want to build CN base fonts from variable (about 35 MB), setup `"cn.use_s The build script will auto download neccessory assets from GitHub. If you have trouble downloading, please setup `github_mirror` in `config.json` or `$GITHUB` to your environment variable. (Target URL will be `https://{github_mirror}///releases/download/{tag}/{file}`) -### Build Script Options +### Build Script Usage ``` usage: build.py [-h] [-v] [-d] [--debug] [-n] [--feat FEAT] [--hinted] [--no-hinted] diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..fb29d03 --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +foundrytools-cli==1.1.22 \ No newline at end of file