The Font Mapper
The Windows system has its built-in font mapper, which implicitly helps application to find out the closest match from the installed typefaces to application desiring one, when selecting a logical font into a specific device. There are many Windows applications and documents, which depend on the presence of font mapper. To support these applications and documents, the Open32 NLS Extension has Win32 compatible font mapper emulation.
The font mapping logic used in the Windows systems are described in: "Windows Font Mapping", Microsoft Developer Network Development Library, which covers the font mapping process in Windows 3.1 for western countries. The Open32 NLS Extension font mapper is designed based on this specification, with some changes to support vertical writing fonts and to absorb the differences between OS/2 and Windows fonts.
The table shown below describes the penalty values used by the font mapper emulation.
[CharSet] 65000 Requested charset does not match the candidate's. [OutputPrecision] 19000 Requested OUT_STROKE_PRECIS, but the device can't do it or the candidate is not a vector font. Or OUT_STROKE_PRECIS not requested, and the candidate is a vector font that requires GDI support. [FixedPitch] 15000 Requested a fixed pitch font, but the candidate is a variable pitch font. [FaceName] 10000 Requested a face name, but the candidate's face name does not match. [Family] 9000 Requested a family, but the candidate's family is different. [FamilyUnknown] 8000 Requested a family, but the candidate has no family. [HeightBigger] 600 The candidate is a nonvector font and is bigger than the requested height. [FaceNameSubst] 500 New for Windows version 3.1.Requested face name is matched with a substitute face name. note: Not implemented in Open32 NLS Extension, because OS/2 does not support Font Substitution function. [PitchVariable] 350 Requested a variable pitch font, but the candidate is not a variable pitch font. [HeightSmaller] 150 The candidate is a raster font and is smaller than the requested height. Penalty * height difference [HeightBiggerDifference] 150 The candidate is a raster font and is larger than the requested height. Penalty * height difference [FamilyUnlikely] 50 New for Windows version 3.1. Requested a roman/modern/swiss family, but the candidate is decorative/script. Or requested decorative/script, and the candidate is roman/modern/swiss. note: In Windows 95 the GDI seems to refer PANOSE numbers to check the font family. In OS/2 the valid PANOSE numbers are not set in the font metrics. The Open32 NLS Extension will not use this PANOSE number information for font mapping. [Width] 50 Requested a nonzero width, but the candidate's width doesn't match. Penalty * width difference [SizeSynth] 50 The candidate is a raster font that needs scaling by GDI. [Aspect] 30 The candidate's aspect ratio is different from that of the device. Penalty * ((100 * devY/devX) - (100 * candidateY / candidateX)) note: Absolute value. [IntSizeSynth] 20 The candidate is a raster font that needs scaling. Penalty * (height multiplier + width multiplier) [UnevenSizeSynth] 4 The candidate is a raster font that is scaled unequally in width and height. Penalty * (100 * bigger multiplier / smaller multiplier) [Italic] 4 Requested font and candidate font do not agree on italic status, and the desired result cannot be simulated. [NotTrueType] 4 New for Windows version 3.1. Requested OUT_TT_PRECIS, but the candidate is not a TrueType font. [Weight] 3 The candidate's weight does not match the requested weight. Penalty * (weight difference/10) [Underline] 3 Requested font has no underline, but the candidate is underlined. [StrikeOut] 3 Requested font has no strike-out, but the candidate is struck out. [VectorHeightSmaller] 2 Candidate is a vector font that is smaller than the requested height. Penalty * height difference [DeviceFavor] 2 Extra penalty for all nondevice fonts. [ItalicSim] 1 New for Windows version 3.1. Requested italic font but the candidate is not italic, although italics can be simulated. [DefaultPitchFixed] 1 Requested DEFAULT_PITCH, but the candidate is fixed pitch. [SmallPenalty] 1 New for Windows version 3.1. Requested a rotated font, and the candidate needs bold or italic simulation and is a raster or vector font. [VectorHeightBigger] 1 Candidate is a vector font that is bigger than the requested height. Penalty * height difference
Note: To support vertical writing fonts, the font mapper in the Windows platforms for Far Eastern countries seems to check the facename prefix '@' in the logical font, as one of independent logical font attributes. The penalty number to be used is
Note: To support applications which need to use point size for selecting a font, the font mapper must support "EmHeight" matching mode (lfHeight < 0 in LOGFONT). For raster fonts, the font mapper checks lEmHeight and syDeviceRes in the OS/2 FONTMETRICS.