Sign in Join
Wiki copytemporary

Font: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: Font

OldNewLine
1+TFont class describes a typographic font information. The [[LCL]] defines the following [[Property|properties]]:
2+
3+### Color
4+
5+Sets the [[Colors|colour]] of the text to be displayed.
6+
7+### Height
8+
9+The height property specifies the font height in Pixels.
10+
11+However, due to Windows and Delphi compatibility, height might be described in 2 values, negative and positive.
12+
13+<figure>
14+<img src="font_height.png" title="font_height.png" />
15+<figcaption>font_height.png</figcaption>
16+</figure>
17+
18+Negative value takes into account only the height of font characters.
19+
20+Positive value takes into account height of font characters plus additional space on top of the font. (So, it would be possible to write a line of the text right after another, without adding any extra space, and the font would not look too densed).
21+
22+Normally, you want to use Negative font height.
23+
24+### Name
25+
26+The name property defines the name of the font to be used.
27+
28+### Pitch
29+
30+This property determines the spacing between the letters. It may have one of the following values:
31+
32+- *fpDefault*
33+- *fpFixed*
34+- *fxVariable*
35+
36+### Size
37+
38+Is the size of the font in Typographic points.
39+
40+In order to convert from Typographic points to Pixels one should use a device (Screen or Printer) dots per point value (DPI)
41+
42+The size is also using Positive and Negative values, but in reverse order.
43+
44+Positive value takes into account only the height of font characters. (it's a typographic standard)
45+
46+Negative value takes into account height of font characters plus additional space on top of the font. (So, it would be possible to write a line of the text right after another, without adding any extra space, and the font would not look too dense).
47+
48+Normally, you want to use Positive font size values.
49+
50+It might be useful to note, that User Interface is typically presenting the size in typographs points.
51+
52+<figure>
53+<img src="fontdialog.png" title="|toto" />
54+<figcaption>|toto</figcaption>
55+</figure>
56+
57+In this example, the selected font would have Font.Size=16
58+
59+#### Size to Height
60+
61+Once should use the following formal to convert from Size to height
62+
63+`Font.Height := -Font.Size * DPI / 72`
64+
65+and from Height to Size
66+
67+`Font.Size := -Font.Height / DPI * 72`
68+
69+Note, the use of negative , due to reverse logic.
70+
71+### Style
72+
73+Defines the style of the text to be displayed or printed.
74+
75+---
76+*From the Free Pascal wiki, page "Font", as it stood on 2020-03-29 after a change by Jwdietrich, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
77+Category: GUI
78+Category: LCL

Back to history