diff --git a/.github/workflows/appimage-build.yml b/.github/workflows/appimage-build.yml index a4d9b19a..86bfff30 100644 --- a/.github/workflows/appimage-build.yml +++ b/.github/workflows/appimage-build.yml @@ -45,6 +45,7 @@ jobs: rm -rf build meson setup build \ --prefix=/usr \ + -Dinstall-docs=true \ -Dtext-frontend=true \ -Dwith-perl=perl \ -Dwith-python=python3 \ diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index e1ad5afc..f72bd69b 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -40,7 +40,6 @@ jobs: python -m pip install --upgrade pip python -m pip install cffi python -m pip install zstandard - python -m pip install sphinx $ProgressPreference = 'SilentlyContinue' function Download-WithRetry { diff --git a/data/fonts/README.md b/data/fonts/README.md index 8cfed8ac..fb9acc8c 100644 --- a/data/fonts/README.md +++ b/data/fonts/README.md @@ -5,10 +5,14 @@ Unicode Emoji 17.0. It is vendored from Debian's `fonts-noto-color-emoji` 2.051 package, built from the corresponding Google Noto Emoji release. -Every GTK build installs this exact file: Windows (installer and portable -build files), AppImage, Flatpak and native Meson/RPM builds. It is loaded -into a private Pango/FreeType font map as `ZoiteChat Emoji`; an older system -Noto font cannot replace it. No font is installed globally on Windows. +By default, GTK builds install this exact file, including Windows +(installer and portable builds), AppImage, Flatpak, and native Meson/RPM. +Meson packagers can set `-Dinstall-emoji-font=false` to omit the bundled +font and its installed notices and use system emoji fonts instead. An +explicit `ZOITECHAT_EMOJI_FONT` path still enables the private font map +in such builds. With the bundled font, it is registered privately as +`ZoiteChat Emoji`; an older system Noto font cannot replace it. No font +is installed globally on Windows. Chat windows and the emoji picker share this map. Fontconfig still loads system fonts and configuration for ordinary text, and the configured text @@ -29,7 +33,9 @@ directory; Windows resolves it relative to the executable. AppImage sets ZOITECHAT_EMOJI_FONT="$PWD/data/fonts/NotoColorEmoji.ttf" build/src/fe-gtk/zoitechat ``` -A missing/unloadable file logs a warning and retains system-font fallback. +An unexpectedly missing or unloadable bundled font logs a warning and retains +system-font fallback. When installation is disabled deliberately, fallback is +quiet unless an explicit `ZOITECHAT_EMOJI_FONT` override is invalid. CI verifies the installed copy and tests catalog/font coverage; AppImage and Windows also run the interactive picker regression tests. Native themes, DPI and different Pango/Cairo versions can still affect pixel-level output. diff --git a/data/fonts/meson.build b/data/fonts/meson.build index eb3f545a..1d0e4f8d 100644 --- a/data/fonts/meson.build +++ b/data/fonts/meson.build @@ -1,13 +1,15 @@ emoji_font_dir = join_paths(get_option('datadir'), 'fonts', 'zoitechat') emoji_font_doc_dir = join_paths(get_option('datadir'), 'doc', 'zoitechat', 'fonts') -install_data( - 'NotoColorEmoji.ttf', - install_dir: emoji_font_dir, -) +if get_option('install-emoji-font') + install_data( + 'NotoColorEmoji.ttf', + install_dir: emoji_font_dir, + ) -install_data( - 'OFL.txt', - 'README.md', - install_dir: emoji_font_doc_dir, -) + install_data( + 'OFL.txt', + 'README.md', + install_dir: emoji_font_doc_dir, + ) +endif diff --git a/docs/README.md b/docs/README.md index dba73d56..d9eb543a 100644 --- a/docs/README.md +++ b/docs/README.md @@ -71,6 +71,12 @@ Packagers may exclude `docs/_theme/basicstrap/` from the source package. The default theme continues to build without that directory. No pre-minified third-party assets need to be added or rebuilt for this theme. +The Meson option `-Dinstall-docs` defaults to `false`, so platforms that +do not ship offline documentation do not need Sphinx just to build ZoiteChat. +Pass `-Dinstall-docs=true` when packaging local HTML documentation. Fedora +and AppImage enable it explicitly; the Debian documentation package can do +the same. + Build with the distribution's `python3-sphinx`. After installing the HTML into the package staging directory, use `dh_sphinxdoc` (or `dh --with sphinxdoc`) to replace Sphinx's standard JavaScript files with system diff --git a/docs/_static/css/zoitechat-docs.css b/docs/_static/css/zoitechat-docs.css index a2ceb51c..2e665347 100644 --- a/docs/_static/css/zoitechat-docs.css +++ b/docs/_static/css/zoitechat-docs.css @@ -807,7 +807,7 @@ a.headerlink:focus-visible { :root { --page: var(--bg); --panel: var(--chrome); - --font: system-ui, -apple-system, "Segoe UI", sans-serif; + --font: system-ui, -apple-system, "Segoe UI", "DejaVu Sans", sans-serif; } .site-header { padding: 0; } .appearance select { min-height: 0; border-radius: 3px; } diff --git a/docs/_static/css/zoitechat-site.css b/docs/_static/css/zoitechat-site.css index 1b0951ca..ca3c3648 100644 --- a/docs/_static/css/zoitechat-site.css +++ b/docs/_static/css/zoitechat-site.css @@ -16,7 +16,7 @@ --success: #236741; --code: #f2f4f6; --shadow: none; - --mono: Consolas,"Liberation Mono",monospace; + --mono: Consolas,"DejaVu Sans Mono","Liberation Mono",monospace; } html[data-theme=dark] { @@ -45,7 +45,7 @@ body { margin: 0; background: var(--bg); color: var(--text); - font: 15px/1.6 system-ui,-apple-system,"Segoe UI",sans-serif; + font: 15px/1.6 system-ui,-apple-system,"Segoe UI","DejaVu Sans",sans-serif; } a { diff --git a/meson.build b/meson.build index 71a7392d..dc314f73 100644 --- a/meson.build +++ b/meson.build @@ -38,6 +38,7 @@ endif config_h = configuration_data() config_h.set('HAVE_GTK_MAC', host_machine.system() == 'darwin' and gtk_mac_dep.found()) +config_h.set10('ZOITECHAT_INSTALL_EMOJI_FONT', get_option('install-emoji-font')) config_h.set_quoted('PACKAGE_VERSION', meson.project_version()) config_h.set_quoted('PACKAGE_NAME', meson.project_name()) config_h.set_quoted('GETTEXT_PACKAGE', 'zoitechat') diff --git a/meson_options.txt b/meson_options.txt index 22affa28..03d525ea 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -37,7 +37,10 @@ option('install-appdata', type: 'boolean', option('install-plugin-metainfo', type: 'boolean', value: false, description: 'Installs metainfo files for enabled plugins, useful when distros create split packages' ) -option('install-docs', type: 'boolean', value: true, +option('install-emoji-font', type: 'boolean', value: true, + description: 'Install the bundled Noto Color Emoji font instead of using system emoji fonts' +) +option('install-docs', type: 'boolean', value: false, description: 'Build and install the local HTML documentation' ) diff --git a/packaging/fedora/zoitechat.spec b/packaging/fedora/zoitechat.spec index da3b1936..bc316389 100644 --- a/packaging/fedora/zoitechat.spec +++ b/packaging/fedora/zoitechat.spec @@ -53,6 +53,7 @@ systems. %build %meson \ + -Dinstall-docs=true \ -Dtext-frontend=false \ -Dwith-checksum=true \ -Dwith-fishlim=true \ diff --git a/packaging/macos/build.py b/packaging/macos/build.py index 50343a78..b4989cc6 100644 --- a/packaging/macos/build.py +++ b/packaging/macos/build.py @@ -48,6 +48,7 @@ def main() -> None: "--prefix=/", "--libdir=lib", "--buildtype=release", "-Dgtk-frontend=true", "-Dtext-frontend=false", "-Dmac-integration=enabled", "-Ddbus=disabled", "-Dlibcanberra=disabled", "-Dappindicator=disabled", "-Dinstall-appdata=false", + "-Dinstall-docs=false", "-Dwith-sysinfo=false", "-Dwith-python=false", "-Dwith-perl=false", "-Dwith-lua=lua", "-Dwith-fishlim=true", "-Dwith-checksum=true", "-Dplugin=" + ("false" if args.store_experimental else "true"), diff --git a/src/fe-gtk/emoji-font.c b/src/fe-gtk/emoji-font.c index cad54193..1d8842df 100644 --- a/src/fe-gtk/emoji-font.c +++ b/src/fe-gtk/emoji-font.c @@ -52,6 +52,16 @@ emoji_font_get_map (void) return map; attempted = TRUE; +#if defined(ZOITECHAT_INSTALL_EMOJI_FONT) && !ZOITECHAT_INSTALL_EMOJI_FONT + /* A distribution package can deliberately omit our private font. Keep + * its native/system emoji rendering unless an explicit font is given. */ + { + const char *override = g_getenv ("ZOITECHAT_EMOJI_FONT"); + if (!override || !*override) + return NULL; + } +#endif + path = emoji_font_path (); if (!path || !g_file_test (path, G_FILE_TEST_IS_REGULAR)) {