Re: [Fonts]Storing the cached font (fonts.cache) information

2002-09-07 Thread Keith Packard


Around 22 o'clock on Sep 6, Ken Deeter wrote:

 I am concerned that without doing something like this, adding a font
 directory would require modifying two files instead of one (the
 fonts.conf to add the dir and the font mapping table file)

Adding a font directory almost never involves modifying any files at all 
-- you just stick the directory underneath one of the existing directory 
entries in the config file.  Fontconfig automatically discovers the new 
fonts and makes them available to applications.  You can stick fonts in 
~/.fonts and they are automatically available as fontconfig includes that
path in the default set of heirarchies.

To add a new directory heirarchy to the set of available fonts, all you 
have to do is edit the font configuration file and add a dir element.

Of course, in both cases, you're encouraged to run 'fc-cache' before using
the fonts so that the shared font cache file can be built.  Certainly any
relocation of that cache file would be automatically mananged by the
library, insisting that adminstrators and users keep two disparate files
synchronized is a really bad idea.

 I think a better solution would be to think of some kind of automatic
 mapping generation, that requires nothing from a user except to specify
 an extra directory in the fonts.conf

Only permitting a single extra directory makes it difficult for different 
users to have different sets of font heirarchies, in particular, 
caches for per-user fonts cannot live in /var/cache/fonts as that's 
probably not writable by each user.  Hence the idea of multiple mappings 
which match the directory prefix and replace that with a different prefix.

If no mapping prefix matches the font directory, the cache file would be 
placed within the directory itself just as is done today, so it's really 
only necessary to add these entries for system-wide read-only font 
directories.

Adding a property to the dir element would be very easy to understand, 
and I don't think that would tremendously burden users with too much 
configuration; most systems have only two or three font heirarchies 
present.

 I'm not sure what happens when the cache needs to be rebuilt, (i.e. how
 fontconfig knows when whats in the directory doesn't match whats in the
 cache, but i'm assuming this is already dealt with since it is a problem
 regardless of where the cache files are put)

Fontconfig keeps track of directory and file modification times in the 
cache and invalidates entries which are outdated.  It stat's every 
directory in the heirarchy at startup to detect changes, so it's somewhat 
important that the heirarchies be focused on fonts and not just '/'.

___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]Storing the cached font (fonts.cache) information

2002-09-07 Thread Mike A. Harris

On Sat, 7 Sep 2002, Zenith Lau wrote:

Date: Sat, 7 Sep 2002 09:42:47 +0800
From: Zenith Lau [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Content-Type: text/plain; charset=US-ASCII
List-Id: XFree86 Font List fonts.XFree86.Org
Subject: Re: [Fonts]Storing the cached font (fonts.cache) information

Hi,

   I think I've some opinion on this ~

 However, storing cached information in what is ostensibly a read-only 
 directory is unfriendly and violates the FSH guidelines.  This data is
 just cached versions of data available from the font files themselves and 
 so the FSH says it should live (somehow) in /var/cache.
Good move!

 Any directories not matching a configured prefix would map to themselves; 
 this makes the existing configuration and cache files compatible.
How do you resolve any fonts which doesn't located under /usr/share/fonts ?
Some one like to put fonts under different mount points and for me, I put most of my
TTF under /usr/X11R6/lib/X11/fonts/local .
Is it possible to for this way :

1. Let's assume the caching directory is called FontCachePrefix/
2. Add one additional mapping table under the FontCachePrefix/
3. Such that, we lookup the cache for a specific directory by keeping the relation of 
each cache file and its' corresponding font directory.
4. So that, we don't need a complicated sub-dir. tree under our FontCachePrefix/
5. The listing can be in binary to minmize the extrax cost for this additional table 
(file).
6. Finally, for each font directory, we can put the cache as something like 
path-to.cache
or simply 1.cache, 2.cache etc.

 Does this seem like a good plan?  Can anyone come up with a better way of 
 moving the storage of fonts.cache into /var/cache?

Yes, personally, I don't like cache placed around my fonts directory : )
Also, this will make reonly /usr partition for practical.
But, /var/cache/fonts is already specified in the FHS, that, this directory is for 
dynamically generated fonts, I quote it here :

5.5.3 /var/cache/fonts : Locally-generated fonts (optional)
5.5.3.1 Purpose
   The directory /var/cache/fonts should be used to store any dynamically-created 
fonts.
   In particular, all of the fonts which are automatically generated by mktexpk 
must be
   located in appropriately-named subdirectories of /var/cache/fonts.[footnote 31]
5.5.3.2 Specific Options
   Other dynamically created fonts may also be placed in this tree, under 
   appropriately-named subdirectories of /var/cache/fonts.

Hence, I think, cooperation with FHS is needed or, we simply use another prefix.
Though, I think /var/cache/fonts should be the better, as I like the style what 
fontconfig do.

I hope that, the combination ft + fc can be adopted more widely.

Right, /var/cache/fonts is taken use /var/cache/fontconfig 
instead.  Much more explicit what owns it.


-- 
Mike A. Harris  ftp://people.redhat.com/mharris
OS Systems Engineer
XFree86 maintainer
Red Hat Inc.

___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



[Fonts]Storing the cached font (fonts.cache) information

2002-09-06 Thread Keith Packard


Fontconfig currently stores cached information about fonts in 
per-directory files called 'fonts.cache-version'.  These are stored 
right in the font directories which means they'll get copied and managed 
automatically as people move fonts around.

However, storing cached information in what is ostensibly a read-only 
directory is unfriendly and violates the FSH guidelines.  This data is
just cached versions of data available from the font files themselves and 
so the FSH says it should live (somehow) in /var/cache.

I'm open to suggestions, but here's one simplistic possibility:

Create a shadow heirarchy in /var/cache/fonts which mirrors the 
various font directory heirarchies and populate that at appropriate points 
with fonts.cache files.

I'd do this by creating a new table of cache prefix mappings:

/usr/share/fonts - /var/cache/fonts/share

This mapping would direct any fonts.cache files related to directories 
under /usr/share/fonts to be stored in /var/cache/fonts/share by simply 
replacing the /usr/share/fonts prefix with /var/cache/fonts/share:

/usr/share/fonts/truetype/arphic/fonts-cache-1 -

/var/cache/fonts/share/truetype/arphic/fonts-cache-1

Any directories not matching a configured prefix would map to themselves; 
this makes the existing configuration and cache files compatible.

Does this seem like a good plan?  Can anyone come up with a better way of 
moving the storage of fonts.cache into /var/cache?

Keith PackardXFree86 Core TeamHP Cambridge Research Lab


___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]Storing the cached font (fonts.cache) information

