public inbox for gentoo-user@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-user] X11 server not seeing font dirs
@ 2020-11-18 14:03 n952162
  2020-11-21 18:02 ` karl
  0 siblings, 1 reply; 4+ messages in thread
From: n952162 @ 2020-11-18 14:03 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1570 bytes --]

Can anyone say why I have the error messages in my Xorg.0.log file that
I list below?

xlsfonts(1) does not list fonts that are in /usr/share/fonts.

If I add them with "xset +fp /usr/share/fonts/courier-prime" they appear
and then disappear in the "xset -q" display.  They are not available to
xlsfonts, though.

Interestingly enough, adding them with the plus in back: "xset fp+
/user/..." causes them to persist, but still not be available to xlsfonts.

An inspection of /var/log/Xorg.0.log shows this:

    [   663.033] (WW) The directory "/usr/share/fonts/TTF/" does not exist.
    [   663.033]    Entry deleted from font path.
    [   663.033] (WW) The directory "/usr/share/fonts/OTF/" does not exist.
    [   663.033]    Entry deleted from font path.
    [   663.033] (WW) The directory "/usr/share/fonts/Type1/" does not
    exist.
    [   663.033]    Entry deleted from font path.
    [   663.033] (WW) `fonts.dir' not found (or not valid) in
    "/usr/share/fonts/100dpi/".
    [   663.033]    Entry deleted from font path.
    [   663.033]    (Run 'mkfontdir' on "/usr/share/fonts/100dpi/").
    [   663.033] (WW) `fonts.dir' not found (or not valid) in
    "/usr/share/fonts/75dpi/".
    [   663.033]    Entry deleted from font path.
    [   663.033]    (Run 'mkfontdir' on "/usr/share/fonts/75dpi/").
    [   663.033] (==) FontPath set to:
             /usr/share/fonts/misc/

These directories all exist and have populated fonts.dir and fonts.scale
files in them.


[-- Attachment #2: Type: text/html, Size: 2013 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-user] X11 server not seeing font dirs
  2020-11-18 14:03 [gentoo-user] X11 server not seeing font dirs n952162
@ 2020-11-21 18:02 ` karl
  2020-11-21 19:18   ` n952162
  0 siblings, 1 reply; 4+ messages in thread
From: karl @ 2020-11-21 18:02 UTC (permalink / raw
  To: gentoo-user

n952162:
> Can anyone say why I have the error messages in my Xorg.0.log file that
> I list below?
> 
> xlsfonts(1) does not list fonts that are in /usr/share/fonts.
> 
> If I add them with "xset +fp /usr/share/fonts/courier-prime" they appear
> and then disappear in the "xset -q" display.  They are not available to
> xlsfonts, though.
> 
> Interestingly enough, adding them with the plus in back: "xset fp+
> /user/..." causes them to persist, but still not be available to xlsfonts.
...

$ xlsfonts | grep -i mono
$ xset +fp /usr/share/fonts/freefont
$ xlsfonts | grep -i mono | head -1
-misc-freemono-bold-o-normal--0-0-0-0-m-0-adobe-standard
$

I.e. it works as expected.

# emerge -aqv media-fonts/courier-prime
...

$ xset +fp  /usr/share/fonts/courier-prime
$ xset q | grep prime
  /usr/share/fonts/courier-prime,/usr/share/fonts/freefont,/usr/local/share/fonts,/usr/share/fonts/misc/,/usr/share/fonts/OTF/,/usr/share/fonts/Type1/,/usr/share/fonts/100dpi/,/usr/share/fonts/75dpi/,built-ins
$ xlsfonts | grep -i prime
$

So my courier-prime fp doesn't dissapear, but xlsfonts doesn't
report them as a core font.

I run fvwm2 on an older X without udev, can it be a fancy modern destop
that changes this under the hood for you ?

I can see the font with

$ fc-list 'Courier prime'
/usr/share/fonts/courier-prime/Courier Prime Bold.ttf: Courier Prime:style=Bold
/usr/share/fonts/courier-prime/Courier Prime.ttf: Courier Prime:style=Regular
/usr/share/fonts/courier-prime/Courier Prime Bold Italic.ttf: Courier Prime:style=Bold Italic
/usr/share/fonts/courier-prime/Courier Prime Italic.ttf: Courier Prime:style=Italic
$ xfd -fa 'Courier prime'
...

 Can the problem be that there is a space in the x core font name?

$ head -2  /usr/share/fonts/courier-prime/fonts.dir 
16
Courier prime bold italic.ttf -misc-courier prime-bold-i-normal--0-0-0-0-m-0-iso10646-1
$

If I, as root, do:

cd /usr/share/fonts/courier-prime/
perl -wpi.bak -e 'tr/ /_/; s/_-/ -/' fonts.dir
perl -wpi.bak -e 'tr/ /_/; s/_-/ -/' fonts.scale
list=`ls -1  | grep Cour | tr ' ' '_'`
for i in $list; do b=`echo $i  | tr '_' ' '`; mv "$b" $i; done

 Then I can do:
$ xset fp rehash
$ xlsfonts | grep -i prime | head -1
-misc-courier_prime-bold-i-normal--0-0-0-0-m-0-iso10646-1
$ xfd -fn -misc-courier_prime-bold-i-normal--0-0-0-0-m-0-iso10646-1
Warning: Missing charsets in String to FontSet conversion
Warning: Unable to load any usable fontset
Warning: Cannot convert string "-misc-courier_prime-bold-i-normal--0-0-0-0-m-0-iso10646-1" to type FontStruct
xfd:  no font to display
$ xterm -fn -misc-courier_prime-medium-r-normal--17-120-100-100-m-0-iso10646-1
xterm: cannot load font "-misc-courier_prime-medium-r-normal--17-120-100-100-m-0-iso10646-1"

Unfortunately, I cannot use it...

I don't think x likes core fonts with spaces in font- nor 
filenames.

Regards,
/Karl Hammar




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-user] X11 server not seeing font dirs
  2020-11-21 18:02 ` karl
