Cool VL Viewer forum

View unanswered posts | View active topics It is currently 2025-08-07 06:48:30



Reply to topic  [ 11 posts ]  Go to page 1, 2  Next
Font substitution 
Author Message

Joined: 2011-09-27 11:18:31
Posts: 244
Reply with quote
Greetings, Henri.

I am trying to substitute the viewer's default fonts with my system-wide Noto and/or DejaVu fonts, complemented with the ugly but very containing Unifont, in order to (a) make the fonts render more nicely (especially the italic font renders quite badly in my system) and (b) let Unifont substitute the various UTF8 characters that won't render for me otherwise, but I seem to be doing something wrong.

Firstly, I completely replaced your default skins/default/xui/fonts.xml with this file
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<fonts>

<font name="default" comment="default font files (global fallbacks)">
    <file>/usr/share/fonts/noto/NotoSans-Regular.ttf</file>
    <file>/usr/share/fonts/dejavu/DejaVuSans.ttf</file>
    <file>/usr/share/fonts/unifont/unifont_upper.ttf</file>
    <file>/usr/share/fonts/unifont/unifont.ttf</file>
</font>

<font name="SansSerifBold"
    comment="Name of bold sans-serif font">
    <file>/usr/share/fonts/noto/NotoSans-Bold.ttf</file>
    <file>/usr/share/fonts/dejavu/DejaVuSans-Bold.ttf</file>
</font>

<font name="SansSerif"
    comment="Name of bold sans-serif font"
    font_style="BOLD">
    <file>/usr/share/fonts/noto/NotoSans-Bold.ttf</file>
    <file>/usr/share/fonts/dejavu/DejaVuSans-Bold.ttf</file>
</font>

<font name="SansSerif"
    comment="Name of italic sans-serif font"
    font_style="ITALIC">
    <file>/usr/share/fonts/noto/NotoSans-Oblique.ttf</file>
    <file>/usr/share/fonts/dejavu/DejaVuSans-Bold.ttf</file>
</font>

<font name="SansSerif"
    comment="Name of bold italic sans-serif font"
    font_style="BOLD|ITALIC">
    <file>/usr/share/fonts/noto/NotoSans-BoldItalic.ttf</file>
    <file>/usr/share/fonts/dejavu/DejaVuSans-BoldItalic.ttf</file>
</font>

<font name="Monospace"
    comment="Name of monospace font">
    <file>/usr/share/fonts/noto/NotoSansMono-Regular.ttf</file>
    <file>/usr/share/fonts/dejavu/DejaVuSansMono.ttf</file>
</font>

but the viewer didn't even start. So I changed tactics, replaced your original file and simply edited it to this at the beginning
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<fonts>
   <font name="default"
    comment="default font files (global fallbacks)">
      <file>/usr/share/fonts/noto/NotoSans-Regular.ttf</file>
      <file>/usr/share/fonts/dejavu/DejaVuSans.ttf</file>
      <file>/usr/share/fonts/unifont/unifont_upper.ttf</file>
      <file>/usr/share/fonts/unifont/unifont.ttf</file>
      <file>Roboto-Condensed.ttf</file>

but this has no effect at all.

Could you perhaps guide me to the right direction?

Thanks.


2023-08-04 15:50:04
Profile

Joined: 2009-03-17 18:42:51
Posts: 6028
Reply with quote
The skins/default/xui/en-us/fonts.xml file format is specific to the viewer (it is not a fontconfig file). You can see the code interpreting it in linden/indra/llrender/llfontregistry.cpp.
It does not accept full paths for font file names, and the names of the font files listed in it must correspond to files present in the fonts/ sub-directory of the viewer installation directory, or in your system default font directories.

Normally (i.e. with default settings), the viewer will use the fonts configured for "SansSerif", "SansSerifBold" and "Monospace" (the latter is only used by the script editor).
If it cannot find a font file for a given name/type combination, it falls back to the "default" fonts list and tries every font name in it in the listed order until it can find a font with the matching type (Italic, Bold, etc); if it still cannot find a matching font there, it uses the fallback fonts it found on your system on startup.

While rendering a character, if it cannot find that character in a loaded font, it will fall back to your system fonts (as configured via fontconfig, for Linux) and pick up one supporting that character, if any.

In fonts.xml, the "Helvetica" and "Courrier" fonts have been added as overrides for optional use in the note card and script editors (by giving their name in the corresponding debug settings: "NotecardEditorFont" and "ScriptEditorFont", with "Tiny", "Small", "Medium", "Large" or "Huge" optionally appended to their name: e.g. "CourrierTiny" for ScriptEditorFont").

This said, you raised a valid concern about Italic fonts (which are very rarely used in the UI). There is no configured SansSerif(Bold) font for the Italic type in fonts.xml, meaning the viewer uses a fallback font (which may display more or less well, depending on your system fonts).
I fixed this for next releases, by using the bundled Roboto-CondensedItalic.ttf and Roboto-BoldCondensedItalic.ttf for them. Here is the modified file you can already use with current viewer releases:
Attachment:
fonts.xml [3.42 KiB]
Downloaded 161 times

Here what Italics used to look like on my system before:
Attachment:
Italic.png
Italic.png [ 52.59 KiB | Viewed 6983 times ]

And here is what it looks like after the change:
Attachment:
RobotoItalic.png
RobotoItalic.png [ 51.66 KiB | Viewed 6983 times ]


2023-08-04 17:34:06
Profile WWW

Joined: 2011-09-27 11:18:31
Posts: 244
Reply with quote
Quote:
This said, you raised a valid concern about Italic fonts (which are very rarely used in the UI). There is no configured SansSerif(Bold) font for the Italic type in fonts.xml, meaning the viewer uses a fallback font (which may display more or less well, depending on your system fonts). I fixed this for next releases, by using the bundled Roboto-CondensedItalic.ttf and Roboto-BoldCondensedItalic.ttf for them.

Not at all rarely, I'm afraid. All links appear in italics :-)
Thank you. Italics and bold-italics look much better now, but only in the font test floater, so I'm surely doing something wrong.
Image

Henri Beauchamp wrote:
The skins/default/xui/en-us/fonts.xml file format is specific to the viewer (it is not a fontconfig file). You can see the code interpreting it in linden/indra/llrender/llfontregistry.cpp.
It does not accept full paths for font file names, and the names of the font files listed in it must correspond to files present in the fonts/ sub-directory of the viewer installation directory, or in your system default font directories. […] While rendering a character, if it cannot find that character in a loaded font, it will fall back to your system fonts (as configured via fontconfig, for Linux) and pick up one supporting that character, if any.

But that's the thing: on my system all characters render perfectly, for example the character ㋡, but not in the viewer (*). I shall try again tomorrow by copying i.e. unifont into the viewer's fonts directory and see.

(*) Not in any viewer. This is not a CoolVLViewer issue. The workaround with the Unifont comes from the maintainer of the Firestorm package in Gentoo Linux.


2023-08-04 18:25:43
Profile

Joined: 2009-03-17 18:42:51
Posts: 6028
Reply with quote
g0rd0ngrfr33mailgr wrote:
Not at all rarely, I'm afraid. All links appear in italics :-)
Thank you. Italics and bold-italics look much better now, but only in the font test floater, so I'm surely doing something wrong.
You are right ! And no, you did not do anything wrong. This is just that the "folder view" is slanting the normal font for italics and drawing it twice, slightly shifted, for bold... That's why italics worked without even having an italics font.

I changed the code to (optionally), use a true italics font. Roboto condensed is not very readable once resized to match the non-italics font size in the inventory list, so I will add the regular Roboto italics fonts in next releases. This is what it looks like:
Attachment:
RobotoItalics.png
RobotoItalics.png [ 43 KiB | Viewed 6979 times ]


g0rd0ngrfr33mailgr wrote:
I shall try again tomorrow by copying i.e. unifont into the viewer's fonts directory and see.
Just give the name in the fallback "defaults" font list, but without the path: on startup, the viewer will search for the listed fonts on your system, and add them to the fallback list for unknown characters.


2023-08-04 21:32:00
Profile WWW

Joined: 2011-09-27 11:18:31
Posts: 244
Reply with quote
Today it just worked, with the paths (without the paths the fonts couldn't be found). I must have been tired yesterday and god know what I did wrong. Anyway, I get all characters today and even the "old" (text type) emojis. And omg, the new italics look much better :) Merci, Henri.


2023-08-05 12:57:08
Profile

Joined: 2009-03-17 18:42:51
Posts: 6028
Reply with quote
g0rd0ngrfr33mailgr wrote:
Today it just worked, with the paths (without the paths the fonts couldn't be found).
Strange... It should work, unless your system got dozens of fonts installed, in which case the viewer caps the number of loaded fonts to 40 (to avoid very large startup delays) and will of course retain the ones found in the first folders it scans, while discarding the rest. Under Linux fontconfig is used to find your system fonts.

To see the viewer font registry loader at play, edit app_settings/logcontrol.xml and replace "ExampleOfTag" with "FontRegistry", then start the viewer; it will log all the fonts it found and retained.


2023-08-05 15:44:45
Profile WWW

Joined: 2016-06-19 21:33:37
Posts: 396
Location: Columbus area, OH, USA
Reply with quote
Henri Beauchamp wrote:
Strange... It should work, unless your system got dozens of fonts installed, in which case the viewer caps the number of loaded fonts to 40 (to avoid very large startup delays) and will of course retain the ones found in the first folders it scans, while discarding the rest. Under Linux fontconfig is used to find your system fonts.
This is good info. I wondered why I always had to use a full path. My distro has a 'boatload' of fonts. :-/


2023-08-05 16:23:50
Profile

Joined: 2011-09-27 11:18:31
Posts: 244
Reply with quote
ZaneZimer wrote:
This is good info. I wondered why I always had to use a full path. My distro has a 'boatload' of fonts. :-/

Mine too.
Henri Beauchamp wrote:
To see the viewer font registry loader at play, edit app_settings/logcontrol.xml and replace "ExampleOfTag" with "FontRegistry", then start the viewer; it will log all the fonts it found and retained.

I'll try that, thanks.


2023-08-05 18:28:12
Profile

Joined: 2011-09-27 11:18:31
Posts: 244
Reply with quote
By the way, I noticed yesterday that the slanted/ fake italics appear on the Radar too. Whenever someone leaves the sim, their name appears on the Radad in fake italics for a few seconds. Perhaps you would like to change that too?


2023-08-18 10:01:20
Profile

Joined: 2009-03-17 18:42:51
Posts: 6028
Reply with quote
g0rd0ngrfr33mailgr wrote:
By the way, I noticed yesterday that the slanted/ fake italics appear on the Radar too. Whenever someone leaves the sim, their name appears on the Radad in fake italics for a few seconds. Perhaps you would like to change that too?

Nope, sorry...

The slanted font appears in every list where the ITALICS modifier is used for a list element: I am not going to make an exception for every floater where it is (sometimes) in use.

The Inventory was a special case, because all the inventory links appear in Italics and their number is very high; the change for true Italics involved loading a specific font for the inventory, but it is not something I am going to extend to every floater...

You will have to "get used" to something that has existed for the past 20 years in v1 UI viewers... :P


2023-08-18 13:02:58
Profile WWW
Display posts from previous:  Sort by  
Reply to topic   [ 11 posts ]  Go to page 1, 2  Next

Who is online

Users browsing this forum: No registered users and 57 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Designed by ST Software.