changeset 167:3653bffd7496

Update Fonts Config to fix issues in 20231210 * Remove "Emoji first" approach * Better way of emoji-fying frowning face * Override hinting instructions to fix GTK3 rendering * Replace Calibri and Roboto fonts
author IBBoard <dev@ibboard.co.uk>
date Sat, 09 Nov 2024 16:55:21 +0000
parents 0d534e797a43
children 381896bd9e0d
files 10-noto-emoji.conf fonts.conf setup.sh
diffstat 3 files changed, 86 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/10-noto-emoji.conf	Fri Aug 30 16:16:38 2024 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-<?xml version="1.0"?>
-<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
-<fontconfig>
-  <alias>
-    <family>sans-serif</family>
-    <prefer>
-      <family>Noto Color Emoji</family>
-      <family>Noto Sans</family>
-    </prefer>
-  </alias>
-  <alias>
-    <family>serif</family>
-    <prefer>
-      <family>Noto Color Emoji</family>
-      <family>Noto Serif</family>
-    </prefer>
-  </alias>
-  <alias>
-    <family>monospace</family>
-    <prefer>
-      <family>Noto Color Emoji</family>
-      <family>Noto Mono</family>
-    </prefer>
-  </alias>
-  <match>
-    <test name="family" compare="contains">
-      <string>emoji</string>
-    </test>
-    <edit name="family" mode="prepend" binding="same">
-      <string>Noto Color Emoji</string>
-    </edit>
-  </match>
-  <match target="font">
-    <test name="family" compare="eq">
-      <string>Noto Color Emoji</string>
-    </test>
-    <edit name="charset" mode="assign" binding="strong">
-      <minus>
-        <name>charset</name>
-        <charset>
-          <range>
-            <int>0x0000</int>
-            <int>0x00FF</int>
-          </range>
-        </charset>
-      </minus>
-    </edit>
-  </match>
-  <!-- Fix the times when people put "Segoe UI; Segoe UI Emoji" and so we get emoji numbers -->
-  <alias binding="strong">
-    <family>Segoe UI</family>
-    <prefer><family>Noto Sans</family></prefer>
-    <default><family>sans-serif</family></default>
-  </alias>
-</fontconfig>
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/fonts.conf	Sat Nov 09 16:55:21 2024 +0000
@@ -0,0 +1,85 @@
+<?xml version="1.0"?>
+<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
+<fontconfig>
+  <!-- Prefer Noto over Cantarell -->
+  <alias>
+    <family>system-ui</family>
+    <prefer>
+      <family>Noto Sans</family>
+      <family>Cantarell</family>
+    </prefer>
+  </alias>
+  <!-- Don't emoji-fi ASCII -->
+  <!-- May not be necessary now that we're not pushing Noto Color Emoji first
+  <match target="font">
+    <test name="family" compare="eq">
+      <string>Noto Color Emoji</string>
+    </test>
+    <edit name="charset" mode="assign" binding="strong">
+      <minus>
+        <name>charset</name>
+        <charset>
+          <range>
+            <int>0x0000</int>
+            <int>0x00FF</int>
+          </range>
+        </charset>
+      </minus>
+    </edit>
+  </match>-->
+  <!-- But do emoji-fi the :( emoji -->
+  <!-- If font is not Noto Color Emoji, tell Font Config to ignore 0x2639 (if it exists) so that it _has_ to use the emoji-->
+  <match target="font">
+    <test name="family" compare="not_eq">
+      <string>Noto Color Emoji</string>
+    </test>
+    <edit name="charset" mode="assign" binding="strong">
+      <minus>
+        <name>charset</name>
+        <charset>
+          <range>
+            <int>0x2639</int>
+            <int>0x2639</int>
+          </range>
+        </charset>
+      </minus>
+    </edit>
+  </match>
+  <!-- Avoid Roboto, because it's horrible and vertically stretched (e.g. NextCloud) -->
+  <match>
+    <test name="family" compare="eq">
+      <string>Roboto</string>
+    </test>
+    <edit name="family" mode="assign" binding="same">
+    	<string>Noto Sans</string>
+    </edit>
+  </match>
+  <match>
+    <test name="family" compare="eq">
+      <string>Roboto Slab</string>
+    </test>
+    <edit name="family" mode="assign" binding="same">
+    	<string>Noto Serif</string>
+    </edit>
+  </match>
+  <!-- Fix the "aliased web fonts" problem in Firefox -->
+  <!-- And the "GTK3 fonts are vertically stretched/too thin" problem -->
+  <!-- This overrides settings from 21-emoji-rendering.conf -->
+  <match target="font">
+      <test qual="any" name="family" compare="not_eq">
+	<string>Noto Color Emoji</string>
+      </test>
+      <edit name="hinting" mode="assign">
+        <bool>true</bool>
+      </edit>
+      <edit name="autohint" mode="assign">
+        <bool>true</bool>
+      </edit>
+      <edit name="hintstyle" mode="assign">
+        <const>hintfull</const>
+      </edit>
+      <edit name="antialias" mode="assign">
+        <bool>true</bool>
+      </edit>
+  </match>
+</fontconfig>
\ No newline at end of file
--- a/setup.sh	Fri Aug 30 16:16:38 2024 +0100
+++ b/setup.sh	Sat Nov 09 16:55:21 2024 +0000
@@ -45,7 +45,7 @@
 create_symlink nanorc ~/.nanorc
 create_symlink nanorc.d ~/.nanorc.d
 create_symlink XCompose ~/.XCompose
-create_symlink 10-noto-emoji.conf ~/.config/fontconfig/conf.d/10-noto-emoji.conf
+create_symlink fonts.conf ~/.config/fontconfig/fonts.conf
 create_symlink mime-extra.xml ~/.local/share/mime/packages/IBBoard-extra.xml
 update-mime-database ~/.local/share/mime/
 mkdir -p ~/.ssh