Opened 8 years ago

Closed 8 years ago

#78 closed task (fixed)

fontconfig: Read default fonts from PM registry

Reported by: dmik Owned by:
Priority: major Milestone:
Component: fontconfig Version:
Severity: medium Keywords:
Cc:

Description

The current (complete) fontconfig port uses directory specifications in fonts.conf to find fonts. While we can easily put something like C:/PSFONTS in there by default (it is tested and works) this isn't entirely correct as OS/2 maintains its own system font list and it may represent fonts from many other directories rather than from a single one. We need to read the font list right from the registry.

Change History (4)

comment:1 Changed 8 years ago by dmik

Type: enhancementdefect

The task is done in r1214. A special dir name OS2FONTDIR is used to refer to the OS2.INI file containing the PM_Fonts key (also the directory may be specified directly as C:/OS2/OS2.INI where C is your boot drive, this is completely equivalent). It works nicely in terms that the font entries from PM_Fonts go through the standard fontconfig caching mechanism.

However, there is one big problem. The fontconfig cache manager decides if the cache needs to be reviewed by using the directory modification timestamp. In case of OS2.INI, it's a timestamp of the last flush operation performed by PM. This operation happens at some periodic intervals not controlled by the user. Each time this timestamp changes fontconfig performs a complete font rescan which takes 10 to 15 sec here (I have around 75 font files registered in PM_Fonts). And besides that, the timestamp of OS2.INI is changed upon each reboot which means that any attempt to start an application using fontconfig after rebooting will cause a 10-15 sec delay.

I don't think this is acceptable. I'm really disappointed that the fontconfig cache uses the timestamp of the containing directory to decide to perform the full rescan instead of the timestamps of individual font files... Or may be there is some bug in our port that causes it to do so. I need to check this (but the caching code is unexpectedly too complex).

comment:2 Changed 8 years ago by dmik

Type: defecttask

comment:3 Changed 8 years ago by dmik

I have one idea (besides going back to dir based scanning): use the checksum of all timestamps of individual font files from the registry as the timestamp of the INI file instead of the file's own timestamp. This way, if a number of files changes or if the time stamp of any file change, we will get a new checksum and it will cause a rescan. I'm looking now how to override standard timestamp detection for our special file acting like a dir.

comment:4 Changed 8 years ago by dmik

Resolution: fixed
Status: newclosed

I fixed the rescan problem in r1217. It works really great now. In order to cause the font rescan, one has to either add or remove a new font file from PM_Fonts or change any of the existing file's attributes (name, size, timestamp). Just what we need. I like fontconfig again. There is one thing left before we can release it though, see #82.

Note: See TracTickets for help on using tickets.