@ 2020-11-21 19:18   ` n952162
  2020-11-24 15:33     ` karl
  0 siblings, 1 reply; 4+ messages in thread
From: n952162 @ 2020-11-21 19:18 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 3309 bytes --]

On 11/21/20 7:02 PM, karl@aspodata.se wrote:
> $ xlsfonts | grep -i mono
> $ xset +fp /usr/share/fonts/freefont
> $ xlsfonts | grep -i mono | head -1
> -misc-freemono-bold-o-normal--0-0-0-0-m-0-adobe-standard
> $
>
> I.e. it works as expected.


Okay, that's good to know.  I'm unfortunately not at the machine that
was giving me problems, I'll to through those exact steps in a week or two.


>
> # emerge -aqv media-fonts/courier-prime
> ...
>
> $ xset +fp  /usr/share/fonts/courier-prime
> $ xset q | grep prime
>    /usr/share/fonts/courier-prime,/usr/share/fonts/freefont,/usr/local/share/fonts,/usr/share/fonts/misc/,/usr/share/fonts/OTF/,/usr/share/fonts/Type1/,/usr/share/fonts/100dpi/,/usr/share/fonts/75dpi/,built-ins
> $ xlsfonts | grep -i prime
> $
>
> So my courier-prime fp doesn't dissapear, but xlsfonts doesn't
> report them as a core font.
>
> I run fvwm2 on an older X without udev, can it be a fancy modern destop
> that changes this under the hood for you ?


I run fvwm2, too.  :-)



>
> I can see the font with
>
> $ fc-list 'Courier prime'
> /usr/share/fonts/courier-prime/Courier Prime Bold.ttf: Courier Prime:style=Bold
> /usr/share/fonts/courier-prime/Courier Prime.ttf: Courier Prime:style=Regular
> /usr/share/fonts/courier-prime/Courier Prime Bold Italic.ttf: Courier Prime:style=Bold Italic
> /usr/share/fonts/courier-prime/Courier Prime Italic.ttf: Courier Prime:style=Italic


Isn't the fontconfig system a separate, disconnected font service?


> $ xfd -fa 'Courier prime'
> ...


I don't have that command and didn't find a man page right away on the
internet.  I see there's a gentoo package for it, it looks useful.


>
>   Can the problem be that there is a space in the x core font name?


I renamed the files in the courier-prime package with dashes and
regenerated fonts.dir and the other one, too.  Didn't help.


>
> $ head -2  /usr/share/fonts/courier-prime/fonts.dir
> 16
> Courier prime bold italic.ttf -misc-courier prime-bold-i-normal--0-0-0-0-m-0-iso10646-1
> $
>
> If I, as root, do:
>
> cd /usr/share/fonts/courier-prime/
> perl -wpi.bak -e 'tr/ /_/; s/_-/ -/' fonts.dir
> perl -wpi.bak -e 'tr/ /_/; s/_-/ -/' fonts.scale
> list=`ls -1  | grep Cour | tr ' ' '_'`
> for i in $list; do b=`echo $i  | tr '_' ' '`; mv "$b" $i; done
>
>   Then I can do:
> $ xset fp rehash


I used my fixms(1) script (attached).


