Bug 55617 - unnecessarily removes font paths from fonts.conf
Summary: unnecessarily removes font paths from fonts.conf
Status: RESOLVED WORKSFORME
Alias: None
Product: kcontrol
Classification: Unmaintained
Component: kcmfontinst (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Craig Drummond
URL:
Keywords:
: 58823 (view as bug list)
Depends on:
Blocks:
 
Reported: 2003-03-06 19:46 UTC by James Young
Modified: 2003-11-07 23:47 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description James Young 2003-03-06 19:46:23 UTC
Version:            (using KDE 3.1.0)
Installed from:     (testing/unstable)
Compiler:          gcc version 3.2.2 20030131 (Debian prerelease)
OS:          Linux (i686) release 2.4.20-ck4

kcmfontinst removes font paths that it doesn't understand from fonts.conf.

e.g.  my /etc/fonts/fonts.conf has this in it:

<dir>/usr/X11R6/lib/X11/fonts/misc/</dir>
<dir>/usr/X11R6/lib/X11/fonts/100dpi/</dir>
<dir>/usr/X11R6/lib/X11/fonts/75dpi/</dir>
<dir>/usr/X11R6/lib/X11/fonts/Speedo/</dir>
<dir>/usr/X11R6/lib/X11/fonts/TrueType/</dir>
<dir>/usr/X11R6/lib/X11/fonts/Type1/</dir>
<dir>/usr/share/fonts/truetype/openoffice/</dir>

but if I make any changes to my installed fonts using kcmfontinst, it rewrites this to:

<dir>/usr/X11R6/lib/X11/fonts/TrueType/</dir>
<dir>/usr/X11R6/lib/X11/fonts/Type1/</dir>
<dir>/usr/share/fonts/truetype/openoffice/</dir>

This is very annoying as it removes all the bitmap fonts that I use in Konsole.
Comment 1 Craig Drummond 2003-03-06 22:59:22 UTC
Subject: Re:  New: unnecessarily removes font paths from fonts.conf

Hi,

Yeah I know... The reason was that it came from XftConfig days -and this only 
handled TrueType and Type1 fonts. This needs to be changed.

Craig.

Comment 2 James Richard Tyrer 2003-06-01 02:41:24 UTC
KDE 3.1.2 
 
The problem has changed but has not been fixed. 
 
RTFM for FontConfig. 
 
FontConfig recursively searches directory trees.  Therefore it NEVER needed all 
of those directories!!!! 
 
 
Therefore, all you normally need is: 
 
 <dir>/usr/X11R6/lib/X11/fonts</dir>  
 <dir>/usr/share/fonts</dir>  
 
And they should NEVER be changed.   
 
You only need to add a directory if the font isn't in a subdirectory of one of 
the listed directories. 
  
Also note that is the directory strings should NOT end with a '/' like they do 
in XF86Config. 
 
-- 
JRT 
 
 
 
 
Comment 3 Craig Drummond 2003-06-01 19:56:20 UTC
Subject: Re:  unnecessarily removes font paths from fonts.conf

> KDE 3.1.2
>
> The problem has changed but has not been fixed.
>
> RTFM for FontConfig.

Yes I know. For about the 3rd time!

>
> FontConfig recursively searches directory trees.  Therefore it NEVER needed
> all of those directories!!!!

And, what is the PROBLEM?????????? As I've said (3rd time now...) - this is 
for ease of coding, to keep Xft and X in sync font-path wise.

>
>
> Therefore, all you normally need is:
>
>  <dir>/usr/X11R6/lib/X11/fonts</dir>
>  <dir>/usr/share/fonts</dir>
>
> And they should NEVER be changed.
>
> You only need to add a directory if the font isn't in a subdirectory of one
> of the listed directories.
>
> Also note that is the directory strings should NOT end with a '/' like they
> do in XF86Config.

WHY WHAT HARM DOES IT DO? 

Comment 4 James Richard Tyrer 2003-06-01 23:09:08 UTC
Subject: Re:  unnecessarily removes font paths from fonts.conf

Craig Drummond wrote:

>>KDE 3.1.2
>>
>>The problem has changed but has not been fixed.
>>
>>RTFM for FontConfig.
> 
> 
> Yes I know. For about the 3rd time!
> 
> 
>>FontConfig recursively searches directory trees.  Therefore it NEVER needed
>>all of those directories!!!!
> 
> 
> And, what is the PROBLEM?????????? As I've said (3rd time now...) - this is 
> for ease of coding, to keep Xft and X in sync font-path wise.
> 
Easse of coding????  What I am saying is that if you code does NOTHING 
with the file: "/etc/fonts/fonts.conf" that it will work perfectly in 
most cases -- unless a user used it to install a font in a weird 
directory (and then it would certainly be the user's fault).

But, with your code, if I install a font in:

	/usr/X11R6/lib/X11/fonts/Type1

Then FontConfig can NO longer find my:

	/usr/X11R6/lib/X11/fonts/100dpi
	/usr/X11R6/lib/X11/fonts/75dpi
	/usr/X11R6/lib/X11/fonts/Mozilla
	/usr/X11R6/lib/X11/fonts/misc

and the fonts in Konsole are screwed.

If I had installed usr font is: "$HOME/.fonts" they are unavailable as 
well.

This is not WFFM: "Works Fine For Me".
	
Perhaps you failed to understand that FontConfig also works with bit 
mapped fonts and Xft doesn't.  Sorry, this means that you can NOT keep 
the Xft and FontConfig font paths in sync because they are NOT the same.

>
>>Therefore, all you normally need is:
>>
>> <dir>/usr/X11R6/lib/X11/fonts</dir>
>> <dir>/usr/share/fonts</dir>
>>
>>And they should NEVER be changed.
>>
>>You only need to add a directory if the font isn't in a subdirectory of one
>>of the listed directories.
>>
>>Also note that is the directory strings should NOT end with a '/' like they
>>do in XF86Config.
> 
> 
> WHY WHAT HARM DOES IT DO?
> 
Specifically, the harm listed above occurs because your code REMOVES 
these directories from: "/etc/fonts/fonts.conf":



That specifically is the HARM that it does, if removes directories. 
If it didn't do this, there would be no great harm.  Note the title of 
the bug: "unnecessarily removes font paths ... "

Also did you note Keith Packard's admonition:

	"DO NOT EDIT THIS FILE."
	  ...
	"CHANGES BELONG IN 'local.conf'."

I note, in case you do not appreciate some of my sarcasm, that I am 
more than willing to help you with this (although I am sure that you 
are better than writing C++ code than I am).  However, I do not 
appreciate your attitude which I (sarcastically) refer to as the 
'arrogant developer' attitude.

All I know about FontConfig is what I have learned by reading the 
documentation and using it.  Perhaps I am just a quick study, or (the 
actual fact) perhaps I learned that skill in engineering school.

If you have questions about FontConfig, I suggest that you join the 
list: fonts@xfree86.org or ask Keith Packard <keithp@keithp.com>

--
JRT

Comment 5 James Richard Tyrer 2003-06-02 05:56:37 UTC
*** Bug 58823 has been marked as a duplicate of this bug. ***
Comment 6 Craig Drummond 2003-06-02 11:45:35 UTC
Subject: Re:  unnecessarily removes font paths from fonts.conf

> Easse of coding????  What I am saying is that if you code does NOTHING 

WELL YES. AS EXPLAINED DUE TO XFT1 AND 2. THE PROBLEM IS REMVING THE PATHS -
THIS WAS DUE TO AN OVERSIGHT BY ME.

> with the file: "/etc/fonts/fonts.conf" that it will work perfectly in 
> most cases -- unless a user used it to install a font in a weird 
> directory (and then it would certainly be the user's fault).
> 
> But, with your code, if I install a font in:
> 
> 	/usr/X11R6/lib/X11/fonts/Type1
> 
> Then FontConfig can NO longer find my:
> 
> 	/usr/X11R6/lib/X11/fonts/100dpi
> 	/usr/X11R6/lib/X11/fonts/75dpi
> 	/usr/X11R6/lib/X11/fonts/Mozilla
> 	/usr/X11R6/lib/X11/fonts/misc

Yup, hands up - I f***ed up. Xft1 was TTF/T1 only - and I (wrongly) assumed
Xft/Fontconfig was too. 

> 
> and the fonts in Konsole are screwed.
> 
> If I had installed usr font is: "$HOME/.fonts" they are unavailable as 
> well.

Again, when this was coded it was before ~/.fonts was decided as the
standard place for fonts. My new io-salve installer will install user fonts to
~/.fonts. And I'm writing a script to move all fonts from the old
~/.kde/share/fonts into ~/.fonts

> 
> This is not WFFM: "Works Fine For Me".
> 	
> Perhaps you failed to understand that FontConfig also works with bit 
> mapped fonts and Xft doesn't.  Sorry, this means that you can NOT keep 
> the Xft and FontConfig font paths in sync because they are NOT the same.

Well it does. I just alo add the bitmap fonts to Xft1's path - no harm, as
it won't find any fonts.

> 
> >
> >>Therefore, all you normally need is:
> >>
> >> <dir>/usr/X11R6/lib/X11/fonts</dir>
> >> <dir>/usr/share/fonts</dir>
> >>
> >>And they should NEVER be changed.
> >>
> >>You only need to add a directory if the font isn't in a subdirectory of
> one
> >>of the listed directories.
> >>
> >>Also note that is the directory strings should NOT end with a '/' like
> they
> >>do in XF86Config.
> > 
> > 
> > WHY WHAT HARM DOES IT DO?
> > 
> Specifically, the harm listed above occurs because your code REMOVES 
> these directories from: "/etc/fonts/fonts.conf":

NO TH WAHT HARM REFERES TO THE DIRECTORY SLASH!!!

> 
> 
> 
> That specifically is the HARM that it does, if removes directories. 
> If it didn't do this, there would be no great harm.  Note the title of 
> the bug: "unnecessarily removes font paths ... "
> 
> Also did you note Keith Packard's admonition:
> 
> 	"DO NOT EDIT THIS FILE."
> 	  ...
> 	"CHANGES BELONG IN 'local.conf'."

OK -  Imissed this. Will change me io-slave to use this file instead. BTW,
whan was this added, I started coding from an early version of fontconfig.

> 
> I note, in case you do not appreciate some of my sarcasm, that I am 
> more than willing to help you with this (although I am sure that you 
> are better than writing C++ code than I am).  However, I do not 
> appreciate your attitude which I (sarcastically) refer to as the 
> 'arrogant developer' attitude.

And I don't appreciate being told what to do - without explanation as to
WHY. I write this stuff in my own PERSONAL time, and for FREE. I'm more than
willing to work out any problems - when I started this installer stuff I made
lots of changes at the request of others, even if they were of no use to me,
and I'd also help a users with each specific point until it was fixed. I'm NOT
AN "ARROGANT DEVELOPER" - just someone who gets p***ed off with some one
ARROGANTLY telling me what to do. I would appreciate your help, if you exlpained
WHY somethnig should be done. For example, you STILL HAVE NOT explained why I
should not add a trainling slash to directry listings in fontconfig - this
WFFM.

There are lots of ways of infomring someone of a point - yours don't seem to
be the most polite. 

If you want to help with the code - PLEASE do. I'd love someone else to help
with this. Someone who seems to know more about Fontconfig than I do. If
you're interested I can send you the latest io-slave based stuff I'm working on.

> 
> All I know about FontConfig is what I have learned by reading the 
> documentation and using it.  Perhaps I am just a quick study, or (the 
> actual fact) perhaps I learned that skill in engineering school.

This is the same for me. When I started the installer it was only to get
fonts working in StarOffice 5.1. There was NO other tool to do this. Then
someone asked me to add Xft support - before I even had theat version of X on my
system. So I upgraded, and added the neccessary functionality - even though at
the at time I didn't like AA'ed fonts.

> 
> If you have questions about FontConfig, I suggest that you join the 
> list: fonts@xfree86.org or ask Keith Packard <keithp@keithp.com>
> 
> --
> JRT
> 

Craig.

Comment 7 Craig Drummond 2003-06-02 14:33:42 UTC
OK - I've calmed down a bit. Sorry, haven't been getting much sleep lately, and
took your comments the wrong way. :-(

So - what if I make the following changes:

1. Add all x fontpaths to Xft/fontconfig paths - regardless of font-type.
2. Only store paths in fontconfig *if* they are not a sub-directory of an
existing entry.
3. for root, use /etc/fonts/local.conf.


This should clear up the above issues, no?  Is the matter of the trailing slash
important? If so I can remove it before saving the file, else its not worth the
hassle.
Comment 8 Torsten Beekhuis 2003-06-02 16:30:07 UTC
Subject: KFontInst is seriously broken

KDE 3.1.1 / SuSE8.2Pro

I can not use all of my installed fonts, anymore. Is there a solution 
available?

Regards, TB

Comment 9 Craig Drummond 2003-06-02 17:01:56 UTC
Subject: Re:  unnecessarily removes font paths from fonts.conf

If your on about bitmap fonts - then just install a TTF file into the bitmap
font folder. This will cause the installer to not remove the folder from
fontconfig's path. A hack, I know - but it'll work for now.

Comment 10 James Richard Tyrer 2003-06-02 20:19:01 UTC
Subject: Re:  unnecessarily removes font paths from fonts.conf

Craig Drummond wrote:

> Is the matter of the trailing slash important?

I don't know for sure.  If you have a trailing slash, running:
"fc-cache -v" shows paths with a double slash in them.  This is ugly,
but I don't know if there is something somewhere that it is going to
mess up.

My philosophy is that it is an accident waiting to happen and it is 
better to get it correct when you write it than to try to dig it up 
latter when somebody reports a bug.

 > If so I can remove it before saving the file, else its not worth the
> hassle.

All you should need to do is shorten the strings by 1.

Pseudo code:

$pathstring = left$($pathstring, (length$($pathstring) - 1))

The only thing I liked about BASIC is how well it manipulates strings.

--
JRT

Comment 11 James Richard Tyrer 2003-06-02 20:29:04 UTC
Subject: Re:  unnecessarily removes font paths from fonts.conf

Craig Drummond wrote:

>> If I had installed usr font is: "$HOME/.fonts" they are unavailable as
>>  well.
> 
> 
> Again, when this was coded it was before ~/.fonts was decided as the 
> standard place for fonts. 
> 
I have no doubt of that.  It does illustrate how things that are not 100%
correct can cause unforeseeable problems later.
> 
> There are lots of ways of infomring someone of a point - yours don't
> seem to be the most polite.
> 
Sorry to be so direct, but this was a comment about a bug report not a
personal e-mail.

If you need a more detailed explanation of anything, please contact me by
e-mail and I will provide you with a longer and (therefore) more polite 
explanation.

--
JRT

Comment 12 Craig Drummond 2003-06-03 11:08:08 UTC
Subject: Re:  unnecessarily removes font paths from fonts.conf

Ok. I'm gonna implement *all*  of your points - I already have for the
io-slave one, and I'll try to do the KControl one in CVS this weekend. Not sure if
there's gonna be a KDE 3.1.3, so maybe its's not worth it til KDE3.2?

Comment 13 Ross Boylan 2003-07-17 20:20:53 UTC
I came upon this bug because I've been having lots of font problems.

I have a basic question: why is KDE messing with the font configuration at all?
 Why doesn't it just use the system the way it is set up?
Comment 14 Richard Neill 2003-07-17 20:50:11 UTC
Re #13, A typical use is to install more fonts. For instance, the only thing
left of my Win98 partition is a tarball of the Windows fonts. And there are the
new bitstream vera ones. And in general, I've found the KDE apps are better than
the distro-specific apps for the same job.
Comment 15 Arwed v. Merkatz 2003-09-28 15:35:55 UTC
Right now with kde 3.1.92, kde edits the ~/.fonts.conf, adding
/usr/X11R6/lib/X11/fonts to the fontconfig search directories. This breaks my
font setup, since it makes fontconfig choose the wrong font when i use the
'fixed' font. I don't think any app should mess with ~/.fonts.conf unless i
explicitly tell it to. If my setup doesn't have /usr/X11R6/lib/X11/fonts in the
fontconfig path then i obviously don't want it in there.
Comment 16 Craig Drummond 2003-09-29 13:54:04 UTC
Subject: Re:  unnecessarily removes font paths from fonts.conf

The reason for this (I think!) is that the installer tries to synchronise
your X11 font path (either X or xfs) with fontconfig. So, if a folder is in
one, but not the other, then it will be added to the one that is missing. I'm
not willing to change this functionality. It is used so that both Xft and
regular X apps can have access to the same fonts.

It would seem that "/usr/X11R6/lib/X11/fonts" is in your X11 font path, but
not Xft (/etc/fonts/local.conf)

Comment 17 Arwed v. Merkatz 2003-09-29 15:23:40 UTC
/usr/X11R6/lib/X11/fonts isn't in my X fontpath:
Font Path:
/home/arwed/.gnome2/share/cursor-fonts,
/usr/X11R6/lib/X11/fonts/misc/,
/usr/X11R6/lib/X11/fonts/Speedo/,
/usr/X11R6/lib/X11/fonts/Type1/,
/usr/X11R6/lib/X11/fonts/75dpi/,
/usr/X11R6/lib/X11/fonts/100dpi/,
/usr/share/fonts/truetype/,
/usr/share/fonts/Type1/,
/home/arwed/.gnome2/share/fonts

(from xset q)

and besides: i don't want the X fontpath and the fontconfig path to be
synchronized, since Xft apps don't handle some fonts well, and old X font
handling doesn't handle some fonts well
Comment 18 Craig Drummond 2003-09-29 15:36:42 UTC
Subject: Re:  unnecessarily removes font paths from fonts.conf

> /usr/X11R6/lib/X11/fonts isn't in my X fontpath:

OK. My mistake. what it does is ensure the top-level X font folder is in
both config files.

> Font Path:
...
> 
> and besides: i don't want the X fontpath and the fontconfig path to be
> synchronized, since Xft apps don't handle some fonts well, and old X font
> handling doesn't handle some fonts well

Well that's a bug with Xft! And you should file a bug report there. If you
really don't want Xft to access some fonts, create a folder
"/usr/lib/X11R6/lib/X11/fonts/.wibble/wobble" and copy the fonts in there. Xft won't see the
fonts in "wobble" as ".wibble" is hidden and fontconfig won't look into that. X
however, will have ".wibble/wobble" in its path (but not ".wibble"). This
exploits a slight bug in the current font-installer.

Craig.

Comment 19 Craig Drummond 2003-10-13 12:08:32 UTC
Subject: Re:  konqueror ttf font file mouseover

Hi,

OK. The "problem" (I think) is that this is a Macintosh TTF font. Whilst
this shouldn't be a problem - I've never seen one of these before.

Konqueror is crashing because of the kfile_font plugin. This reads certain
data about the font - name, family, weight, etc. This seems to work OK for PC
TTF files, etc. The code that reads the names has been modified for KDE3.2 -
and this must've taken into account Macintosh name tables in the font (as it
works OK).

When I get time I need to backport the code from KDE3.2 into KDE3.1.x


Craig.

p.s. I'm sending this via bugs.kde.org - so that this is logged.

Comment 20 Craig Drummond 2003-10-13 12:14:04 UTC
Subject: Re:  unnecessarily removes font paths from fonts.conf

Oops... The above refers to a different error!!!

Comment 21 Craig Drummond 2003-11-07 23:47:44 UTC
No longer does this on CVS HEAD.