Function: This function creates a special logical font that can be selected by any device.
Function prototype: hfont createfont (INT nheight, int nwidth, int nescapement, int norientation, int fnweight, DWORD average, DWORD fdwunderline, DWORD average, DWORD fdwcharset, DWORD fdwoutputprecision, DWORD average, DWORD fdwquality, DWORD fdwpitchandfamily, lpctstr lpszface );
Parameters:
Nheight: Specifies the logical unit height of the character unit or character in the font. The height value (also known as em height) of the character unit minus the internal header value. The font er interprets the value specified by nheight in the following way. The meanings of these values are as follows:
> 0: The font er converts the value to the unit of the device and matches the unit height of the existing font.
0: Use a default height value for the font er conversion.
<0: The font er converts the value to the device unit and matches the absolute value with the character height of an existing font.
Compare all heights. The font er selects the maximum font size that does not exceed the required size.
This ing occurs when the font is used for the first time.
For mm_text ing, you can use the following formula to determine the height of a font with a specified dot size:
Nwidth: Specifies the average width of the logical unit of Characters in the required font. If this value is 0, the font er selects a closest match value, the closest match value is determined by the absolute value of the difference between the feature coefficient of the current device and the digital feature coefficient of the available font.
Nescapement: Specifies an angle between the shift vector and the X-axis of the device, in the unit of 10 to 10 degrees. The shift vector is parallel to the baseline of the positive line.
Windows NT: When the graphics device is set to gm_advanced, the position angle of the string can be specified without relying on the Character positioning angle of the string.
When the graphic mode is set to gm_compatible, nescapement specifies both the shift angle and the positioning angle. You can set nescapement and norientation to the same value.
Windows 95: nescapement specifies both the shift angle and positioning angle. You can set nescapement and norientation to the same value.
Norientation: Specifies the angle between the baseline of each character and the X axis of the device.
Fnweight: Specifies the font weight between 0 and 1000. For example, 400 indicates the standard body and 700 indicates the Black (thick) body. If this value is 0, the default weight is used.
For easy definition, you can use the following values:
Windows in the Middle East: hebrew_charsset; arabic_charset
Windows: thai_charset in Thailand
The character set specified by oem_charset is related to the operating system.
You can use the default_charset value to allow the font name and size to fully describe the logical font. If the specified font name does not exist, the font of any character set can replace the specified font. Therefore, use default_charset to avoid unexpected results.
The operating system contains fonts of other character sets. If an application Program With a font of an unknown character set, the application will not try to translate or interpret the character string written in that font.
This parameter is important in the font ing process. To ensure consistent results, specify a special character set. If a font name is specified in the lpszface parameter, check whether the fdwcharset value matches the font character set specified by lpszface.
Fdwoutputprecision: Specifies the output precision. The output precision is a matching program that matches the required font height, width, character location, shift, Character spacing, and character type. It can take one of the following values:
Out_character_precis; unused.
Out_default_precis: Specifies the default font ER status.
Out_device_precis: indicates that the font er selects a device font when multiple fonts in the system use the same font with the same name.
Out_outline_prcis: in Windows NT, this value indicates that the font er selects from TrueType and other border-based fonts.
Out_raster_precis: indicates that the font er selects a grating font when multiple fonts in the system use the same name.
Out_string_precis: this value is not used by the word er, but is returned when the scan font is listed.
Out_stroke_precis: in Windows NT, this value is not used by the font er, but is returned when the TrueType font, other border-based fonts, and Vector Fonts are listed.
Windows 95: this value is not used by the font er, but is returned when the TrueType font or vector font is listed.
Out_tt_only_precis: indicates that the font er selects only the TrueType font. If the TrueType font is not installed in the system, the default font ing status is returned. ,
Out_tt_precis: indicates that the font er selects a TrueType font when there are multiple fonts with the same name in the system.
When the operating system contains a variety of fonts with the same name as the specified name, the application can use the out_device_precis, out_raster_precis, and out_tt_precis values to control how the font er chooses a font. For example, if the operating system contains two fonts: the grating and TrueType, specify out_tt_precis to enable the font er to select the TrueType mode. Specify out_tt_only_precis to select a TrueType font for the font er, although this will change the TrueType font name.
Fdwclipprecision; specifies the cropping precision. The cropping precision defines how to crop a part of a character that exceeds the cropping area. It can take one or more of the following values:
Clip_default_precis: Specifies the default cropping status. Clip_character_precis: unused.
Clip_stroke_precis: it is not used by the font er, but is returned when the grating font, vector font, or TrueType font is listed. In Windows, to ensure compatibility, this value is always returned when the font is listed.
Clip_mask: unused. Clip_embedded: this flag is required to use an embedded read-only font.
Clip_lh_angles: When this value is used, the rotation of all fonts depends on the positioning of the coordinate system to the left or to the right.
If this value is not used, the font of the device is always rotated counterclockwise, but the rotation of other fonts depends on the orientation of the coordinate system. For more information about orientation of the coordinate system, see parameter orientation.
Clip_tt_always: unused.
Fdwquality: pointing to the output quality. The output quality defines how GDI carefully matches logical font attributes with actual physical font attributes. It can take one of the following values:
Default_quality: The font appearance is not important.
Draft_quality: The importance of the font appearance when proof_quality is used, the scaling ratio for the GDI grating font is active, which means multiple font sizes are available, but the quality may not be high. If necessary, the bold, italic, underline, and strikeout fonts can be combined.
Proof_quality: The character quality is more important than exact matching logical Font font attributes. Scan for the GDI font. The scaling ratio is active and select the nearest size. Although the selected font size does not exactly match when proof_quality is used, the font quality is high and there is no deformation on the appearance. If necessary, the bold, italic, underline, and strikeout fonts can be combined.
Fdwpitchandfamily: Specifies the font spacing and font family, and the low-end two specify the font Character spacing, which can be one of the following values:
Default_pitch; fixed_pitch; variable_pitch
The top four designated font family can have one of the following values:
Ff_decorative: novel fonts, such as Old English ). Ff_dontcare: Do not care or do not know.
Ff_mdern: font with fixed stroke width, with or without line. Such as pica, elite, and Courier New.
Ff_roman: font with a stroke width change, with a linefeed. For example, Ms serif.
Ff_script: it is designed to look like a handwritten font. Such as script and cursive.
Ff_swiss: The font with no diagonal lines when the stroke width changes. For example, Ms sans serif.
Applications can use the OR operator to combine the Character spacing and font family to assign values to fdwpitchandfamily.
The font family describes the common appearance of a font. When no precise words are available, they can be used to specify the font.
Lpszface: A string pointer to the font name ending with \ 0. the string length cannot exceed 32 characters (including \ 0 ), the enumfontfamilies function can be used to list the names of all currently available fonts.
If lpszface is null or points to an empty string, GDI uses the first font that matches other attributes.
Return Value: If the function call is successful, the return value is a logical font handle. If the function call fails, the return value is null.
Windows NT: To obtain more error information, call the getlasterror function.
Note: deleteobject can be used to delete a font that is no longer in use.
To protect the copyrights of sellers that provide fonts to Windows and Windows NT, Win32-based applications always list the exact names of the selected fonts. Because different systems use different fonts, do not consider the selected font as the required font. For example, if you require a font named palatino, but the system does not provide such a font, the font er will replace it with a different name but with similar attributes. The system always reports the selected fonts.
Quick query: Windows NT: 3.1 or later; windows: 95 or later; Windows CE: not supported; header file: wingdi. h; library file: gdi32.lib; UNICODE: Unicode and ANSI are implemented in Windows NT.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.