[Solved] Fontconfig question

You have a problem with Salix? Post here and we'll do what we can to help.
User avatar
jsfarinet
Posts: 305
Joined: 23. Nov 2014, 07:32

[Solved] Fontconfig question

Post by jsfarinet »

To improve font rendering in '/etc/fonts' i added a file named "local.conf" with the following settings:

Code: Select all

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
 <match target="font">
  
  <edit mode="assign" name="rgba"
   <const>rgb</const>
  <edit>

  <edit mode="assign" name="hinting">
   <bool>true</bool>
  <edit>

  <edit mode="assign" name="hintstyle">
   <const>hintslight</const>
  <edit>

  <edit mode="assign" name="antialias">
   <bool>true</bool>
  <edit>

  <edit mode="assign" name="lcdfilter">
   <const>lcddefault</const>
  <edit>

 </match>
</fontconfig>
In all my debian (based) setups that worked like a charm. Now by accident (while executing some command in the terminal) i got this error:

Code: Select all

Fontconfig error: "local.conf", line 7: not well-formed (invalid token)
Fontconfig error: "local.conf", line 7: invalid attribute 'target'
That makes me wonder, if,eventually, that way to set fontconfig is not compatible with slackware.

Thanks a lot in advance.

PS. I opened that file in Geany and indeed i can see, there is something strange: In the line

Code: Select all

   <const>rgb</const>
"<const>" is displayed like this <const> (i.e. the first part is black while only the closing bracket is blue While in all other statements (e.g. before lcddefault) it looks like this: <const> .
Last edited by jsfarinet on 26. Nov 2014, 21:56, edited 1 time in total.
User avatar
gapan
Salix Wizard
Posts: 6362
Joined: 6. Jun 2009, 17:40

Re: Fontconfig question

Post by gapan »

If it works in debian and doesn't work here, it's probably because debian uses a different (newer/older) version that supports this and the version in slackware/salix 14.1 doesn't. But, to configure font settings, look in your ~/.Xresources file. That's where it's configured.
Image
Image
User avatar
jsfarinet
Posts: 305
Joined: 23. Nov 2014, 07:32

Re: Fontconfig question

Post by jsfarinet »

gapan wrote:If it works in debian and doesn't work here, it's probably because debian uses a different (newer/older) version that supports this and the version in slackware/salix 14.1 doesn't. But, to configure font settings, look in your ~/.Xresources file. That's where it's configured.

Ok, thanks for the hint. Is there somewhere a complete list of all possible Xft settings in Xresources? For example, i'm totally unsure whether in yes/no statements (boolean, right?) i should use 1/0 or true/false. In various sites i found both :-/

My - font related - settings for now are this:

Code: Select all

! Xft settings ---------------------------------------------------------------

Xft.dpi:        96
Xft.scale:	1.0
Xft.antialias:  true
Xft.rgba:       rgb
Xft.hinting:    true
Xft.hintstyle:  hintslight
Xft.lcdfilter:  lcddefault

! xterm -----------------------------------------------------------------------
....
Does that seem reasonable to you?
User avatar
gapan
Salix Wizard
Posts: 6362
Joined: 6. Jun 2009, 17:40

Re: Fontconfig question

Post by gapan »

Looks good, but I just noticed the problem with your original file. It's here:

Code: Select all

  <edit mode="assign" name="rgba"
   <const>rgb</const>
The first of these two lines doesn't have a closing >.
Image
Image
User avatar
jsfarinet
Posts: 305
Joined: 23. Nov 2014, 07:32

Re: Fontconfig question

Post by jsfarinet »

gapan wrote:Looks good, but I just noticed the problem with your original file. It's here:

Code: Select all

  <edit mode="assign" name="rgba"
   <const>rgb</const>
The first of these two lines doesn't have a closing >.
Shame on me, i feel i need a doctor ;-)

Thanks a lot for the pointer! In any case, would you say i should stick with fontconfig or rather use Xresources?
User avatar
gapan
Salix Wizard
Posts: 6362
Joined: 6. Jun 2009, 17:40

Re: Fontconfig question

Post by gapan »

I think you probably need both.
Image
Image
User avatar
jsfarinet
Posts: 305
Joined: 23. Nov 2014, 07:32

Re: Fontconfig question

Post by jsfarinet »

gapan wrote:I think you probably need both.
ArchWiki says it's not sane to use both . . . (?)

In any case, aside your hint i see now, where the error in my local.conf is: In some way there got the "closing slash" in the <edit></edit> statement lost. In case it might be of interest to someone, i post here the correct file:

Code: Select all

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
 <match target="font">
  <edit mode="assign" name="rgba">
   <const>rgb</const>
  </edit>
  <edit mode="assign" name="hinting">
   <bool>true</bool>
  </edit>
  <edit mode="assign" name="hintstyle">
   <const>hintslight</const>
  </edit>
  <edit mode="assign" name="antialias">
   <bool>true</bool>
  </edit>
  <edit mode="assign" name="lcdfilter">
   <const>lcddefault</const>
  </edit>
 </match>
</fontconfig>
User avatar
gapan
Salix Wizard
Posts: 6362
Joined: 6. Jun 2009, 17:40

Re: Fontconfig question

Post by gapan »

jsfarinet wrote:ArchWiki says it's not sane to use both . . . (?)
Does it? I genuinely don't know. I'm not sure I understand why if so.
Image
Image
User avatar
jsfarinet
Posts: 305
Joined: 23. Nov 2014, 07:32

Re: Fontconfig question

Post by jsfarinet »

gapan wrote:
jsfarinet wrote:ArchWiki says it's not sane to use both . . . (?)
Does it? I genuinely don't know. I'm not sure I understand why if so.
I think you're right: Xresources for those programs which do not understand or relay on fontconfig. Apparently there is no harm using both. Rather, i've a question for the file 'fonts.conf' that seems to have come automatically by the installation in ~./config/fontconfig. There ist stated

Code: Select all

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<!-- created by lxqt-config-appearance (DO NOT EDIT!) -->
If you read that file, many statements are similar (to "my" 'local.conf' but some statements seem contradictorious to me: one time hintstyle is slight and then it is medium ????? In any case, since i'm not underway to use i commented that file out (appendix .bak ;) ). Also, at a first glance wit no harm.
User avatar
gapan
Salix Wizard
Posts: 6362
Joined: 6. Jun 2009, 17:40

Re: [Solved] Fontconfig question

Post by gapan »

lxqt? Are you sure you got that file from a salix installation and it's not a remnant of another distro?
Image
Image
Post Reply