Windows program design Reading Notes-text and font

Source: Internet
Author: User
Tags textout

I. font type:

1. GDI font. Stored in hard disk files.

1.1 dot matrix font. It is also called a bitmap font. It is stored in the form of Bitmap pixels. Do not scale at will. The advantage is fast display and good readability. Each dot matrix font cannot exceed 6 types.

Example: system, fixedsys, terminal, courier, MS Serif, MS sans serif, small fonts

1.2 strokes. The advantage is random scaling, slow display, and poor readability of small fonts. Suitable for plotter.

Example: Modern, Roman, script

1.3 TrueType font, which can be infinitely scaled and used for video display and printer.

Example: Courier New..., Times New Roman..., Arial..., symol

2. device font. Inherent in the output device.

2. character output functions.

Settextalign (

Nflags) // Note: ta_updatecp indicates that all X and Y set in textout are invalid, but take the coordinates after the previous change.

Textout

Tabbedtextout

Exttextout

Drawtext

Drawtextex

Device description table:

Settextcolor

Setbkmode

Setbkcolor

Get the system color set by the user. getsyscolor (color_window ...)

CDC: settextcharacterextra // Character Spacing

SelectObject (HDC, getstockobject (system_font ))

Some functions:

Createfont or createfontindirect // create a font

Gettextface // get the font name

  Bool gettextmetrics (HDCHDC,LptextmetricLptm );// Obtain the current font information

  Bool gettextextentpoint32 (HDCHDC,LpctstrLpstring,IntCbstring,LpsizeLpsize ); // Obtain the string size.

Settextjustification (HDC, PRC-> right-PRC-> left-size. CX, cspacechars); // used for the two segments. The following cspacechars space must be evenly divided (PrC-> right-PRC-> left-size. (CX) space. After a row ends, use settextjustification (HDC, 0, 0) to eliminate the uplink errors.

Three, logfont structure, member Description: http://baike.baidu.com/view/2421591.html? Fromtaglist

You can use logfont to set many font information. Including font rotation. For example, LF. lforientation = 300; converts to 30 degrees.

GetObject (hfont, sizeof (logfont), & lf); // get logfont

Hfont = createfontindirect (& lf); // set logfont

Iv. enumfonts enumfontfamiliesex

5. Select a fontBool choosefont (lpchoosefontLpcf );

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.