Detailed explanation of the CreateFontW font creation function in VS2019 MFC

The CreateFontW function is a Windows API function used for creating fonts, and can also be used in MFC to create fonts. The detailed explanation of the function is as follows:

Prototype of function:
HFONT CreateFontW(
int height,
int width,
int escapement,
int orientation,
int weight,
DWORD italic,
DWORD underline,
DWORD strikeOut,
DWORD charSet,
DWORD outputPrecision,
DWORD clipPrecision,
DWORD quality,
DWORD pitchAndFamily,
LPCWSTR faceName
);

Interpretation of parameters:

  1. nHeight: The height of the font characters can be either a positive value for pixel height or a negative value for device unit height.
  2. nWidth: The character width of the font can be a positive or negative value, with positive values indicating pixel width and negative values indicating device unit width. In most cases, setting it to 0 is sufficient.
  3. The nEscapement parameter determines the italic angle of the font characters, with a default value of 0 representing no slant.
  4. Orientation: The angle at which characters of the font are rotated (in increments of 0.1 degrees), with a default of 0 indicating no rotation.
  5. FW_DONTCARE: Do not care about the thickness of the font.
  6. FW_THIN: Thin font.
  7. FW_NORMAL: Regular font.
  8. FW_BOLD: bold text.
  9. FW_BLACK: Black font.
  10. Other customized font thickness options.
  11. Incorrect: Do not use italics.
  12. TRUE: Use italics.
  13. FALSE: There are no underlines.
  14. TRUE: There are underlines.
  15. INCORRECT: There is no strikethrough.
  16. TRUE: has a strikethrough.
  17. ANSI_CHARSET: ANSI character set.
  18. DEFAULT_CHARSET: the default character set.
  19. Symbol character set: a set of symbols.
  20. Other custom character sets.
  21. Default precision.
  22. String precision.
  23. Character precision.
  24. Pen stroke precision.
  25. TrueType precision.
  26. OUT_DEVICE_PRECIS: Device Precision.
  27. Raster precision.
  28. Precision using only TrueType fonts.
  29. Outline precision.
  30. CLIP_DEFAULT_PRECIS: Default cropping.
  31. Clip character precisely.
  32. Clip stroke trimming.
  33. CLIP_MASK: Clipping mask.
  34. CLIP_LH_ANGLES: crop the top left and bottom right corners.
  35. Always clip TrueType fonts.
  36. EMBEDDED CLIPPING: An embedded cut.
  37. The default quality setting.
  38. Draft quality: the quality of a rough draft.
  39. PROOF_QUALITY: the quality of proofreading.
  40. NONANTIALIASED_QUALITY: Quality without anti-aliasing.
  41. Antialiased quality: high-quality edge smoothing.
  42. fdwPitchAndFamily: The spacing and family of the font. The spacing can
广告
Closing in 10 seconds
bannerAds