How to use VC to make rotary fonts

zhaozj2021-02-16  77

When programming in a Windows environment, we may sometimes want to make the font to rotate, so how to implement it? We know that the display in the Windows environment is that the GDI object is performed by the device description table, and the font object is one of the GDI objects. In fact, different fonts under Windows are output by selecting different logical fonts. Therefore, the rotating font is just a class of special logical fonts. As with other GDI objects (such as brush, palette), font objects not only have inherent fonts, but we can also establish a rotating logical font, then select the device description table. The following is an example of a VC 6.0 environment. The class corresponding to the font object in VC 6.0 is the CFont class. The CFont class has a member function createFont, and the logical font can be created with this function. This function is defined as follows: BOOL CreateFont (int nHeight, int nWidth, int nEscapement, int nOrientation, int nWeight, BYTE bItalic, BYTE bUnderline, BYTE cStrikeOut, BYTE nCharSet, BYTE nOutPrecision, BYTE nClipPrecision, BYTE nQuality, BYTE nPitchAndFamily, LPCTSTR lpszFacename) The meaning of each parameter is as follows: NHEIGHT // font The height of the nwidth // font of the NWIDTH // font of the NESCAPEMENT // font rotation of the Nweight // The light weight of the nweight // font is a slope BunderLine / / whether there is underline cstrikeout // Emphasis line ncharset // character set NOUTPRECISION / / output accuracy nclipprecision // Tailing accuracy nquitalfamily // Pitch and font family LPSZFACENAME // Font Name, can easily use these parameters, convenient setting various font parameters , Such as height, width, etc. Perhaps the people have already seen, in these parameters, the problem with the problem we want to discuss is Nescapement, which indicates the rotation angle between the baseline of the character, starting from the X-axis positive direction to the counterclockwise. The direction is rotated, in a very one of them. LPSZFACENAME specifies the name of the font, such as "Song", "Run". It should be pointed out that individual fonts do not support font rotation, mainly the type of font width. With these foundations, the font rotation is a simple matter.

转载请注明原文地址:https://www.9cbs.com/read-13704.html

New Post(0)