lmiphay / gentoo.overlay

lmiphay gentoo overlay
4 stars 3 forks source link

Font substitutions in Firestorm #16

Closed ntheo1979 closed 2 years ago

ntheo1979 commented 2 years ago

Greetings.

I've had some progress making the unifont substitution work. I copied unifont.ttf and _unifontupper.ttf from /usr/share/fonts/unifont/ to /opt/firestorm-bin/fonts/ and amended /opt/firestorm-bin/fonts/fonts.xml to

    <file>DejaVuSans.ttf</file>
+   <file>unifont_upper.ttf</file>
+   <file>unifont.ttf</file>
    <os name="Windows">
      <file>meiryo.TTC</file>
⋮

By doing that, the viewer manages to render Ⲙⲁⲥⳙ and 🌴🌞, BUT

For the second, I wonder if the viewer gets confused because it ships its own version of NotoSans-Regular.ttf (combined with NotoSansSymbols-Regular.ttf into NotoSans.ttf, it says). My intuition is to nuke them both, replace them with the proper NotoSans-Regular and NotoColorEmoji and perhaps more, and amend fonts_noto.xml thusly:

-    <file>NotoSans.ttf</file>
+   <file>NotoSans-Regular.ttf</file>
+   <file>NotoColorEmoji.ttf</file>
⋮

But I haven't tried that yet.

For the first, what gives? Should my user be in any groups that he isn't? Is there even a group regarding fonts? I've never seen this before.

lmiphay commented 2 years ago

At a guess copying the fonts in as root lost the "other" read permission?

This works for Ⲙⲁⲥⳙ (not as nicely rendered as in chromium:

--- /opt/firestorm-bin/fonts/fonts.xml  2021-10-12 19:30:38.980561275 +0100
+++ /opt/firestorm-bin/fonts/fonts.xml.updated  2021-10-12 19:30:28.000558707 +0100
@@ -4,6 +4,7 @@
   <font name="default" comment="default font files (global fallbacks)">
     <file>DejaVuSans.ttf</file>
     <file>/usr/share/fonts/unifont/unifont_upper.ttf</file>
+    <file>/usr/share/fonts/unifont/unifont.ttf</file>
     <os name="Windows">
       <file>meiryo.TTC</file>
       <file>YuGothR.ttc</file>

So Noto fonts should work the same way? Loading all Noto fonts in, might use a lot of memory? I haven't tried that (yet).

lmiphay commented 2 years ago

When I try to load the color emoji font, firestorm logs this:

2021-10-12T19:48:03Z INFO #LLFontRegistry# llrender/llfontregistry.cpp(567) createFont : ONCE: Couldn't load font /usr/share/fonts/noto-emoji/NotoColorEmoji.ttf

Needs further investigation...

ntheo1979 commented 2 years ago

Hmm. To me it gives

2021-10-12T17:35:53Z INFO #AppInit# llwindow/llwindowsdl.cpp(2701) getDynamicFallbackFontList : Language c
2021-10-12T17:35:53Z INFO #AppInit# llwindow/llwindowsdl.cpp(2702) getDynamicFallbackFontList : Location UTF8
2021-10-12T17:35:53Z INFO #AppInit# llwindow/llwindowsdl.cpp(2703) getDynamicFallbackFontList : Variant 
2021-10-12T17:35:53Z INFO # llwindow/llwindowsdl.cpp(2705) getDynamicFallbackFontList : Preferring fonts of language: c
2021-10-12T17:35:53Z INFO # llwindow/llwindowsdl.cpp(2760) getDynamicFallbackFontList : Using 40/177 system fonts.
2021-10-12T17:35:53Z INFO #AppInit# newview/llappviewer.cpp(3586) initWindow : gViewerwindow created.
2021-10-12T17:35:53Z INFO #AppInit# newview/llappviewer.cpp(3608) initWindow : watchdog setting is done.
2021-10-12T17:35:53Z INFO # llrender/llfontregistry.cpp(427) createFont : createFont SansSerif size Medium style 0
2021-10-12T17:35:53Z WARNING # llrender/llfontgl.cpp(1208) getFontPathSystem : Could not determine system fonts path
2021-10-12T17:35:54Z INFO #LLFontRegistry# llrender/llfontregistry.cpp(567) createFont : ONCE: Couldn't load font NotoSans.ttf
2021-10-12T17:35:54Z INFO #LLFontRegistry# llrender/llfontregistry.cpp(567) createFont : ONCE: Couldn't load font /usr/share/fonts/75dpi/helvR08-ISO8859-1.pcf.gz
2021-10-12T17:35:54Z INFO #LLFontRegistry# llrender/llfontregistry.cpp(567) createFont : ONCE: Couldn't load font /usr/share/fonts/75dpi/helvR08.pcf.gz
2021-10-12T17:35:54Z INFO #LLFontRegistry# llrender/llfontregistry.cpp(567) createFont : ONCE: Couldn't load font /usr/share/fonts/75dpi/timR08.pcf.gz
2021-10-12T17:35:54Z INFO #LLFontRegistry# llrender/llfontregistry.cpp(567) createFont : ONCE: Couldn't load font /usr/share/fonts/truetype/kochi/kochi-gothic.ttf

Then many

2021-10-12T17:35:55Z WARNING # llrender/llfontgl.cpp(1208) getFontPathSystem : Could not determine system fonts path

but it does manage to

2021-10-12T17:35:55Z INFO # llrender/llfontregistry.cpp(427) createFont : createFont SansSerif size Small style 0

and also in sizes Large and Huge and styles 0 and 1.

I can't say I understand much.

No, all fonts retain their permissions, for example

nikos@Archytas /opt/firestorm-bin/fonts $ ls unifont.ttf -l
-rw-r--r-- 1 root root 12278708 Oct 11 20:18 unifont.ttf
lmiphay commented 2 years ago

tl;dr - Needs a viewer update to support color emjois. If Linden Lab uses the Catznip contribution, Firestorm will get it.

Its look the history of color emojis is something like this:

In 2016, "Colour emojis use a new font format which would require a upgrade to the font renderer." [1] In 2019, "Emojis are coming to the viewer, courtesy of a code contribution that’s heading to Linden Lab." "The emoji capability is being contributed by the Catznip viewer team" [2]

Firestorm, Linden bugs in 2019 [3,4] - the Linden bug is accepted.

Links:

  1. https://jira.secondlife.com/browse/BUG-40475?focusedCommentId=510128&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-510128
  2. https://modemworld.me/2019/11/16/2019-tpvd-meeting-week-46-summary/
  3. https://jira.firestormviewer.org/browse/FIRE-23880
  4. https://jira.secondlife.com/browse/BUG-226971
lmiphay commented 2 years ago

I just added a -r3 ebuild - lets see how that works for now. It just adds unifont to the default fonts list.

I will have a look at the NotoSans-Regular situation a bit later.

ntheo1979 commented 2 years ago

Thank you for your research and for your work. I unmerged -r2, deleted the fonts I had copied and merged the -r3. Again, as root I could see the substitution but not as user. Then I thought root had the default settings (therefore Dejavu as a default UI font), so I switched on my user's preferences from Noto to Dejavu and… now I can see the substitution. That means all characters and black-and-white emoji in unifont, but that's perfectly good enough for now.

Now, I only have one problem left, but that's for another day.

Again, thank you Paul.