Font Structure (OpenInsight Specific)
At 11 NOV 1999 02:09:29PM S. Berger wrote:
I am trying to get to a fixed space narrow font using the Print_SetFont function. I have the lines:
font=Courier,-7,400,0,0,0,0,18,0,3,2,1,0,0,0,0"
convert "," to @SVM in font
in my code. Does anyone know what the different values in the font structure represent? If I can determine that I might be able to work with this. I know that the first value is the name, and the second represents the size, but beyond that…?
Thanks
S
At 12 NOV 1999 05:43AM Oystein Reigem wrote:
S,
I used to know a lot about this, but almost all is gone from my memory. Was it like there are two different font structures in OI? I think so. One is for getting or setting the FONT property of controls. The other one is used by Utility "TEXTRECT", Utility "CHOOSEFONT" and Print_SetFont. (I have only ever used the Utility functions, not Print_SetFont. I use OIPI to print.) The latter structure is (almost) like a Windows API LOGFONT font structure.
I think you can find out what you need by studying docs for either structure. For the former see the OI Reference docs for the FONT property and the FontStructure Attributes. For the latter see snippet about Windows API LOGFONT font structure, copied from Delphi 1's Windows API Help.
Convert the "" codes back to real tabs and you'll get back some of the formatting at least.
- Oystein -
TLOGFONT (2.x) (WINTYPES unit)
TLogFont=recordlfHeight: Integer;lfWidth: Integer;lfEscapement: Integer;lfOrientation: Integer;lfWeight: Integer;lfItalic: Byte;lfUnderline: Byte;lfStrikeOut: Byte;lfCharSet: Byte;lfOutPrecision: Byte;lfClipPrecision: Byte;lfQuality: Byte;lfPitchAndFamily: Byte;lfFaceName: array0..lf_FaceSize - 1 of Char;end;The TLOGFONT structure defines the attributes of a font, a drawing object used to write text on a display surface.
MemberDescription
lfHeightThe desired height, in logical units, for the font. If this value is greater than zero, it specifies the cell height of the font. If it is less than zero, it specifies the character height of the font. If this value is zero, the font mapper uses a default height. The absolute value of the lfHeight member must not exceed 16,384 after it is converted to device units.
lfWidthThe average width, in logical units, of characters in the font. If this value is zero, the font mapper chooses a reasonable default width for the specified font height. The widths of characters in TrueType fonts are scaled by a factor of this member divided by the width of the characters in the physical font (as specified by the tmAveCharWidth member of the TTEXTMETRIC structure).
lfEscapementThe angle, in tenths of degrees, between the base line of a character and the x-axis.
lfOrientationThe orientation of the characters. This value is ignored.
lfWeightThe font weight. This member can be one of the following values:
ConstantValue
FW_DONTCARE0
FW_THIN100
FW_EXTRALIGHT200
FW_ULTRALIGHT200
FW_LIGHT300
FW_NORMAL400
FW_REGULAR400
FW_MEDIUM500
FW_SEMIBOLD600
FW_DEMIBOLD600
FW_BOLD700
FW_EXTRABOLD800
FW_ULTRABOLD800
FW_BLACK900
FW_HEAVY900
The actual appearance of the font depends on the type face. Some fonts have only FW_NORMAL, FW_REGULAR, and FW_BOLD weights. If FW_DONTCARE is specified, a default weight is used.
lfItalicAn italic font if nonzero.
lfUnderlineAn underlined font if nonzero.
lfStrikeOutA strikeout font if nonzero.
lfCharSetThe character set of the font. The following values are predefined:
ConstantValue
ANSI_CHARSET0
DEFAULT_CHARSET1
SYMBOL_CHARSET2
SHIFTJIS_CHARSET128
OEM_CHARSET255
The DEFAULT_CHARSET value is not used by the font mapper. An application can use this value to allow the name and size of a font to fully describe the logical font. If the specified font name does not exist, a font from any character set can be substituted for the specified font; applications should use the DEFAULT_CHARSET value sparingly to avoid unexpected results.
The OEM character set is system-dependent.
Fonts with other character sets may exist in the system. If an application uses a font with an unknown character set, it should not attempt to translate or interpret strings that are to be rendered with that font.
lfOutPrecisionThe desired output precision. The output precision defines how closely the output must match the height, width, character orientation, escapement, and pitch of the requested font. This member can be one of the following values:
OUT_CHARACTER_PRECISOUT_STRING_PRECIS
OUT_DEFAULT_PRECISOUT_STROKE_PRECIS
OUT_DEVICE_PRECISOUT_TT_PRECIS
OUT_RASTER_PRECISOUT_TT_ONLY_PRECIS
Applications can use the values OUT_DEVICE_PRECIS, OUT_RASTER_PRECIS, and OUT_TT_PRECIS to control how the font mapper chooses a font when the system contains more than one font with a given name.
For example, if a system contains a font named "Symbol" in raster and TrueType form, specifying OUT_TT_PRECIS would force the font mapper to choose the TrueType version. (Specifying OUT_TT_PRECIS forces the font mapper to choose a TrueType font whenever the specified font name matches a device or raster font, even when there is no TrueType font with the same name.)
An application can use TrueType fonts exclusively by specifying OUT_TT_ONLY_PRECIS. When this value is specified, the system chooses a TrueType font even when the name specified in the lfFaceName member matches a raster or vector font.
lfClipPrecisionThe desired clipping precision. The clipping precision defines how to clip characters that are partially outside the clipping region. This member can be any one of the following values:
CLIP_CHARACTER_PRECISCLIP_MASK
CLIP_DEFAULT_PRECISCLIP_STROKE_PRECIS
CLIP_EMBEDDEDCLIP_TT_ALWAYS
CLIP_LH_ANGLES
To use an embedded read-only font, applications must specify the CLIP_EMBEDDED value.
To achieve consistent rotation of device, TrueType, and vector fonts, an application can use the OR operator to combine the CLIP_LH_ANGLES value with any of the other lfClipPrecision values. If the CLIP_LH_ANGLES bit is set, the rotation for all fonts is dependent on whether the orientation of the coordinate system is left-handed or right-handed.
If CLIP_LH_ANGLES is not set, device fonts always rotate counter-clockwise, but the rotation of other fonts is dependent on the orientation of the coordinate system. (For more information about the orientation of coordinate systems, see the description of the lfEscapement member.)
lfQualityThe output quality of the font, which defines how carefully the graphics device interface (GDI) must attempt to match the logical-font attributes to those of an actual physical font. This member can be one of the following values:
ValueMeaning
DEFAULT_QUALITYAppearance of the font does not matter.
DRAFT_QUALITYAppearance of the font is less important than when the PROOF_QUALITY value is used. For GDI raster fonts, scaling is enabled. Bold, italic, underline, and strikeout fonts are synthesized if necessary.
PROOF_QUALITYCharacter quality of the font is more important than exact matching of the logical-font attributes. For GDI raster fonts, scaling is disabled and the font closest in size is chosen. Bold, italic, underline, and strikeout fonts are synthesized if necessary.
lfPitchAndFamilyThe pitch and family of the font. The two low-order bits, which specify the pitch of the font, can be one of the following values:
DEFAULT_PITCHVARIABLE_PITCH
FIXED_PITCH
The four high-order bits of the member, which specify the font family, can be one of the following values:
ValueMeaning
FF_DECORATIVENovelty fonts. Old English is an example.
FF_DONTCAREDo not care or do not know.
FF_MODERNFonts with constant stroke width, with or without serifs. Pica, Elite, and Courier New are examples.
FF_ROMANFonts with variable stroke width and with serifs. Times New Roman and New Century Schoolbook are examples.
FF_SCRIPTFonts designed to look like handwriting. Script and Cursive are examples.
FF_SWISSFonts with variable stroke width and without serifs. MS Sans Serif is an example.
An application can specify a value for the lfPitchAndFamily member by using the Boolean OR operator to join a pitch constant with a family constant.
Font families describe the look of a font in a general way. They are intended for specifying fonts when the exact typeface desired is not available.
lfFaceNameThe typeface name of the font. The length of this string must not exceed LF_FACESIZE - 1. The EnumFontFamilies function can be used to enumerate the typeface names of all currently available fonts. If lfFaceName is NULL, GDI uses a device-dependent typeface.
Comments
Applications can use the default settings for most of these members when creating a logical font. The members that should always be given specific values are lfHeight and lfFaceName. If lfHeight and lfFaceName are not set by the application, the logical font that is created is device-dependent.
See Also
CreateFontIndirect
Windows structures
At 22 NOV 1999 06:11AM Oystein Reigem wrote:
Sorry for writing all that crap. It's the same structure. The LOGFONT structure is not used. The LOGFONT documentation might be good for details about each parameter. That's all.
- Oystein -