FONTMETRICS: Difference between revisions
Appearance
Big and New ;-) |
m Links |
||
| Line 2: | Line 2: | ||
Font-metrics structure. This structure is returned to applications on the | Font-metrics structure. This structure is returned to applications on the | ||
GpiQueryFonts and GpiQueryFontMetrics calls and conveys information from the font creator to the application. | [[OS2 API:GpiQueryFonts|GpiQueryFonts]] and [[OS2 API:GpiQueryFontMetrics|GpiQueryFontMetrics]] calls and conveys information from the font creator to the application. | ||
=== Type === | === Type === | ||
Revision as of 23:03, 25 November 2005
FONTMETRICS
Font-metrics structure. This structure is returned to applications on the GpiQueryFonts and GpiQueryFontMetrics calls and conveys information from the font creator to the application.
Type
CHAR szFamilyname[ FACESIZE ] CHAR szFacename[ FACESIZE ] USHORT idRegistry USHORT usCodePage LONG lEmHeight LONG lXHeight LONG lMaxAscender LONG lMaxDescender LONG lLowerCaseAscent LONG lLowerCaseDescent LONG lInternalLeading LONG lExternalLeading LONG lAveCharWidth LONG lMaxCharInc LONG lEmInc LONG lMaxBaselineExt SHORT sCharSlope SHORT sInlineDir SHORT sCharRot USHORT usWeightClass USHORT usWidthClass SHORT sXDeviceRes SHORT sYDeviceRes SHORT sFirstChar SHORT sLastChar SHORT sDefaultChar SHORT sBreakChar SHORT sNominalPointSize SHORT sMinimumPointSize SHORT sMaximumPointSize USHORT fsType USHORT fsDefn USHORT fsSelection USHORT fsCapabilities LONG lSubscriptXSize LONG lSubscriptYSize LONG lSubscriptXOffset LONG lSubscriptYOffset LONG lSuperscriptXSize LONG lSuperscriptYSize LONG lSuperscriptXOffset LONG lSuperscriptYOffset LONG lUnderscoreSize LONG lUnderscorePosition LONG lStrikeoutSize LONG lStrikeoutPosition SHORT sKerningPairs SHORT sFamilyClass LONG lMatch LONG FamilyNameAtom LONG FaceNameAtom PANOSE panose
C Declaration Method
typedef struct
Fields
szFamilyname[ FACESIZE ] Family name. The family name of the font that describes the basic appearance of the font, for example, Times New Roman This string is null terminated, and therefore is limited to 31 characters in length. Longer names may be retrieved by using the FamilyNameAtom field to retrieve the full name from the System Atom table.
szFacename[ FACESIZE ] Face name. The typeface name that defines the particular font, for example, Times New Roman Bold Italic. This string is null terminated, and therefore is limited to 31 characters in length. Longer names may be retrieved by using the FaceNameAtom field to retrieve the full name from the System Atom table.
idRegistry Registry identifier.
The IBM registered number (or zero).
usCodePage Code page.
Defines the registered code page supported by the
font. For example, the original IBM PC code page is
437. A value of 0 implies that the font may be used
with any of the OS/2 supported code pages. Where a
font contains special symbols for which there is no
registered code page, then code page 65400 is used.
lEmHeight Em height.
The height of the Em square in world coordinate units.
This corresponds to the point size for the font.
lXHeight X height.
The nominal height above the baseline for lowercase
characters (ignoring ascenders) in world coordinate
units.
lMaxAscender Maximum ascender.
The maximum height above the baseline reached by any
part of any symbol in the font in world coordinate
units. This field may exceed lEmHeight.
lMaxDescender Maximum descender.
The maximum depth below the baseline reached by any
part of any symbol in the font in world coordinate
units. This field may exceed lEmHeight.
lLowerCaseAscent Lowercase ascent.
The maximum height above the baseline reached by any
part of any lowercase (Latin unaccented "a" through
"z") symbol in the font in world coordinate units.
lLowerCaseDescent Lowercase descent.
The maximum depth below the baseline reached by any
part of any lowercase (Latin unaccented "a" through
"z") symbol in the font in world coordinate units.
lInternalLeading Internal leading.
The amount of space which, when subtracted from
lMaxAscender, gives a font-design dependent, but
glyph-set independent, measure of the distance above
the baseline that characters extend. This calculation
approximates the visual top to a row of characters
without actually looking at the characters in the row.
For optimum results, this field should be used by
applications to position the first line of a block of
text by subtracting it from lMaxAscender and
positioning the baseline that distance below whatever
is above the text.
This does not guarantee that characters will not
overwrite information above them, but does give a font
designer's view of where to place the text. Collision
should be tested for, and additional space allocated
if necessary.
lExternalLeading External leading.
The amount of guaranteed white space advised by the
font designer to appear between adjacent rows of text.
This value may be zero.
The fonts built in to Presentation Manager have zero
in this field.
lAveCharWidth Average character width.
This is determined by multiplying the width of each
lowercase character by a constant, adding the
products, and then dividing by 1000. The letters
involved in this, plus their constants, are as
follows:
Letter Constant
a 64
b 14
c 27
d 35
e 100
f 20
g 14
h 42
i 63
j 3
k 6
l 35
m 20
n 56
o 56
p 17
q 4
r 49
s 56
t 71
u 31
v 10
w 18
x 3
y 18
z 2
space 166
For fixed pitch fonts, this value will be the same as
the (A width + B width + C width) escapement of each
character.
lMaxCharInc Maximum character increment.
The maximum character increment for the font in world
coordinate units.
lEmInc Em increment.
The width of the Em square in world coordinate units.
This corresponds to the point size of the font. When
the horizontal device resolution equals the vertical
device resolution this is equal to the em height.
lMaxBaselineExt Maximum baseline extent.
The maximum vertical space occupied by the font, in
world coordinate units. This is the sum of
lMaxAscender and lMaxDescender if both are positive.
It is also the sum of lInternalLeading and lEmHeight.
One possible type of line spacing can be computed by
adding lMaxBaselineExt to lExternalLeading. Such a
line spacing, however, would be dependent on the glyph
set included in the font. If a new version of the font
should be made available, with new glyphs, then it is
possible that this value will change because one of
the new glyphs has gone above the previous
lMaxAscender or below the previous lMaxDescender.
More sophisticated applications will base line spacing
on the point size (lEmHeight) of the font, which is an
invariant of the font, multiplied by some factor (for
example, 120%) plus any external leading.
This field may exceed lEmHeight.
sCharSlope Character slope.
Defines the nominal slope for the characters of a
font. The slope is defined in degrees increasing
clockwise from the vertical. An italic font is an
example of a font with a nonzero slope.
Note: The units for this metric are degrees and
minutes, encoded as shown in the following
example:
180 degrees 59 minutes would be represented as :
│ < byte 1 > │ < byte 2 > │
│ │ < Minutes > │ < Degrees > │
│0│1 1 1 0 1 1 │0 1 0 1 1 0 1 0 0│
│ 59 min │ 180 degrees │
sInlineDir Inline direction.
The direction in which the characters in the font are
designed for viewing. The direction is defined in
degrees increasing clockwise from the horizontal
(left-to-right). Characters are added to a line of
text in the inline direction.
Note: The units for this metric are degrees and
minutes, encoded as shown in sCharSlope.
sCharRot Character rotation.
The rotation of the character glyphs with respect to
the baseline, the
angle increasing counter clockwise. This is the angle
assigned by the font designer.
Note: The units for this metric are degrees and
minutes, encoded as shown in sCharSlope.
usWeightClass Weight class.
Indicates the visual weight (thickness of strokes) of
the characters in the font:
Value Description
1 Ultra-light
2 Extra-light
3 Light
4 Semi-light
5 Medium (normal)
6 Semi-bold
7 Bold
8 Extra-bold
9 Ultra-bold
usWidthClass Width class.
Indicates the relative aspect ratio of the characters
of the font in relation to the normal aspect ratio for
this type of font:
┌─────┬───────────────┬────────────────────┐
│Value│Description │% of normal width │
├─────┼───────────────┼────────────────────┤
│1 │Ultra-condensed│50 │
├─────┼───────────────┼────────────────────┤
│2 │Extra-condensed│62.5 │
├─────┼───────────────┼────────────────────┤
│3 │Condensed │75 │
├─────┼───────────────┼────────────────────┤
│4 │Semi-condensed │87.5 │
├─────┼───────────────┼────────────────────┤
│5 │Medium (normal)│100 │
├─────┼───────────────┼────────────────────┤
│6 │Semi-expanded │112.5 │
├─────┼───────────────┼────────────────────┤
│7 │Expanded │125 │
├─────┼───────────────┼────────────────────┤
│8 │Extra-expanded │150 │
├─────┼───────────────┼────────────────────┤
│9 │Ultra-expanded │200 │
└─────┴───────────────┴────────────────────┘
sXDeviceRes X-device resolution.
For bit-map fonts this is the resolution in the X
direction of the intended target device, measured in
pels per inch. For outline fonts this is the number of
notional units in the X direction of the Em square,
measured in notional units per Em. (Notional units are
the units in which the outline is defined.)
sYDeviceRes Y-device resolution.
For bit-map fonts this is the resolution in the Y
direction of the intended target device, measured in
pels per inch.
For outline fonts this is the number of notional units
in the Y direction of the Em square, measured in
notional units per Em. (Notional units are the units
in which the outline is defined.)
sFirstChar First character.
The code point of the first character in the font.
sLastChar Last character.
The code point of the last character in the font,
expressed as an offset from sFirstChar.
All code points between the first and last character
specified must be supported by the font.
sDefaultChar Default character.
The code point that is used if a code point outside
the range supported by the font is used, expressed as
an offset from sFirstChar.
sBreakChar Break character.
The code point that represents the "space" or "break"
character for this font, expressed as an offset from
sFirstChar. For example, if the first character is the
space in code page 850, sFirstChar = 32, and
sBreakChar = 0.
sNominalPointSize Nominal point size.
For a bit-map font, this field contains the height of
the font.
For an outline font, this field contains the height
intended by the font designer. For example, some fonts
are designed for text use in which case a value of 120
(12 point) would probably be placed in this field,
whereas other fonts are designed for "display" use
("display" is typographer's terminology for larger
sizes). This is not the only size at which the font
can be used.
Measured in decipoints (a decipoint is 1/720th of an
inch).
sMinimumPointSize Minimum point size.
For a bit-map font, this field does not apply. For an
outline font, this field contains the minimum height
intended by the font designer. Note that this is not a
restriction of the size at which the font can be used.
Measured in decipoints (a decipoint is 1/720th of an
inch).
sMaximumPointSize Maximum point size.
For a bit-map font, this field does not apply.
For an outline font, this field contains the maximum
height intended by the font designer. Note that this
is not a restriction of the size at which the font can
be used.
Measured in decipoints (a decipoint is 1/720th of an
inch).
fsType Type indicators.
This field contains the following information:
FM_TYPE_FIXED Characters in the font have the same
fixed width.
FM_TYPE_LICENSED Licensed (protected) font.
FM_TYPE_KERNING Font contains kerning information.
FM_TYPE_64K Font is larger than 64KB (KB equals
1024 bytes) in size. If the
following two bits are false, the
font is for single-byte code pages.
One of the bits may be set.
FM_TYPE_DBCS Font is for double-byte code pages.
FM_TYPE_MBCS Font is for mixed single- or
double-byte code pages.
FM_TYPE_FACETRUNC Font szFacename has been truncated.
FM_TYPE_FAMTRUNC Font szFamilyname has been
truncated.
FM_TYPE_ATOMS The System Atom table atom values in
FamilyNameAtom and in
FaceNameAtom are valid.
fsDefn Definition indicators.
Contains the following font definition data:
FM_DEFN_OUTLINE Font is a vector (outline) font;
otherwise, it is a bit-map font.
FM_DEFN_GENERIC Font is in a format that can be used
by the GPI; otherwise, it is a
device font.
fsSelection Selection indicators.
Contains information about the font patterns in the
physical font.
Note: The flags do not reflect simulations applied to
the physical font.
Possible values are:
FM_SEL_ITALIC True indicates that this font is
designed as an italic font.
FM_SEL_UNDERSCORE TRUE indicates that this font is
designed with underscores included
in each character.
FM_SEL_NEGATIVE TRUE indicates that this font is
designed with the background and
foreground reversed.
FM_SEL_OUTLINE TRUE indicates that this font is
designed with outline (hollow)
characters.
FM_SEL_STRIKEOUT TRUE indicates that this font is
designed with an overstrike through
each character.
FM_SEL_BOLD TRUE indicates that this font is
designed with bold characters.
FM_SEL_ISO9241_TESTED This flag indicates that the
font has been tested for
compliance to ISO 9241. The presence
of this flag doesn't indicate
whether the font passed or failed,
only that it was tested.
Note: While the fonts were primarily
tested for meeting the ISO standard,
they have also been designed to meet
the German standard DIN 66 234.
Where the two standards differ, the
fonts have been designed to meet the
more stringent requirement.
fsCapabilities Font capabilities.
This attribute applies only to device fonts.
FM_CAP_NOMIX Characters may not be mixed with
graphics.
QUALITY The most significant byte may
contain the following numeric value:
0 Undefined
1 DP quality
2 DP draft
3 Near Letter Quality
4 Letter Quality
lSubscriptXSize Subscript x-size.
The horizontal size recommended by the font designer
for subscripts for this font in world coordinate
units.
lSubscriptYSize Subscript y-size.
The vertical size recommended by the font designer for
subscripts for this font in world coordinate units.
lSubscriptXOffset Subscript x-offset.
The baseline x-offset recommended by the font designer
for subscripts for this font in world coordinate
units.
lSubscriptYOffset Subscript y-offset.
The baseline y-offset recommended by the font designer
for subscripts for this font in world coordinate
units.
Note: Positive numbers indicate an offset below the
baseline.
lSuperscriptXSize Superscript x-size.
The horizontal size recommended by the font designer
for superscripts for this font in world coordinate
units.
lSuperscriptYSize Superscript y-size.
The vertical point size recommended by the font
designer for superscripts for this font in world
coordinate units.
lSuperscriptXOffset Superscript x-offset.
The baseline x-offset recommended by the font designer
for superscripts for this font in world coordinate
units.
lSuperscriptYOffset Superscript y-offset.
The baseline y-offset recommended by the font designer
for superscripts for this font in world coordinate
units.
lUnderscoreSize Underscore size.
The width (thickness) of the underscore stroke in
world coordinate units. This describes the actual
underscore in the font if FM_SEL_UNDERSCORE is
also set. Otherwise it describes what the engine will
simulate if underscore is requested in
piCreateLogFont.
lUnderscorePosition Underscore position.
The position of the underscore stroke from the
baseline in world
coordinate units. This describes the actual underscore
in the font if FM_SEL_UNDERSCORE is also set.
Otherwise it describes what the engine will simulate
if underscore is requested in GpiCreateLogFont.
Note: Positive values indicate an offset below the
baseline.
lStrikeoutSize Strikeout size.
The width of the strikeout stroke in world coordinate
units. This describes the actual underscore in the
font if FM_SEL_STRIKEOUT is also set. Otherwise it
describes what the engine will simulate if overstrike
is requested in GpiCreateLogFont.
lStrikeoutPosition Strikeout position.
The position of the strikeout stroke relative to the
baseline in world coordinate units. This describes the
actual underscore in the font if FM_SEL_STRIKEOUT is
also set. Otherwise it describes what the engine will
simulate if overstrike is requested in
GpiCreateLogFont.
sKerningPairs Kerning pairs.
The number of kerning pairs in the kerning pair table.
sFamilyClass Font family design classification.
This value contains a font class and its subclass.
lMatch Matched font identity.
This uniquely identifies the font for a given device
and device driver combination. A positive match number
signifies that the font is a generic (engine) font
while a negative number indicates a device font (a
native or downloadable font). This value should not be
used to identify a font across system boundaries.
FamilyNameAtom Font family name atom.
This value contains the atom identifier for the font
family name in the System Atom Table.
FaceNameAtom Font facename atom.
This value contains the atom identifier for the font
face name in the System Atom Table.
panose Panose font descriptor.
This is the Panose descriptor identifying the visual
characteristics of the font.