Attribute or Styles in GDI+



This article has been excerpted from book "Graphics Programming with GDI+".

In typography, the combination of a typeface name (sometimes referred to as a face name) and a point size (sometimes referred to as the em size) represents a font. A typeface name is a combination of font family and the font style (also referred to as font attributes). Each typeface belongs to a font family such as Times News Roman, Arial, or Courier .The Courier family, for example, includes the typeface Courier New, Courier New Bold, and Courier New Italic.

Generally, when we talk about a font, we are referring to more than just one component. A typical font is combination of three components: font family, font style and font size. Figure 5.9 shows components of a typical font.

A complete example of font is "Times New Roman, size 10, Bold/Italic". Here the font family is Times New Roman, the size is 10-point, and the style is both bold and italic.

Font Height and Line Spacing

The size of a font is expressed in points, where a point is usually 1/72(0.013888) inch .The measurement of the size of a font is a little confusing because characters have different heights. If all alphabetic characters had the same height, it would be easier to calculate the size of font. For example, consider the characters b and q. Technically they have the same height (or size), but they are situated in different locations along a straight line. In other words, the character's size may not be the same as point size, also called em size. The font size is related to the line spacing. We will discuss line spacing in more detail in section 5.3.4.

Figure 5.9.gif

FIGURE 5.9: Font Components

Conclusion

Hope the article would have helped you in understanding Attribute or Styles in GDI+. Read other articles on GDI+ on the website.

bookGDI.jpg
This book teaches .NET developers how to work with GDI+ as they develop applications that include graphics, or that interact with monitors or printers. It begins by explaining the difference between GDI and GDI+, and covering the basic concepts of graphics programming in Windows.


Similar Articles
Mindcracker
Founded in 2003, Mindcracker is the authority in custom software development and innovation. We put best practices into action. We deliver solutions based on consumer and industry analysis.