├── .editorconfig ├── .github ├── FUNDING.yml ├── dependabot.yml ├── stale.yml └── workflows │ ├── build-and-test.yml │ ├── linter.yml │ └── publish.yml ├── .gitignore ├── CHANGELOG.md ├── Dockerfile ├── Makefile ├── README.md ├── VERSION ├── assets └── build │ ├── functions.sh │ └── install.sh ├── entrypoint.sh ├── in └── .gitkeep ├── out └── .gitkeep └── tests ├── lib └── common.sh └── patch-test.sh /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | [*] 7 | charset = utf-8 8 | indent_style = space 9 | indent_size = 2 10 | end_of_line = lf 11 | insert_final_newline = true 12 | trim_trailing_whitespace = true 13 | 14 | [Makefile] 15 | indent_style = tab 16 | indent_size = 2 17 | 18 | [VERSION] 19 | insert_final_newline = false 20 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: cdalvaro 2 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | # Maintain dependencies for GitHub Actions 4 | - package-ecosystem: "github-actions" 5 | directory: "/" 6 | schedule: 7 | interval: "daily" 8 | 9 | # Configuration for Dockerfile 10 | - package-ecosystem: "docker" 11 | directory: "/" 12 | schedule: 13 | interval: "weekly" 14 | # Disable all pull requests for Docker dependencies 15 | open-pull-requests-limit: 0 16 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 60 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 7 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - pinned 8 | - security 9 | - keep-alive 10 | # Label to use when marking an issue as stale 11 | staleLabel: stale 12 | # Comment to post when marking an issue as stale. Set to `false` to disable 13 | markComment: > 14 | This issue has been automatically marked as stale because it has not had 15 | recent activity. It will be closed if no further activity occurs. Thank you 16 | for your contributions. 17 | # Comment to post when closing a stale issue. Set to `false` to disable 18 | closeComment: false 19 | -------------------------------------------------------------------------------- /.github/workflows/build-and-test.yml: -------------------------------------------------------------------------------- 1 | name: Build and test Docker image 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | paths-ignore: 8 | - "./**/*.md" 9 | - "LICENSE" 10 | 11 | env: 12 | IMAGE_NAME: localhost:5000/cdalvaro/docker-nerd-fonts-patcher:${{ github.sha }} 13 | REGISTRY_PATH: ${{ github.workspace }}/registry 14 | CACHE_PATH: /tmp/.buildx-cache 15 | 16 | jobs: 17 | build: 18 | name: Build 19 | runs-on: ubuntu-latest 20 | steps: 21 | - name: Checkout repository 22 | uses: actions/checkout@v4 23 | 24 | - name: Set up QEMU 25 | uses: docker/setup-qemu-action@v3 26 | 27 | - name: Set up Docker Buildx 28 | uses: docker/setup-buildx-action@v3 29 | with: 30 | driver-opts: network=host 31 | 32 | - name: Start Docker registry 33 | run: | 34 | docker run --rm --detach --publish 5000:5000 \ 35 | --volume ${REGISTRY_PATH}:/var/lib/registry \ 36 | --name registry registry:2 37 | 38 | - name: Cache Docker layers 39 | uses: actions/cache@v4 40 | with: 41 | path: ${{ env.CACHE_PATH }} 42 | key: ${{ runner.os }}-buildx-${{ github.sha }} 43 | restore-keys: | 44 | ${{ runner.os }}-buildx- 45 | 46 | - name: Build docker-nerd-fonts-patcher image 47 | uses: docker/build-push-action@v6 48 | with: 49 | context: . 50 | file: ./Dockerfile 51 | platforms: linux/amd64,linux/arm64 52 | cache-from: | 53 | type=local,src=${{ env.CACHE_PATH }} 54 | ghcr.io/cdalvaro/docker-nerd-fonts-patcher:latest 55 | cache-to: type=local,dest=${{ env.CACHE_PATH }} 56 | push: true 57 | tags: ${{ env.IMAGE_NAME }} 58 | 59 | - name: Stop Docker registry 60 | run: docker stop registry 61 | 62 | - name: Upload Docker registry data for testing 63 | uses: actions/upload-artifact@v4 64 | with: 65 | name: docker-registry-data 66 | path: ${{ env.REGISTRY_PATH }}/ 67 | 68 | test: 69 | name: Test 70 | runs-on: ubuntu-latest 71 | needs: build 72 | strategy: 73 | matrix: 74 | platform: [linux/amd64, linux/arm64] 75 | env: 76 | DOCKER_CLI_EXPERIMENTAL: enabled 77 | PLATFORM: ${{ matrix.platform }} 78 | 79 | steps: 80 | - name: Checkout repository 81 | uses: actions/checkout@v4 82 | 83 | - name: Download Docker registry data from build job 84 | uses: actions/download-artifact@v4 85 | with: 86 | name: docker-registry-data 87 | path: ${{ env.REGISTRY_PATH }} 88 | 89 | - name: Enable Docker experimental 90 | run: | 91 | # Enable docker daemon experimental support. 92 | echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json 93 | sudo systemctl restart docker 94 | # Install QEMU multi-architecture support for docker buildx. 95 | docker run --rm --privileged multiarch/qemu-user-static --reset -p yes 96 | 97 | - name: Start Docker registry 98 | run: | 99 | docker run --rm --detach --publish 5000:5000 \ 100 | --volume ${REGISTRY_PATH}:/var/lib/registry \ 101 | --name registry registry:2 102 | sleep 10 103 | 104 | - name: Import Docker images 105 | run: docker pull --platform ${{ matrix.platform }} ${IMAGE_NAME} 106 | 107 | - name: Docker inspect 108 | run: docker buildx imagetools inspect ${IMAGE_NAME} | grep '${{ matrix.platform }}' 109 | 110 | - name: Install ttx tool 111 | run: sudo apt update -y && sudo apt install -y python3-fonttools fonttools 112 | 113 | - name: Execute tests 114 | env: 115 | PLATFORM: ${{ matrix.platform }} 116 | run: bash tests/patch-test.sh 117 | -------------------------------------------------------------------------------- /.github/workflows/linter.yml: -------------------------------------------------------------------------------- 1 | name: Lint Code 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - main 7 | 8 | jobs: 9 | lint: 10 | name: Super Linter 11 | runs-on: ubuntu-latest 12 | steps: 13 | - name: Checkout repository 14 | uses: actions/checkout@v4 15 | with: 16 | fetch-depth: 0 17 | 18 | - name: Lint code base 19 | uses: github/super-linter@v7 20 | env: 21 | VALIDATE_ALL_CODEBASE: false 22 | VALIDATE_DOCKERFILE_HADOLINT: true 23 | VALIDATE_BASH: true 24 | DEFAULT_BRANCH: main 25 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 26 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish Docker image 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | paths-ignore: 8 | - './**/*.md' 9 | - 'LICENSE' 10 | release: 11 | types: 12 | - published 13 | 14 | env: 15 | IMAGE_NAME: cdalvaro/docker-nerd-fonts-patcher 16 | PLATFORMS: linux/amd64,linux/arm64 17 | CACHE_PATH: /tmp/.buildx-docker-nerd-fonts-patcher-cache 18 | EXTRA_REGISTRIES: ghcr.io quay.io 19 | 20 | jobs: 21 | metadata: 22 | name: Metadata 23 | runs-on: ubuntu-latest 24 | outputs: 25 | tags: ${{ steps.tags.outputs.tags }} 26 | vcs_ref: ${{ steps.vcs_ref.outputs.vcs_ref }} 27 | created_on: ${{ steps.created_on.outputs.created_on }} 28 | steps: 29 | - name: Image Tags 30 | id: tags 31 | run: | 32 | IMAGE_TAG="${{ github.event.release.tag_name }}" 33 | [ -z "${IMAGE_TAG}" ] && IMAGE_TAG='latest' 34 | 35 | DOCKER_IMAGE="${IMAGE_NAME}:${IMAGE_TAG}" 36 | TAGS="${DOCKER_IMAGE}" 37 | for registry in ${EXTRA_REGISTRIES}; do 38 | TAGS="${TAGS},${registry}/${DOCKER_IMAGE}" 39 | done 40 | 41 | echo "Image Tag: '${IMAGE_TAG}'" 42 | echo "Docker image: '${DOCKER_IMAGE}'" 43 | echo "Tags: ${TAGS}" 44 | 45 | echo ::set-output name=tags::${TAGS} 46 | 47 | - name: VCS ref 48 | id: vcs_ref 49 | run: | 50 | VCS_REF="${GITHUB_SHA::8}" 51 | echo "VCS ref: ${VCS_REF}" 52 | echo ::set-output name=vcs_ref::${VCS_REF} 53 | 54 | - name: Created On 55 | id: created_on 56 | run: | 57 | CREATED_ON="$(date -u +"%Y-%m-%dT%H:%M:%SZ")" 58 | echo "Created on: ${CREATED_ON}" 59 | echo ::set-output name=created_on::${CREATED_ON} 60 | 61 | - name: Dump environment 62 | if: contains(toJSON(github.event.commits.*.message), 'ci(debug)') == true 63 | run: env | sort 64 | - name: Dump GitHub context 65 | if: contains(toJSON(github.event.commits.*.message), 'ci(debug)') == true 66 | env: 67 | GITHUB_CONTEXT: ${{ toJson(github) }} 68 | run: echo "${GITHUB_CONTEXT}" 69 | 70 | build-publish: 71 | name: Build and publish 72 | runs-on: ubuntu-latest 73 | needs: metadata 74 | if: contains(toJSON(github.event.commits.*.message), 'ci(debug)') == false 75 | steps: 76 | - name: Checkout repository 77 | uses: actions/checkout@v4 78 | 79 | - name: Set up QEMU 80 | uses: docker/setup-qemu-action@v3 81 | 82 | - name: Set up Docker Buildx 83 | uses: docker/setup-buildx-action@v3 84 | 85 | - name: Cache Docker layers 86 | uses: actions/cache@v4 87 | with: 88 | path: ${{ env.CACHE_PATH }} 89 | key: ${{ runner.os }}-buildx-${{ github.sha }} 90 | restore-keys: | 91 | ${{ runner.os }}-buildx- 92 | 93 | - name: Login to Docker Container Registry 94 | uses: docker/login-action@v3 95 | with: 96 | username: ${{ github.repository_owner }} 97 | password: ${{ secrets.DOCKER_PASSWORD }} 98 | 99 | - name: Login to GitHub Container Registry 100 | uses: docker/login-action@v3 101 | with: 102 | registry: ghcr.io 103 | username: ${{ github.repository_owner }} 104 | password: ${{ secrets.CR_PAT }} 105 | 106 | - name: Login to Quay.io Container Registry 107 | uses: docker/login-action@v3 108 | with: 109 | registry: quay.io 110 | username: ${{ secrets.QUAYIO_USERNAME }} 111 | password: ${{ secrets.QUAYIO_PASSWORD }} 112 | 113 | - name: Build and publish 114 | uses: docker/build-push-action@v6 115 | with: 116 | platforms: ${{ env.PLATFORMS }} 117 | build-args: | 118 | VCS_REF=${{ needs.metadata.outputs.vcs_ref }} 119 | BUILD_DATE=${{ needs.metadata.outputs.created_on }} 120 | cache-from: | 121 | ghcr.io/${{ env.IMAGE_NAME }}:latest 122 | type=local,src=${{ env.CACHE_PATH }} 123 | cache-to: type=local,dest=${{ env.CACHE_PATH }} 124 | push: true 125 | tags: ${{ needs.metadata.outputs.tags }} 126 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Default directories 2 | in/ 3 | out/ 4 | tests/assets/ 5 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | The following list only reflects changes made on this project. Please, refer to the [Nerd Fonts 3.4.0 Release Notes](https://www.nerdfonts.com/releases) for the complete list of changes. 4 | 5 | **3.4.0** 6 | 7 | - Upgrade Nerd Fonts to `3.4.0` 8 | - Change Docker base image to `ubuntu:noble-20250415.1` 9 | 10 | **3.3.0** 11 | 12 | - Upgrade Nerd Fonts to `3.3.0` 13 | 14 | **3.2.1** 15 | 16 | - Upgrade Nerd Fonts to `3.2.1` 17 | 18 | **3.2.0** 19 | 20 | - Upgrade Nerd Fonts to `3.2.0` 21 | - Change Docker base image to `ubuntu:jammy-20240227` 22 | 23 | **3.1.1** 24 | 25 | - Upgrade Nerd Fonts to `3.1.1` 26 | 27 | **3.1.0** 28 | 29 | - Upgrade Nerd Fonts to `3.1.0` 30 | - Change Docker base image to `ubuntu:jammy-20231004` 31 | - Drop arm7l architecture support 32 | 33 | **3.0.0** 34 | 35 | - Upgrade Nerd Fonts to `3.0.0` 36 | - Change Docker base image to `ubuntu:jammy-20230308` 37 | 38 | **2.3.1** 39 | 40 | - Upgrade Nerd Fonts to `2.3.1` 41 | 42 | **2.3.0** 43 | 44 | - Upgrade Nerd Fonts to `2.3.0` 45 | - Upgrade Font Forge to `20230101` 46 | - Change Docker base image to `ubuntu:jammy-20221130` 47 | 48 | **2.2.2** 49 | 50 | - Upgrade Nerd Fonts to `2.2.2` 51 | 52 | **2.2.1** 53 | 54 | - Upgrade Nerd Fonts to `2.2.1` 55 | 56 | **2.2.0** 57 | 58 | - Upgrade Nerd Fonts to `2.2.0` 59 | - Change Docker base image to `ubuntu:jammy-20220801` 60 | - CI: Replace CircleCI with GitHub Actions 61 | - CI: Improve build time 62 | 63 | **2.1.0** 64 | 65 | - Upgrade Nerd Fonts to `2.1.0` 66 | - Change Docker base image to `ubuntu:20200112` 67 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:noble-20250415.1 2 | 3 | ARG BUILD_DATE 4 | ARG VCS_REF 5 | 6 | # https://github.com/ryanoasis/nerd-fonts/releases 7 | ENV NERDFONTS_VERSION="v3.4.0" \ 8 | NERDFONTS_SHA256="0387198b376639dc2f5359b52b9edc4861ef7ad48b769fcad045736ad1a27d03" 9 | ENV IMAGE_VERSION="${NERDFONTS_VERSION}" 10 | 11 | ENV BUILD_DIR="/build" \ 12 | WORKDIR="/nerd-fonts" 13 | 14 | ENV FONTPATCHER_DIR="${WORKDIR}/repo" 15 | RUN mkdir -p "${FONTPATCHER_DIR}" 16 | 17 | # Install nerd fonts 18 | COPY assets/build/ ${BUILD_DIR} 19 | WORKDIR ${BUILD_DIR} 20 | RUN bash ${BUILD_DIR}/install.sh && rm -rf ${BUILD_DIR} 21 | 22 | LABEL org.opencontainers.image.title="Dockerized Nerd Fonts Patcher" 23 | LABEL org.opencontainers.image.description="Nerd Fonts ${NERDFONTS_VERSION} containerized" 24 | LABEL org.opencontainers.image.documentation="https://github.com/cdalvaro/docker-nerd-fonts-patcher/blob/${IMAGE_VERSION}/README.md" 25 | LABEL org.opencontainers.image.url="https://github.com/cdalvaro/docker-nerd-fonts-patcher" 26 | LABEL org.opencontainers.image.source="https://github.com/cdalvaro/docker-nerd-fonts-patcher" 27 | LABEL org.opencontainers.image.authors="Carlos Álvaro " 28 | LABEL org.opencontainers.image.vendor="cdalvaro" 29 | LABEL org.opencontainers.image.created="${BUILD_DATE}" 30 | LABEL org.opencontainers.image.version="${IMAGE_VERSION}" 31 | LABEL org.opencontainers.image.revision="${VCS_REF}" 32 | LABEL org.opencontainers.image.base.name="ubuntu:noble-20250415.1" 33 | LABEL org.opencontainers.image.licenses="MIT" 34 | 35 | # Entrypoint 36 | COPY entrypoint.sh /sbin/entrypoint.sh 37 | RUN chmod +x /sbin/entrypoint.sh 38 | 39 | WORKDIR ${WORKDIR} 40 | ENTRYPOINT ["/sbin/entrypoint.sh"] 41 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Check if Docker is installed 2 | DOCKER := $(shell command -v docker 2> /dev/null) 3 | 4 | # Check if Podman is installed 5 | PODMAN := $(shell command -v podman 2> /dev/null) 6 | 7 | # If neither Docker nor Podman is installed, exit with an error 8 | ifeq (,$(or $(DOCKER),$(PODMAN))) 9 | $(error "Neither Docker nor Podman is installed.") 10 | endif 11 | 12 | # If Podman is installed, use it instead of Docker 13 | ifdef PODMAN 14 | CONTAINER_ENGINE := podman 15 | else 16 | CONTAINER_ENGINE := docker 17 | endif 18 | 19 | .PHONY: help build release patch 20 | 21 | all: build 22 | 23 | help: 24 | @echo "" 25 | @echo "-- Help Menu" 26 | @echo "" 27 | @echo " 1. make build - build the nerd-fonts-patcher image" 28 | @echo " 2. make release - build the nerd-fonts-patcher image with the version tag" 29 | @echo " 3. make patch - patch monospace fonts inside '$(shell pwd)/in' directory with the complete set of glyphs" 30 | 31 | build: 32 | $(CONTAINER_ENGINE) build --tag=ghcr.io/cdalvaro/docker-nerd-fonts-patcher:latest . 33 | 34 | release: build 35 | $(CONTAINER_ENGINE) tag ghcr.io/cdalvaro/docker-nerd-fonts-patcher:latest \ 36 | ghcr.io/cdalvaro/docker-nerd-fonts-patcher:$(shell cat VERSION) 37 | 38 | patch: 39 | $(CONTAINER_ENGINE) run -it --rm \ 40 | --volume $(shell pwd)/in:/input \ 41 | --volume $(shell pwd)/out:/output \ 42 | --user $(shell id -u):$(shell id -g) \ 43 | -- \ 44 | ghcr.io/cdalvaro/docker-nerd-fonts-patcher:latest \ 45 | --quiet --no-progressbars --complete 46 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Nerd Fonts][nerdfonts_badge]][nerdfonts_release_notes] 2 | [![Ubuntu Image][ubuntu_badge]][ubuntu_hub_docker] 3 | [![Publish Workflow][github_publish_badge]][github_publish_workflow] 4 | 5 | [![Docker Image Size][docker_size_badge]][docker_hub_tags] 6 | [![Architecture AMD64][arch_amd64_badge]][arch_link] 7 | [![Architecture ARM64][arch_arm64_badge]][arch_link] 8 | 9 | # Dockerized Nerd Fonts Patcher v3.4.0 10 | 11 | Dockerfile to build a Nerd Fonts Patcher image for the Docker opensource container platform. 12 | 13 | [**Nerd Fonts**](https://www.nerdfonts.com) is a project that patches developer targeted fonts with a high number of 14 | glyphs (icons). 15 | Specifically to add a high number of extra glyphs from popular 'iconic fonts' such as 16 | [Font Awesome ➶][font-awesome], [Devicons ➶][vorillaz-devicons] and [Octicons ➶][octicons]. 17 | 18 |
19 | 20 | Nerd Fonts Sankey Diagram 21 | 22 |
23 | 24 | ## Patch Your Own Font 25 | 26 | Just copy all your fonts you want to patch into `$(pwd)/in` directory and execute the following command: 27 | 28 | ```sh 29 | make patch 30 | ``` 31 | 32 | If you want to use [additional options](https://github.com/ryanoasis/nerd-fonts/wiki/ScriptOptions), you can use `docker run` to patch your fonts: 33 | 34 | ```sh 35 | docker run --rm \ 36 | --volume "$(pwd)/in":/input \ 37 | --volume "$(pwd)/out":/output \ 38 | --env PUID=$(id -u) --env PGID=$(id -g) \ 39 | ghcr.io/cdalvaro/docker-nerd-fonts-patcher:latest \ 40 | --quiet --no-progressbars --complete --careful 41 | ``` 42 | 43 | The container will patch all files with extensions: `.otf`, `.ttf`, `.woff`, `.eot`, `.ttc` inside `$(pwd)/in` and 44 | leave them into `$(pwd)/out`. 45 | 46 | Environment variables `PUID` and `PGID` are used to set the user and group id of the files created by the container. 47 | 48 | More information is available at the [official documentation][patch-your-own-font] site. 49 | 50 | ## Available Sources 51 | 52 | This image can be downloaded from [Dockerhub](https://hub.docker.com/r/cdalvaro/docker-nerd-fonts-patcher/) 53 | 54 | ```sh 55 | docker pull cdalvaro/docker-nerd-fonts-patcher:latest 56 | ``` 57 | 58 | from [Quay.io](https://quay.io/repository/cdalvaro/docker-nerd-fonts-patcher) too. 59 | 60 | ```sh 61 | docker pull quay.io/cdalvaro/docker-nerd-fonts-patcher 62 | ``` 63 | 64 | or from [GitHub Container Registry](https://ghcr.io/cdalvaro/docker-nerd-fonts-patcher) too. 65 | 66 | ```sh 67 | docker pull ghcr.io/cdalvaro/docker-nerd-fonts-patcher 68 | ``` 69 | 70 | [nerdfonts_badge]: https://img.shields.io/badge/Nerd%20Fonts-v3.4.0-lightgrey.svg 71 | [nerdfonts_release_notes]: https://github.com/ryanoasis/nerd-fonts/releases/tag/v3.4.0 "Nerd Fonts Release Notes" 72 | [ubuntu_badge]: https://img.shields.io/badge/ubuntu-jammy--20240227-E95420.svg?logo=Ubuntu 73 | [ubuntu_hub_docker]: https://hub.docker.com/_/ubuntu/ "Ubuntu Image" 74 | [github_publish_badge]: https://github.com/cdalvaro/docker-nerd-fonts-patcher/actions/workflows/publish.yml/badge.svg 75 | [github_publish_workflow]: https://github.com/cdalvaro/docker-nerd-fonts-patcher/actions/workflows/publish.yml 76 | [docker_size_badge]: https://img.shields.io/docker/image-size/cdalvaro/docker-nerd-fonts-patcher/latest?logo=docker&color=2496ED 77 | [docker_hub_tags]: https://hub.docker.com/repository/docker/cdalvaro/docker-nerd-fonts-patcher/tags 78 | [arch_amd64_badge]: https://img.shields.io/badge/arch-amd64-inactive.svg 79 | [arch_arm64_badge]: https://img.shields.io/badge/arch-arm64-inactive.svg 80 | [arch_link]: https://github.com/users/cdalvaro/packages/container/package/docker-nerd-fonts-patcher 81 | [vorillaz-devicons]: https://vorillaz.github.io/devicons/ 82 | [font-awesome]: https://github.com/FortAwesome/Font-Awesome 83 | [octicons]: https://github.com/primer/octicons 84 | [patch-your-own-font]: https://github.com/ryanoasis/nerd-fonts/blob/master/readme.md#option-8-patch-your-own-font 85 | -------------------------------------------------------------------------------- /VERSION: -------------------------------------------------------------------------------- 1 | 3.4.0 -------------------------------------------------------------------------------- /assets/build/functions.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 6 | # NAME: log_debug 7 | # DESCRIPTION: Echo debug information to stdout. 8 | #---------------------------------------------------------------------------------------------------------------------- 9 | function log_debug() { 10 | if [[ "${DEBUG,,}" == true || "${ECHO_DEBUG,,}" == true ]]; then 11 | echo "[DEBUG] - $*" 12 | fi 13 | } 14 | 15 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 16 | # NAME: log_info 17 | # DESCRIPTION: Echo information to stdout. 18 | #---------------------------------------------------------------------------------------------------------------------- 19 | function log_info() { 20 | echo "[INFO] - $*" 21 | } 22 | 23 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 24 | # NAME: log_warn 25 | # DESCRIPTION: Echo warning information to stdout. 26 | #---------------------------------------------------------------------------------------------------------------------- 27 | function log_warn() { 28 | (echo >&2 "[WARN] - $*") 29 | } 30 | 31 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 32 | # NAME: log_error 33 | # DESCRIPTION: Echo errors to stderr. 34 | #---------------------------------------------------------------------------------------------------------------------- 35 | function log_error() { 36 | (echo >&2 "[ERROR] - $*") 37 | } 38 | 39 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 40 | # NAME: is_arm32 41 | # DESCRIPTION: Check whether the platform is ARM 32-bits or not. 42 | #---------------------------------------------------------------------------------------------------------------------- 43 | function is_arm32() { 44 | uname -m | grep -qE 'armv7l' 45 | } 46 | 47 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 48 | # NAME: is_arm32 49 | # DESCRIPTION: Check whether the platform is ARM 64-bits or not. 50 | #---------------------------------------------------------------------------------------------------------------------- 51 | function is_arm64() { 52 | uname -m | grep -qE 'arm64|aarch64' 53 | } 54 | 55 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 56 | # NAME: is_arm32 57 | # DESCRIPTION: Check whether the platform is ARM or not. 58 | #---------------------------------------------------------------------------------------------------------------------- 59 | function is_arm() { 60 | is_arm32 || is_arm64 61 | } 62 | 63 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 64 | # NAME: install_pkgs 65 | # DESCRIPTION: Install packages using apt-get install. 66 | #---------------------------------------------------------------------------------------------------------------------- 67 | function install_pkgs() { 68 | apt-get install --no-install-recommends --yes "$@" 69 | } 70 | 71 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 72 | # NAME: download 73 | # DESCRIPTION: Download the content from the given URL and save it into the specified file. 74 | #---------------------------------------------------------------------------------------------------------------------- 75 | function download() { 76 | local URL="$1"; shift 77 | local FILE_NAME="$1"; shift 78 | 79 | local WGET_ARGS=(--quiet) 80 | is_arm32 && WGET_ARGS+=(--no-check-certificate) 81 | 82 | log_info "Downloading ${FILE_NAME} from ${URL} ..." 83 | wget "${WGET_ARGS[@]}" "$@" -O "${FILE_NAME}" "${URL}" 84 | if [[ -f "${FILE_NAME}" ]]; then 85 | log_debug "Success!" 86 | else 87 | log_error "Failed to download ${URL}" 88 | exit 1 89 | fi 90 | } 91 | 92 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 93 | # NAME: check_sha256 94 | # DESCRIPTION: Compute the SHA256 hash for the given file and check if it matches the expected one. 95 | #---------------------------------------------------------------------------------------------------------------------- 96 | function check_sha256() { 97 | local FILE="${1}" 98 | local SHA256="${2}" 99 | 100 | log_info "Checking ${FILE} SHA256 hash ..." 101 | if echo "${SHA256} ${FILE}" | shasum -a 256 -c --status -; then 102 | log_debug "SHA256 hash for ${FILE} matches! (${SHA256})" 103 | else 104 | local HASH 105 | HASH=$(shasum -a 256 "${FILE}" | awk '{print $1}') 106 | log_error "SHA256 checksum mismatch for ${FILE}" 107 | log_error "Expected: ${SHA256}" 108 | log_error " Got: ${HASH}" 109 | exit 1 110 | fi 111 | } 112 | 113 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 114 | # NAME: extract 115 | # DESCRIPTION: Extract the given .tar.gz into the current directory. 116 | #---------------------------------------------------------------------------------------------------------------------- 117 | function extract() { 118 | local FILE="${1}"; shift 119 | local EXTRACT_DIR="${1}"; shift 120 | 121 | log_info "Unpacking file: ${FILE}" 122 | mkdir -p "${EXTRACT_DIR}" 123 | tar xzf "${FILE}" --directory="${EXTRACT_DIR}" --strip-components 1 "$@" 124 | } 125 | 126 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 127 | # NAME: build_and_install 128 | # DESCRIPTION: Build and install the given package from the current directory using cmake. 129 | #---------------------------------------------------------------------------------------------------------------------- 130 | function build_and_install() { 131 | local PACKAGE_NAME="${1}"; shift 132 | local CMAKE_ARGS=( 133 | -Wno-dev 134 | -DCMAKE_BUILD_TYPE=Release 135 | ) 136 | 137 | CMAKE_ARGS+=("$@") 138 | 139 | CMAKE_BUILD_DIR="cmake-build-release" 140 | mkdir -p "${CMAKE_BUILD_DIR}" 141 | pushd "${CMAKE_BUILD_DIR}" 142 | 143 | log_info "Building and installing ${PACKAGE_NAME} ..." 144 | log_debug "CMAKE_ARGS: ${CMAKE_ARGS[*]}" 145 | cmake "${CMAKE_ARGS[@]}" .. 146 | cmake --build . --target install --config Release 147 | 148 | popd 149 | } 150 | 151 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 152 | # NAME: install_fontforge 153 | # DESCRIPTION: Install fontforge 154 | #---------------------------------------------------------------------------------------------------------------------- 155 | function install_fontforge() { 156 | local VERSION="${1}" 157 | local SHA256="${2}" 158 | 159 | local URL="https://github.com/fontforge/fontforge/archive/refs/tags/${VERSION}.tar.gz" 160 | local FILE="fontforge.tar.gz" 161 | local EXTRACT_DIR="fontforge-build" 162 | 163 | download "${URL}" "${FILE}" 164 | check_sha256 "${FILE}" "${SHA256}" 165 | extract "${FILE}" "${EXTRACT_DIR}" 166 | 167 | BUILD_OPTS=( 168 | -DENABLE_GUI=OFF 169 | ) 170 | 171 | (cd $EXTRACT_DIR && build_and_install "fontforge ${VERSION}" "${BUILD_OPTS[@]}") 172 | } 173 | -------------------------------------------------------------------------------- /assets/build/install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | export DEBIAN_FRONTEND=noninteractive 6 | 7 | FUNCTIONS_FILE="${BUILD_DIR}/functions.sh" 8 | # shellcheck source=assets/build/functions.sh 9 | source "${FUNCTIONS_FILE}" 10 | 11 | log_info "Installing required packages and build dependencies ..." 12 | REQUIRED_PACKAGES=( 13 | libpng16-16 zlib1g libjpeg8 libxml2 libspiro1 libgif7 libtiff6 \ 14 | libiconv-hook1 libfreetype6 libcairo2 libwoff1 libglib2.0-0 \ 15 | libuninameslist1 libreadline8 libpython3.10 python3 unifont \ 16 | python3-setuptools python3-dev python3-fonttools fonttools 17 | ) 18 | 19 | BUILD_DEPENDENCIES=( 20 | libjpeg-dev libtiff5-dev libpng-dev libfreetype6-dev libgif-dev \ 21 | libxml2-dev libpango1.0-dev libcairo2-dev libspiro-dev \ 22 | libuninameslist-dev libreadline-dev libwoff-dev ca-certificates \ 23 | ninja-build cmake build-essential openssl wget gettext git \ 24 | apt-transport-https 25 | ) 26 | 27 | apt-get update 28 | install_pkgs "${REQUIRED_PACKAGES[@]}" "${BUILD_DEPENDENCIES[@]}" 29 | 30 | # Install fontforge 31 | FONTFORGE_VERSION="20230101" 32 | FONTFORGE_SHA256="ab0c4be41be15ce46a1be1482430d8e15201846269de89df67db32c7de4343f1" 33 | install_fontforge "${FONTFORGE_VERSION}" "${FONTFORGE_SHA256}" 34 | 35 | # Download nerd-fonts 36 | NERDFONTS_URL="https://github.com/ryanoasis/nerd-fonts/archive/refs/tags/${NERDFONTS_VERSION}.tar.gz" 37 | NERDFONTS_FILE_NAME="nerd-fonts.tar.gz" 38 | download "${NERDFONTS_URL}" "${NERDFONTS_FILE_NAME}" 39 | check_sha256 "${NERDFONTS_FILE_NAME}" "${NERDFONTS_SHA256}" 40 | extract "${NERDFONTS_FILE_NAME}" "${FONTPATCHER_DIR}" --exclude='patched-fonts' 41 | 42 | # Purge build dependencies and cleanup apt 43 | apt-get purge -y --auto-remove "${BUILD_DEPENDENCIES[@]}" 44 | apt-get clean --yes 45 | rm -rf /var/lib/apt/lists/* 46 | rm -rf "${BUILD_DIR}" 47 | 48 | export -n DEBIAN_FRONTEND 49 | -------------------------------------------------------------------------------- /entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | INPUT_DIR="/input" 6 | OUTPUT_DIR="/output" 7 | 8 | # Auxiliary functions 9 | RESET='\033[0m' 10 | RED='\033[1;31m' 11 | GREEN='\033[1;32m' 12 | YELLOW='\033[1;33m' 13 | CYAN='\033[1;36m' 14 | 15 | function log_info() { 16 | echo -e "${GREEN}Info${RESET}: $*" 17 | } 18 | 19 | function log_warn() { 20 | echo -e "${YELLOW}Warning${RESET}: $*" 21 | } 22 | 23 | function log_error() { 24 | (>&2 echo -e "${RED}Error${RESET}: $*") 25 | } 26 | 27 | if [[ -z "${FONTPATCHER_DIR}" ]]; then 28 | log_error "FONTPATCHER_DIR environment variable should be set but it is not. Please report this issue at: https://github.com/cdalvaro/docker-nerd-fonts-patcher/issues" 29 | exit 1 30 | fi 31 | 32 | FONTPATCHER_SCRIPT="${FONTPATCHER_DIR}/font-patcher" 33 | 34 | # Validate arguments 35 | options=() 36 | while [[ $# -gt 0 ]]; do 37 | param="$1"; shift 38 | case "${param}" in 39 | -h|--help) 40 | exec fontforge -script "${FONTPATCHER_SCRIPT}" --help ;; 41 | -v|--version) 42 | exec fontforge -script "${FONTPATCHER_SCRIPT}" --version ;; 43 | -out|--outputdir) 44 | log_warn "Output directory cannot be modified. Default is: ${CYAN}${OUTPUT_DIR}/${RESET}" 45 | shift ;; 46 | *) 47 | options+=("${param}") ;; 48 | esac 49 | done 50 | 51 | # Check whether output directory exists 52 | if [[ ! -d ${OUTPUT_DIR} ]]; then 53 | log_error "Directory ${CYAN}${OUTPUT_DIR}/${RESET} does not exists. You must create an output volume like this: ${CYAN}--volume \$(pwd)/out:${OUTPUT_DIR}${RESET}" 54 | exit 1 55 | fi 56 | 57 | # Get fonts available in the input directory 58 | fonts=() 59 | while IFS='' read -r line; do 60 | fonts+=("${line}") 61 | done < <(find "${INPUT_DIR}/" -type f -iregex '.*\.\(otf\|ttf\|woff\|eot\|ttc\)$' 2>/dev/null || true) 62 | 63 | # Check whether there are fonts to patch 64 | if [[ ${#fonts[@]} -eq 0 ]]; then 65 | log_error "There are no fonts with extensions: ${CYAN}.otf${RESET}, ${CYAN}.ttf${RESET}, ${CYAN}.woff${RESET}, ${CYAN}.eot${RESET} or ${CYAN}.ttc${RESET} inside ${CYAN}${INPUT_DIR}/${RESET} directory" 66 | exit 1 67 | fi 68 | 69 | # Patch fonts 70 | for font in "${fonts[@]}"; do 71 | log_info "Patching font ${CYAN}${font}${RESET} ..." 72 | fontforge -script "${FONTPATCHER_SCRIPT}" -out "${OUTPUT_DIR}/" "${options[@]}" "${font}" 73 | done 74 | 75 | # Save log file 76 | LOG_FILE="font-patcher-log.txt" 77 | [[ -f "${LOG_FILE}" ]] && cp -f "${LOG_FILE}" "${OUTPUT_DIR}/" 78 | 79 | if [[ -n "${PUID}" ]]; then 80 | OWNERSHIP="${PUID}" 81 | [[ -n "${PGID}" ]] && OWNERSHIP="${OWNERSHIP}:${PGID}" 82 | 83 | log_info "Changing ownership of ${CYAN}${OUTPUT_DIR}/${RESET} to ${CYAN}${OWNERSHIP}${RESET} ..." 84 | chown -R "${OWNERSHIP}" "${OUTPUT_DIR}" 85 | fi 86 | 87 | exit 0 88 | -------------------------------------------------------------------------------- /in/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdalvaro/docker-nerd-fonts-patcher/c1fe610a65844946ce200c846b040bbfe12be93b/in/.gitkeep -------------------------------------------------------------------------------- /out/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cdalvaro/docker-nerd-fonts-patcher/c1fe610a65844946ce200c846b040bbfe12be93b/out/.gitkeep -------------------------------------------------------------------------------- /tests/lib/common.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # shellcheck disable=SC2312 4 | 5 | #--- ENV VARIABLE --------------------------------------------------------------------------------------------------- 6 | # NAME: IMAGE_NAME 7 | # DESCRIPTION: The name and tag of the Docker image. Default: 'cdalvaro/docker-nerd-fonts-patcher:latest'. 8 | #---------------------------------------------------------------------------------------------------------------------- 9 | export IMAGE_NAME=${IMAGE_NAME:-'cdalvaro/docker-nerd-fonts-patcher:latest'} 10 | 11 | #--- ENV VARIABLE --------------------------------------------------------------------------------------------------- 12 | # NAME: PLATFORM 13 | # DESCRIPTION: The platform to run the tests on. Default: the current platform. 14 | #---------------------------------------------------------------------------------------------------------------------- 15 | export PLATFORM=${PLATFORM:-$(docker version --format='{{.Server.Os}}/{{.Server.Arch}}')} 16 | 17 | #--- ENV VARIABLE --------------------------------------------------------------------------------------------------- 18 | # NAME: INPUT_DIR 19 | # DESCRIPTION: The path to the input directory. Default: 'in'. 20 | #---------------------------------------------------------------------------------------------------------------------- 21 | export INPUT_DIR="${INPUT_DIR:-"$(pwd)/in"}" 22 | 23 | #--- ENV VARIABLE --------------------------------------------------------------------------------------------------- 24 | # NAME: OUTPUT_DIR 25 | # DESCRIPTION: The path to the output directory. Default: 'out'. 26 | #---------------------------------------------------------------------------------------------------------------------- 27 | export OUTPUT_DIR="${OUTPUT_DIR:-"$(pwd)/out"}" 28 | 29 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 30 | # NAME: lowercase 31 | # DESCRIPTION: Lowercase a string. 32 | #---------------------------------------------------------------------------------------------------------------------- 33 | function lowercase() { 34 | echo "$1" | tr '[:upper:]' '[:lower:]' 35 | } 36 | 37 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 38 | # NAME: log_debug 39 | # DESCRIPTION: Echo debug information to stdout. 40 | #---------------------------------------------------------------------------------------------------------------------- 41 | function log_debug() { 42 | ECHO_DEBUG=$(lowercase "${ECHO_DEBUG:-${DEBUG:-false}}") 43 | 44 | if [[ "${ECHO_DEBUG}" == true ]]; then 45 | echo "🧪 [DEBUG] - $*" 46 | fi 47 | } 48 | 49 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 50 | # NAME: log_info 51 | # DESCRIPTION: Echo information to stdout. 52 | #---------------------------------------------------------------------------------------------------------------------- 53 | function log_info() { 54 | echo "ℹ️ [INFO] - $*" 55 | } 56 | 57 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 58 | # NAME: log_warn 59 | # DESCRIPTION: Echo warning information to stdout. 60 | #---------------------------------------------------------------------------------------------------------------------- 61 | function log_warn() { 62 | (echo >&2 "⚠️ [WARN] - $*") 63 | } 64 | 65 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 66 | # NAME: log_error 67 | # DESCRIPTION: Echo errors to stderr. 68 | #---------------------------------------------------------------------------------------------------------------------- 69 | function log_error() { 70 | (echo >&2 "❌ [ERROR] - $*") 71 | } 72 | 73 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 74 | # NAME: is_arm32 75 | # DESCRIPTION: Check whether the platform is ARM 32-bits or not. 76 | #---------------------------------------------------------------------------------------------------------------------- 77 | function is_arm32() { 78 | uname -m | grep -qE 'armv7l' 79 | } 80 | 81 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 82 | # NAME: is_arm32 83 | # DESCRIPTION: Check whether the platform is ARM 64-bits or not. 84 | #---------------------------------------------------------------------------------------------------------------------- 85 | function is_arm64() { 86 | uname -m | grep -qE 'arm64|aarch64' 87 | } 88 | 89 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 90 | # NAME: is_arm32 91 | # DESCRIPTION: Check whether the platform is ARM or not. 92 | #---------------------------------------------------------------------------------------------------------------------- 93 | function is_arm() { 94 | is_arm32 || is_arm64 95 | } 96 | 97 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 98 | # NAME: ok 99 | # DESCRIPTION: Print a successfull message. 100 | #---------------------------------------------------------------------------------------------------------------------- 101 | function ok() 102 | { 103 | echo "✅ $*" 104 | } 105 | 106 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 107 | # NAME: error 108 | # DESCRIPTION: Print an error message, show the salt-master log and exit with code 1. 109 | #---------------------------------------------------------------------------------------------------------------------- 110 | function error() 111 | { 112 | echo "🔥 $*" 113 | return 1 114 | } 115 | 116 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 117 | # NAME: download 118 | # DESCRIPTION: Download the content from the given URL and save it into the specified file. 119 | #---------------------------------------------------------------------------------------------------------------------- 120 | function download() { 121 | local URL="$1"; shift 122 | local FILE_NAME="$1"; shift 123 | 124 | local WGET_ARGS=(--quiet) 125 | is_arm32 && WGET_ARGS+=(--no-check-certificate) 126 | 127 | log_info "Downloading ${FILE_NAME} from ${URL} ..." 128 | wget "${WGET_ARGS[@]}" "$@" -O "${FILE_NAME}" "${URL}" 129 | if [[ -f "${FILE_NAME}" ]]; then 130 | log_debug "Success!" 131 | else 132 | log_error "Failed to download ${URL}" 133 | return 1 134 | fi 135 | } 136 | 137 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 138 | # NAME: check_sha256 139 | # DESCRIPTION: Compute the SHA256 hash for the given file and check if it matches the expected one. 140 | #---------------------------------------------------------------------------------------------------------------------- 141 | function check_sha256() { 142 | local FILE="${1}" 143 | local SHA256="${2}" 144 | 145 | log_info "Checking ${FILE} SHA256 hash ..." 146 | if echo "${SHA256} ${FILE}" | shasum -a 256 -c --status -; then 147 | log_debug "SHA256 hash for ${FILE} matches! (${SHA256})" 148 | else 149 | local HASH 150 | HASH=$(shasum -a 256 "${FILE}" | awk '{print $1}') 151 | log_error "SHA256 checksum mismatch for ${FILE}" 152 | log_error "Expected: ${SHA256}" 153 | log_error " Got: ${HASH}" 154 | return 1 155 | fi 156 | } 157 | 158 | #--- FUNCTION ------------------------------------------------------------------------------------------------------- 159 | # NAME: check_equal 160 | # DESCRIPTION: Check if the given value is equal to the expected value. 161 | #---------------------------------------------------------------------------------------------------------------------- 162 | function check_equal() 163 | { 164 | local current="$1" 165 | local expected="$2" 166 | local message="$3" 167 | 168 | output=$(cat </dev/null 2>&1 10 | pwd -P 11 | )" 12 | COMMON_FILE="${SCRIPT_PATH}/lib/common.sh" 13 | 14 | # shellcheck source=tests/lib/common.sh 15 | source "${COMMON_FILE}" 16 | [[ "$(lowercase "${DEBUG:-false}")" == true ]] && set -vx 17 | 18 | NERDFONTS_VERSION="$(cat VERSION)" 19 | 20 | log_info "🧪 Running patch tests ..." 21 | 22 | # Setup 23 | WORK_DIR="$(mktemp -d)" 24 | pushd "${WORK_DIR}" 25 | 26 | # Test font-patcher version 27 | log_info "Checking font-patcher version..." 28 | FONTPATCHER_VERSION="$(font_patcher --version | grep 'Nerd Fonts Patcher')" 29 | check_regex "${FONTPATCHER_VERSION}" "${NERDFONTS_VERSION}" 30 | 31 | ### GIVEN 32 | TEST_FONT_NAME="FiraCode" 33 | 34 | TEST_FONT_FILE_NAME="${TEST_FONT_NAME}Original.zip" 35 | TEST_FONT_URL="https://github.com/tonsky/FiraCode/releases/download/6.2/Fira_Code_v6.2.zip" 36 | 37 | NERDFONT_FONT_FILE_NAME="${TEST_FONT_NAME}NerdFont.zip" 38 | NERDFONT_FONT_URL="https://github.com/ryanoasis/nerd-fonts/releases/download/v${NERDFONTS_VERSION}/${TEST_FONT_NAME}.zip" 39 | 40 | ### THEN 41 | log_info "==> Downloading original ${TEST_FONT_NAME} (${TEST_FONT_URL}) font ..." 42 | download "${TEST_FONT_URL}" "${TEST_FONT_FILE_NAME}" 43 | 44 | TEST_FONT_DIRECTORY="$(mktemp -d)" 45 | unzip -q "${TEST_FONT_FILE_NAME}" -d "${TEST_FONT_DIRECTORY}/" 46 | mv "${TEST_FONT_DIRECTORY}"/ttf/*.ttf "${INPUT_DIR}/" 47 | 48 | log_info "==> Patching original ${TEST_FONT_NAME} font ..." 49 | font_patcher --quiet --no-progressbars --complete 2>/dev/null 50 | 51 | log_info "==> Downloading patched ${TEST_FONT_NAME} font ..." 52 | download "${NERDFONT_FONT_URL}" "${NERDFONT_FONT_FILE_NAME}" 53 | 54 | log_info "==> Comparing own patched fonts with nerd font patched fonts ..." 55 | mkdir -p patched/ 56 | unzip -q "${NERDFONT_FONT_FILE_NAME}" -d patched/ 57 | 58 | while IFS='' read -r FONT; do 59 | log_info "==> Comparing ${FONT} ..." 60 | 61 | patched_font="${OUTPUT_DIR}/${FONT}" 62 | [[ -f "${patched_font}" ]] || error "Font ${FONT} not found: ${patched_font}" 63 | 64 | get_font_info "${patched_font}" custom_patched_font.ttx 65 | get_font_info "patched/${FONT}" nerdfonts_patched_font.ttx 66 | 67 | diff -u nerdfonts_patched_font.ttx custom_patched_font.ttx || error "Font ${FONT} is not patched correctly" 68 | ok "Font ${FONT} is patched correctly" 69 | done < <(find "${OUTPUT_DIR}" -type f -maxdepth 1 -iname '*.ttf' -exec basename {} \; 2>/dev/null) 70 | 71 | popd 72 | --------------------------------------------------------------------------------