Page 1 of 2

[Solved] Fontconfig question

Posted: 25. Nov 2014, 10:37
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> .

Re: Fontconfig question

Posted: 25. Nov 2014, 17:00
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.

Re: Fontconfig question

Posted: 26. Nov 2014, 09:05
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?

Re: Fontconfig question

Posted: 26. Nov 2014, 11:19
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 >.

Re: Fontconfig question

Posted: 26. Nov 2014, 11:49
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?

Re: Fontconfig question

Posted: 26. Nov 2014, 14:28
by gapan
I think you probably need both.

Re: Fontconfig question

Posted: 26. Nov 2014, 21:39
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>

Re: Fontconfig question

Posted: 27. Nov 2014, 22:55
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.

Re: Fontconfig question

Posted: 27. Nov 2014, 23:09
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.

Re: [Solved] Fontconfig question

Posted: 27. Nov 2014, 23:15
by gapan
lxqt? Are you sure you got that file from a salix installation and it's not a remnant of another distro?