> $ xlsfonts | grep -i prime | head -1
> -misc-courier_prime-bold-i-normal--0-0-0-0-m-0-iso10646-1
> $ xfd -fn -misc-courier_prime-bold-i-normal--0-0-0-0-m-0-iso10646-1
> Warning: Missing charsets in String to FontSet conversion
> Warning: Unable to load any usable fontset
> Warning: Cannot convert string "-misc-courier_prime-bold-i-normal--0-0-0-0-m-0-iso10646-1" to type FontStruct
> xfd:  no font to display
> $ xterm -fn -misc-courier_prime-medium-r-normal--17-120-100-100-m-0-iso10646-1
> xterm: cannot load font "-misc-courier_prime-medium-r-normal--17-120-100-100-m-0-iso10646-1"
>
> Unfortunately, I cannot use it...
>
> I don't think x likes core fonts with spaces in font- nor
> filenames.
>
> Regards,
> /Karl Hammar
>

Okay, I didn't get that far.  I'll try to get more documentation.

Thanks for looking into it.


>

[-- Attachment #2: fixms --]
[-- Type: text/plain, Size: 525 bytes --]

#!/usr/bin/env bash

for f in "$@"; do
    if [ -r "$f" ]; then
        tgt=$(echo "$f" | tr " " '-' | tr -d "'")

        if [ $tgt = "$f" ]; then
            continue
        fi

        echo mv "$f" $tgt

        if [ -f $tgt ]; then
            echo "$0: $tgt exists" >&2
            exit 1
        fi

        echo -n "Move [ny]?"
        read answer

        case "$answer" in
        [yY]|[yY]es|[yY]ES)
            /bin/mv "$f" $tgt
        ;;
        esac
    else
        echo "$0: $f not readable" >&2
    fi
done

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [gentoo-user] X11 server not seeing font dirs
  2020-11-21 19:18   ` n952162
@ 2020-11-24 15:33     ` karl
  0 siblings, 0 replies; 4+ messages in thread
From: karl @ 2020-11-24 15:33 UTC (permalink / raw
  To: gentoo-user

[-- Attachment #1: Type: text/plain, Size: 1448 bytes --]

Ok, tried again...

It seems that X don't like spaces in font file names.
I also removed spaces in the core font name so I dont
need to "quotify".

What seems to be missing from my previous attempt, is
the mkfontdir/scale runs.

$ cp -r /usr/share/fonts/courier-prime/ prime
$ cd prime/
$ list=`ls -1  | grep Cour | tr ' ' '_'`
$ for i in $list; do b=`echo $i  | tr '_' ' '`; mv "$b" $i; done
$ perl -wpi.bak -e 'tr/ /_/; s/_-/ -/' fonts.dir 
$ perl -wpi.bak -e 'tr/ /_/; s/_-/ -/' fonts.scale 
$ mkfontdir .
$ mkfontscale .
$ cat fonts.dir | sed -n '5p'
Courier_Prime_Italic.ttf -misc-courier_prime-medium-i-normal--0-0-0-0-m-0-iso10646-1
$ xset fp+ /home/karl/prime
$ xfd -fn -misc-courier_prime-medium-i-normal--0-0-0-0-m-0-iso10646-1 &
$ xwd -out xfd.dump
$ file xfd.dump 
xfd.dump: XWD X Window Dump image data, "xfd", 688x641x24
$ xwdtopnm < xfd.dump | pnmtojpeg > xfd.jpg

xfd.jpg is attached.

$ xterm -fn -misc-courier_prime-medium-i-normal--0-0-0-0-m-0-iso10646-1 
$ xwd -out xterm.xwd
$ xwdtopnm < xterm.xwd | pnmtojpeg > xterm.jpg
xwdtopnm: writing PPM file
$

xterm.jpg is attached.

As you can see, it is as the font is double spaced.

 This one says you need LC_ALL=C defined.
https://www.thegeekdiary.com/warning-missing-charsets-in-string-to-fontset-conversion-how-to-resolve-the-xclock-warning-message/
 This one says you need nls use flag enabled.
https://forums.gentoo.org/viewtopic-t-739586-start-0.html

Regards,
/Karl Hammar

[-- Attachment #2: xterm.jpg --]
[-- Type: image/jpeg , Size: 22855 bytes --]

[-- Attachment #3: xfd.jpg --]
[-- Type: image/jpeg , Size: 87654 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-11-24 15:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-18 14:03 [gentoo-user] X11 server not seeing font dirs n952162
2020-11-21 18:02 ` karl
2020-11-21 19:18   ` n952162
2020-11-24 15:33     ` karl

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox