#9 Rawhide: Add fontconfig entries to ensure color emoji gets used by Qt applications
Opened a year ago by ngompa. Modified a year ago
rpms/ ngompa/google-noto-emoji-fonts add-fontconfig  into  rawhide

@@ -0,0 +1,22 @@ 

+ <?xml version="1.0" encoding="UTF-8"?>

+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">

+ <fontconfig>

+   <alias>

+     <family>serif</family>

+     <prefer>

+       <family>Noto Color Emoji</family>

+     </prefer>

+   </alias>

+   <alias>

+     <family>sans-serif</family>

+     <prefer>

+       <family>Noto Color Emoji</family>

+     </prefer>

+   </alias>

+   <alias>

+     <family>monospace</family>

+     <prefer>

+       <family>Noto Color Emoji</family>

+     </prefer>

+   </alias>

+ </fontconfig>

@@ -0,0 +1,22 @@ 

+ <?xml version="1.0" encoding="UTF-8"?>

+ <!DOCTYPE fontconfig SYSTEM "fonts.dtd">

+ <fontconfig>

+   <alias>

+     <family>serif</family>

+     <prefer>

+       <family>Noto Emoji</family>

+     </prefer>

+   </alias>

+   <alias>

+     <family>sans-serif</family>

+     <prefer>

+       <family>Noto Emoji</family>

+     </prefer>

+   </alias>

+   <alias>

+     <family>monospace</family>

+     <prefer>

+       <family>Noto Emoji</family>

+     </prefer>

+   </alias>

+ </fontconfig>

file modified
+34 -17
@@ -3,16 +3,16 @@ 

  

  %global fontname google-noto-emoji

  

- %if (0%{?fedora} > 25)

- %global buildfont 1

- %else

+ %if 0%{?rhel}

  %global buildfont 0

+ %else

+ %global buildfont 1

  %endif

  

  

  Name:           %{fontname}-fonts

  Version:        20220916

- Release:        3%{?dist}

+ Release:        3%{?dist}.1

  Summary:        Google “Noto Emoji” Black-and-White emoji font

  

  # In noto-emoji-fonts source
@@ -25,10 +25,12 @@ 

  ### third_party ucd code is in Unicode license

  License:        OFL and ASL 2.0

  URL:            https://github.com/googlefonts/noto-emoji

- Source0:        https://github.com/googlefonts/noto-emoji/archive/%{commit0}.tar.gz#/noto-emoji-%{shortcommit0}.tar.gz

+ Source0:        https://github.com/googlefonts/noto-emoji/archive/%{commit0}/noto-emoji-%{shortcommit0}.tar.gz

  Source2:        %{fontname}.metainfo.xml

  Source3:        %{fontname}-color.metainfo.xml

- Source4:        Noto_Emoji.zip

+ Source4:        60-%{fontname}.conf

+ Source5:        60-%{fontname}-color.conf

+ Source6:        Noto_Emoji.zip

  

  Patch0:         noto-emoji-build-all-flags.patch

  Patch1:         noto-emoji-use-gm.patch
@@ -37,7 +39,7 @@ 

  BuildArch:      noarch

  BuildRequires:  gcc

  BuildRequires:  fontpackages-devel

- %if %buildfont

+ %if 0%{?buildfont}

  BuildRequires:  fonttools

  BuildRequires:  python3-fonttools

  BuildRequires:  nototools
@@ -68,7 +70,7 @@ 

  This package provides the Google “Noto Color Emoji” colored emoji font.

  

  %prep

- %setup -a 4 -n noto-emoji-%{commit0}

+ %setup -q -a 6 -n noto-emoji-%{commit0}

  %patch0 -p1 -b .noto-emoji-build-all-flags

  %patch1 -p1 -b .noto-emoji-use-gm.patch

  %patch2 -p1 -b .noto-emoji-use-system-pngquant
@@ -76,7 +78,7 @@ 

  rm -rf third_party/pngquant

  

  %build

- %if %buildfont

+ %if 0%{?buildfont}

  # Work around UTF-8

  export LANG=C.UTF-8

  
@@ -86,7 +88,7 @@ 

  %install

  install -m 0755 -d %{buildroot}%{_fontdir}

  

- %if %buildfont

+ %if 0%{?buildfont}

  # Built by us from the supplied pngs:

  install -m 0644 -p NotoColorEmoji.ttf %{buildroot}%{_fontdir}

  %else
@@ -97,22 +99,37 @@ 

  # Pre-built, and included with the source:

  install -m 0644 -p static/NotoEmoji-Regular.ttf %{buildroot}%{_fontdir}

  

- mkdir -p %{buildroot}%{_datadir}/appdata

- install -m 0644 -p %{SOURCE2} %{buildroot}%{_datadir}/appdata

- install -m 0644 -p %{SOURCE3} %{buildroot}%{_datadir}/appdata

+ mkdir -p %{buildroot}%{_metainfodir}

+ install -m 0644 -p %{SOURCE2} %{buildroot}%{_metainfodir}

+ install -m 0644 -p %{SOURCE3} %{buildroot}%{_metainfodir}

+ mkdir -p %{buildroot}%{_fontconfig_templatedir}

+ mkdir -p %{buildroot}%{_fontconfig_confdir}

+ install -m 0644 -p %{SOURCE4} %{buildroot}%{_fontconfig_templatedir}

+ install -m 0644 -p %{SOURCE5} %{buildroot}%{_fontconfig_templatedir}

  

- %_font_pkg NotoEmoji-Regular.ttf

+ for fconf in 60-%{fontname}.conf 60-%{fontname}-color.conf; do

+   ln -sr %{buildroot}%{_fontconfig_templatedir}/$fconf %{buildroot}%{_fontconfig_confdir}/$fconf

+ done

+ 

+ 

+ %_font_pkg -f 60-%{fontname}.conf NotoEmoji-Regular.ttf

  %license LICENSE OFL.txt

  %doc AUTHORS CONTRIBUTING.md CONTRIBUTORS README.md README.txt

- %{_datadir}/appdata/google-noto-emoji.metainfo.xml

+ %{_metainfodir}/google-noto-emoji.metainfo.xml

  

- %_font_pkg -n color NotoColorEmoji.ttf

+ %_font_pkg -n color -f 60-%{fontname}-color.conf NotoColorEmoji.ttf

  %license LICENSE OFL.txt

  %doc AUTHORS CONTRIBUTING.md CONTRIBUTORS README.md README.txt

- %{_datadir}/appdata/google-noto-emoji-color.metainfo.xml

+ %{_metainfodir}/google-noto-emoji-color.metainfo.xml

  

  

  %changelog

+ * Tue Feb 28 2023 Neal Gompa <ngompa@fedoraproject.org> - 20220916-4

+ - Add fontconfig entries to ensure color emoji gets used by Qt applications

+   Resolves: rhbz#2173935

+ - Use metainfodir macro for metainfo files

+ - Fix buildfont conditional

+ 

  * Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org> - 20220916-3

  - Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild

  

Also, misc packaging fixes:

  • Use metainfodir macro for metainfo files
  • Fix buildfont conditional

rebased onto 69c5aad

a year ago

rebased onto 3fa6f92

a year ago

rebased onto df2d06e

a year ago

rebased onto 9a325c2

a year ago

rebased onto 3329193

a year ago

This config files is totally wrong. this obviously breaks the legacy software which doesn't have any fallback on font selections. and also, more or less affects other software which can deal with emoji properly at this moment.
And, they aren't sans-serif nor serif nor monospace at all.

It may looks easier to do. but this is a bad idea as a workaround.

Why don't you propose a feature to Qt, to deal with emoji generic font family name instead, which is also defined in W3C's CSS Font Module https://www.w3.org/TR/css-fonts-4/ and take care of emoji separately in context like other families?

@ngompa I think it is good to use metainfodir macro. Thanks for pointing it out!

I will fix the metainfodir macro usage in Fedora rawhide now.