2002-09-06 Thread Zenith Lau

Hi,

I think I've some opinion on this ~

 However, storing cached information in what is ostensibly a read-only 
 directory is unfriendly and violates the FSH guidelines.  This data is
 just cached versions of data available from the font files themselves and 
 so the FSH says it should live (somehow) in /var/cache.
Good move!

 Any directories not matching a configured prefix would map to themselves; 
 this makes the existing configuration and cache files compatible.
How do you resolve any fonts which doesn't located under /usr/share/fonts ?
Some one like to put fonts under different mount points and for me, I put most of my
TTF under /usr/X11R6/lib/X11/fonts/local .
Is it possible to for this way :

1. Let's assume the caching directory is called FontCachePrefix/
2. Add one additional mapping table under the FontCachePrefix/
3. Such that, we lookup the cache for a specific directory by keeping the relation of 
each cache file and its' corresponding font directory.
4. So that, we don't need a complicated sub-dir. tree under our FontCachePrefix/
5. The listing can be in binary to minmize the extrax cost for this additional table 
(file).
6. Finally, for each font directory, we can put the cache as something like 
path-to.cache
or simply 1.cache, 2.cache etc.

 Does this seem like a good plan?  Can anyone come up with a better way of 
 moving the storage of fonts.cache into /var/cache?

Yes, personally, I don't like cache placed around my fonts directory : )
Also, this will make reonly /usr partition for practical.
But, /var/cache/fonts is already specified in the FHS, that, this directory is for 
dynamically generated fonts, I quote it here :

5.5.3 /var/cache/fonts : Locally-generated fonts (optional)
5.5.3.1 Purpose
The directory /var/cache/fonts should be used to store any dynamically-created 
fonts.
In particular, all of the fonts which are automatically generated by mktexpk 
must be
located in appropriately-named subdirectories of /var/cache/fonts.[footnote 31]
5.5.3.2 Specific Options
Other dynamically created fonts may also be placed in this tree, under 
appropriately-named subdirectories of /var/cache/fonts.

Hence, I think, cooperation with FHS is needed or, we simply use another prefix.
Though, I think /var/cache/fonts should be the better, as I like the style what 
fontconfig do.

I hope that, the combination ft + fc can be adopted more widely.

Zenith Lau
___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]Storing the cached font (fonts.cache) information

2002-09-06 Thread Keith Packard


Around 9 o'clock on Sep 7, Zenith Lau wrote:

  Any directories not matching a configured prefix would map to themselves; 
  this makes the existing configuration and cache files compatible.
 How do you resolve any fonts which doesn't located under /usr/share/fonts ?

