Opened 15 years ago
Closed 15 years ago
#51 closed enhancement (fixed)
Use OS/2 font database to match fonts
Reported by: | Dmitry A. Kuminov | Owned by: | Dmitry A. Kuminov |
---|---|---|---|
Priority: | blocker | Milestone: | Qt Beta 3 |
Component: | QtGui | Version: | 4.5.1 Beta 1 |
Severity: | Keywords: | ||
Cc: |
Description (last modified by )
We will use the Freetype2 library to cache installed fonts and perform font matching for Qt applications (refer to #41 for more info).
Change History (11)
comment:1 by , 15 years ago
Priority: | major → blocker |
---|
comment:2 by , 15 years ago
Milestone: | Qt GA → Qt Beta 3 |
---|
comment:3 by , 15 years ago
I'm leaning to dropping fontconfig support actually. Its main purpose is to make the font configuration on a given system centralized and static across different applications. While this is really makes sense for Linux systems, on OS/2 font configuration is already pretty centralized and static.
Besides, fontconfig requires libxml and both these libraries aren't normal citizens of the typical OS/2 setup which means that we have to statically compile them into Qt which I consider as an overkill for a simple task of selecting a font file based on the requested font properties.
The OS/2 font database contains all basic information we need when choosing fonts. If we want more (e.g. font substitution, anti-aliasing and hint rules based on font family etc) we will add support for that through recognizing extra keys in OS2.INI.
If some day later the situation changes and many OS/2 applications start using fontconfig + libxml, we are always able to switch to fontconfig in Qt4 too.
comment:4 by , 15 years ago
Owner: | set to |
---|---|
Status: | new → accepted |
comment:5 by , 15 years ago
Summary: | Use fontconfig to match fonts → Use OS/2 font database to match fonts |
---|
comment:7 by , 15 years ago
Actually, we don't have direct access to font file names when enumerating installed fonts using the GPI API (GpiQueryFonts), we only get properties (style, size, etc). While there is a GpiQueryFullFontDescs call which may extract families and face names found in a specified file, I don't find it sane to
- Enumerate fonts with GpiQueryFonts
- Get file names from the PM_Fonts registry key and pair them with enumerated fonts using GpiQueryFullFontDescs
- Eventually pass those filenames down to Freetype2 for rendering
provided that using Freetype2 we can bypass GPI completely, and besides that GPI and Freetype2 may interpret some fonts differently and the opinion of the one which will actually render them (Freetype2) is obviously more important.
So, I'll better go through PM_Fonts and get their properties with Freetype2. We will of course not see fonts built into resource DLLs in such case (e.g. WarpSans, System Proportional, System VIO etc) but it's not a big deal ATM since these fonts cannot be rendered by Freetype2 directly anyway (we'll need a driver for doing that, see #52).
comment:8 by , 15 years ago
Implemented the Freetype2 way in r222. Also implemented font matching so that all available outline fonts (TTF and PFB) can now be selected in Qt applications.
There are minor glitches for tomorrow:
- non-Latin1 input is broken.
- requesting an unknown family causes the list of fonts to be reloaded and rescanned (slow).
comment:9 by , 15 years ago
Description: | modified (diff) |
---|
comment:10 by , 15 years ago
Implemented simple font caching and got 10 times faster second and subsequent application startups: initial Qt font database population (which includes scanning font files) with the default set of eCS fonts takes ~1500 ms on my VBox, all subsequent populations (which read data from the cache) take ~150 ms. This covers the "requesting an unknown family" case described above.
PS. Spent several hours fixing a nasty vendor bug that was very difficult to find (r229). One of the side effects was that saving a QDateTime object in the registry using QSettings and then reading it could return a completely different QDateTime object! Unfortunately this bug slipped from the Windows version into the OS/2 version because they share the same code. This bug affects only non-Unicode Windows versions (95, 98) where they introduced a dirty hack instead of properly fixing the source of the problem. This explains why the bug has been remaining unfixed for so long. Since OS/2 is "non-Unicode" too, it affects it as well. I'm falling asleep now so will release Beta 3 tomorrow.
comment:11 by , 15 years ago
Resolution: | → fixed |
---|---|
Status: | accepted → closed |
Slightly improved font caching so that now it doesn't even look at the font cache in the registry when requesting unknown families provided that the font files haven't been changed, added, or removed. r230 contains the final font cache implementation.
Enough for this ticket. There are a few unimplemented methods, created #89 for it.
A must for the GA.