diff options
| author | Ahmed Abdelhalim <[email protected]> | 2026-01-18 21:46:58 +0100 |
|---|---|---|
| committer | Ahmed Abdelhalim <[email protected]> | 2026-01-18 21:54:25 +0100 |
| commit | f2232d636bae4eed0dbdda8e2314b91a489d4878 (patch) | |
| tree | 3d67d741558928a1302d80a78b79e576ad838f93 /roles/font | |
| parent | 03f0e7c569c828e1ef314528d8e4f1a3909974b0 (diff) | |
Fix font role
Diffstat (limited to 'roles/font')
| -rw-r--r-- | roles/font/meta/argument_specs.yml | 6 | ||||
| -rw-r--r-- | roles/font/meta/main.yml | 17 | ||||
| -rw-r--r-- | roles/font/tasks/main.yml | 52 | ||||
| -rw-r--r-- | roles/font/templates/local.conf.j2 | 68 | ||||
| -rw-r--r-- | roles/font/vars/archlinux.yml | 8 | ||||
| -rw-r--r-- | roles/font/vars/debian.yml | 8 |
6 files changed, 159 insertions, 0 deletions
diff --git a/roles/font/meta/argument_specs.yml b/roles/font/meta/argument_specs.yml new file mode 100644 index 00000000..d44dc8c8 --- /dev/null +++ b/roles/font/meta/argument_specs.yml @@ -0,0 +1,6 @@ +--- +argument_specs: + main: + short_description: "Install fonts on Linux distributions" + description: "Install fonts on Linux distributions" + options: {} diff --git a/roles/font/meta/main.yml b/roles/font/meta/main.yml new file mode 100644 index 00000000..b1706f98 --- /dev/null +++ b/roles/font/meta/main.yml @@ -0,0 +1,17 @@ +--- +dependencies: [] +galaxy_info: + author: "a14m" + description: "Install fonts on linux distros." + license: "MIT" + min_ansible_version: "2.18" + platforms: + - name: "ArchLinux" + versions: + - "all" + - name: "Ubuntu" + versions: + - "noble" + - name: "Debian" + versions: + - "bookworm" diff --git a/roles/font/tasks/main.yml b/roles/font/tasks/main.yml new file mode 100644 index 00000000..4e1da0ae --- /dev/null +++ b/roles/font/tasks/main.yml @@ -0,0 +1,52 @@ +--- +- name: "Include OS-specific variables" + ansible.builtin.include_vars: "{{ ansible_os_family | lower }}.yml" + +- name: "Ensure fontconfig is installed" + become: true + ansible.builtin.package: + name: "fontconfig" + state: "present" + +- name: "Ensure fonts are installed" + become: true + ansible.builtin.package: + name: "{{ item }}" + state: "present" + loop: "{{ font_packages }}" + +- name: "Ensure fontconfig global directory exists" + become: true + ansible.builtin.file: + path: "{{ item }}" + state: "directory" + mode: "0755" + loop: + - "/etc/fonts" + - "/etc/fonts/conf.d" + +- name: "Add global font configurations" + become: true + ansible.builtin.template: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + mode: "0644" + loop: + - src: "local.conf.j2" + dest: "/etc/fonts/local.conf" + +- name: "Configure fonts presets" + become: true + ansible.builtin.file: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + state: "link" + loop: + - src: "/usr/share/fontconfig/conf.avail/10-sub-pixel-rgb.conf" + dest: "/etc/fonts/conf.d/10-sub-pixel-rgb.conf" + - src: "/usr/share/fontconfig/conf.avail/10-hinting-slight.conf" + dest: "/etc/fonts/conf.d/10-hinting-slight.conf" + - src: "/usr/share/fontconfig/conf.avail/11-lcdfilter-default.conf" + dest: "/etc/fonts/conf.d/11-lcdfilter-default.conf" + - src: "/usr/share/fontconfig/conf.avail/70-no-bitmaps-except-emoji.conf" + dest: "/etc/fonts/conf.d/70-no-bitmaps-except-emoji.conf" diff --git a/roles/font/templates/local.conf.j2 b/roles/font/templates/local.conf.j2 new file mode 100644 index 00000000..33574afe --- /dev/null +++ b/roles/font/templates/local.conf.j2 @@ -0,0 +1,68 @@ +<?xml version="1.0"?> +<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd"> +<fontconfig> + <!-- Apply text rasterization, hinting, and anti-aliasing --> + <match target="font"> + <edit name="antialias" mode="assign"> + <bool>true</bool> + </edit> + <edit name="hinting" mode="assign"> + <bool>true</bool> + </edit> + <edit name="rgba" mode="assign"> + <const>rgb</const> + </edit> + <edit name="hintstyle" mode="assign"> + <const>hintslight</const> + </edit> + <edit name="lcdfilter" mode="assign"> + <const>lcddefault</const> + </edit> + </match> + <!-- Configure default fonts & fallback fonts --> + <!-- Replace fonts with preferred fonts --> + <!-- Noto Emoji allows for emojis to render in all apps including the terminal, remove if not needed --> + <alias> + <family>serif</family> + <prefer> + <family>Noto Serif</family> + <family>FreeSerif</family> + <family>Noto Emoji</family> + </prefer> + </alias> + <alias> + <family>sans-serif</family> + <prefer> + <family>Noto Sans</family> + <family>FreeSans</family> + <family>Noto Emoji</family> + </prefer> + </alias> + <alias> + <family>sans</family> + <prefer> + <family>Noto Sans</family> + <family>FreeSans</family> + <family>Noto Color Emoji</family> + <family>Noto Emoji</family> + </prefer> + </alias> + <alias> + <family>monospace</family> + <prefer> + <family>JetBrainsMono</family> + <family>Noto Mono</family> + <family>Noto Color Emoji</family> + <family>Noto Emoji</family> + </prefer> + </alias> + <alias> + <family>mono</family> + <prefer> + <family>JetBrainsMono</family> + <family>Noto Mono</family> + <family>Noto Color Emoji</family> + <family>Noto Emoji</family> + </prefer> + </alias> +</fontconfig> diff --git a/roles/font/vars/archlinux.yml b/roles/font/vars/archlinux.yml new file mode 100644 index 00000000..08ff03f0 --- /dev/null +++ b/roles/font/vars/archlinux.yml @@ -0,0 +1,8 @@ +--- +font_packages: + - "ttf-jetbrains-mono-nerd" + - "gnu-free-fonts" + - "noto-fonts" + - "noto-fonts-cjk" + - "noto-fonts-emoji" + - "noto-fonts-extra" diff --git a/roles/font/vars/debian.yml b/roles/font/vars/debian.yml new file mode 100644 index 00000000..fad50d6a --- /dev/null +++ b/roles/font/vars/debian.yml @@ -0,0 +1,8 @@ +--- +font_packages: + - "fonts-jetbrains-mono" + - "fonts-recommended" + - "fonts-noto" + - "fonts-noto-cjk" + - "fonts-noto-emoji" + - "fonts-noto-extra" |