The prefix mapping would be configurable; add a map from 
/usr/X11R6/lib/X11/fonts to /var/cache/fontconfig/x11-fonts and you'll
get your cache files for fonts in the standard X directories stored
in /var/cache/fontconfig/x11-fonts.

 2. Add one additional mapping table under the FontCachePrefix/

I can either store the mapping table in a file or directly in the file 
system; I don't have a strong preference, but using the file system is 
likely to involve fewer but more complicated system calls during 
application startup.  It might also involve a slight bit of overhead.  The 
advantage is that there aren't any synchronization issues; each cache file 
is accessable without reference to a separate file.  It seems like that 
should be more robust in many ways.

 But, /var/cache/fonts is already specified in the FHS, that, this
 directory is for dynamically generated fonts, I quote it here :

Sigh.  We'll use /var/cache/fontconfig then.  I don't really care.

 Though, I think /var/cache/fonts should be the better, as I like the style
 what fontconfig do.

To some extent, we can ask if a slight reinterpretation of the FSH can be 
permitted in this case.

Keith PackardXFree86 Core TeamHP Cambridge Research Lab


___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]Storing the cached font (fonts.cache) information

2002-09-06 Thread Zenith Lau

Hi,

   Any directories not matching a configured prefix would map to themselves; 
   this makes the existing configuration and cache files compatible.
  How do you resolve any fonts which doesn't located under /usr/share/fonts ?
 
 The prefix mapping would be configurable; add a map from 
 /usr/X11R6/lib/X11/fonts to /var/cache/fontconfig/x11-fonts and you'll
 get your cache files for fonts in the standard X directories stored
 in /var/cache/fontconfig/x11-fonts.
 
  2. Add one additional mapping table under the FontCachePrefix/
 
 I can either store the mapping table in a file or directly in the file 
 system; I don't have a strong preference, but using the file system is 
 likely to involve fewer but more complicated system calls during 
 application startup.  It might also involve a slight bit of overhead.  The 
 advantage is that there aren't any synchronization issues; each cache file 
 is accessable without reference to a separate file.  It seems like that 
 should be more robust in many ways.

Sorry, do you mean that, store the mapping table in the file system, 
you are talking about the first idea?

Anyway, I agree that additional table in a file is less robust and involve 
more overhead.

For the configurable prefix mapping, how do it exists? 
Also it is permissable that, there are many dir in the fonts.conf.
Is it possible to store the mapping as properties of the dir elements?

 
  But, /var/cache/fonts is already specified in the FHS, that, this
  directory is for dynamically generated fonts, I quote it here :
 
 Sigh.  We'll use /var/cache/fontconfig then.  I don't really care.
 
  Though, I think /var/cache/fonts should be the better, as I like the style
  what fontconfig do.
 
 To some extent, we can ask if a slight reinterpretation of the FSH can be 
 permitted in this case.

Ok.

Best Regards,
Zenith Lau
___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts



Re: [Fonts]Storing the cached font (fonts.cache) information

2002-09-06 Thread Keith Packard


Around 13 o'clock on Sep 7, Zenith Lau wrote:

 Sorry, do you mean that, store the mapping table in the file system, 
 you are talking about the first idea?

I can either use a sequence of directories to encode the source font path, 
or I can create a file which maps path names to file names.  

In the first method, with the mapping:

/usr/share/fonts - /var/cache/fontconfig/share

the cache file:

/usr/share/fonts/truetype/kochi/fonts.cache-1

would live in:

/var/cache/fontconfig/share/truetype/kochi/fonts.cache-1

This is done by simply replacing the prefix of the path matching the left 
hand of the mapping with the right hand of the mapping.

The library would automatically take care of creating any necessary 
directories to create the matching directory heirarchy.

In the second method, with the mapping:

/usr/share/fonts - /var/cache/fontconfig/share

I'd create a cache mapping file (cache.map?), that file would live in

/var/cache/fontconfig/share/cache.map

It would contain an entry like:

truetype/kochi/fonts.cache-1 1.cache-1

and the cache file

/usr/share/fonts/truetype/kochi/fonts.cache-1

would like in:

/var/cache/fontconfig/share/1.cache-1

I would keep the cache.map file synchronized with the cache file 
contents somehow; programs would be required to open the mapping file to 
locate cache files for each directory.

 For the configurable prefix mapping, how do it exists? 
 Also it is permissable that, there are many dir in the fonts.conf.
 Is it possible to store the mapping as properties of the dir elements?

That's a good idea -- I hadn't thought of that.  I'd thought, instead, of 
creating new configuration data which mapped names.  I like the directory 
property better.  Thanks.

Keith PackardXFree86 Core TeamHP Cambridge Research Lab


___
Fonts mailing list
[EMAIL PROTECTED]
http://XFree86.Org/mailman/listinfo/fonts