Opened 15 years ago

Last modified 15 years ago

#51 closed enhancement

Use OS/2 font database to match fonts — at Version 9

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 Dmitry A. Kuminov)

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 (9)

comment:1 by Dmitry A. Kuminov, 15 years ago

Priority: majorblocker

A must for the GA.

comment:2 by Silvan Scherrer, 15 years ago

Milestone: Qt GAQt Beta 3

comment:3 by Dmitry A. Kuminov, 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 Dmitry A. Kuminov, 15 years ago

Owner: set to Dmitry A. Kuminov
Status: newaccepted

comment:5 by Dmitry A. Kuminov, 15 years ago

Summary: Use fontconfig to match fontsUse OS/2 font database to match fonts

comment:6 by Dmitry A. Kuminov, 15 years ago

Font enumeration is done in r220. The next step is font matching.

comment:7 by Dmitry A. Kuminov, 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

  1. Enumerate fonts with GpiQueryFonts
  2. Get file names from the PM_Fonts registry key and pair them with enumerated fonts using GpiQueryFullFontDescs
  3. 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 Dmitry A. Kuminov, 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 Dmitry A. Kuminov, 15 years ago

Description: modified (diff)

Non-Latin1 text drawing is fixed in r223. An additional ticket #87 is created for further script-related improvements.

Note: See TracTickets for help on using tickets.