Sign in Join
Wiki copytemporary

Font: what changed

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

OldNewLine
11TFont class describes a typographic font information. The [[LCL]] defines the following [[Property|properties]]:
22
33### Color
44
55Sets the [[Colors|colour]] of the text to be displayed.
66
77### Height
88
99The height property specifies the font height in Pixels.
1010
1111However, due to Windows and Delphi compatibility, height might be described in 2 values, negative and positive.
1212
13-<figure>
14-<img src="font_height.png" title="font_height.png" />
15-<figcaption>font_height.png</figcaption>
16-</figure>
13+![](/wiki-images/f/f1/Font_height.png)
1714
1815Negative value takes into account only the height of font characters.
1916
2017Positive 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).
2118
2219Normally, you want to use Negative font height.
2320
2421### Name
2522
2623The name property defines the name of the font to be used.
2724
2825### Pitch
2926
3027This property determines the spacing between the letters. It may have one of the following values:
3128
3229- *fpDefault*
3330- *fpFixed*
3431- *fxVariable*
3532
3633### Size
3734
3835Is the size of the font in Typographic points.
3936
4037In order to convert from Typographic points to Pixels one should use a device (Screen or Printer) dots per point value (DPI)
4138
4239The size is also using Positive and Negative values, but in reverse order.
4340
4441Positive value takes into account only the height of font characters. (it's a typographic standard)
4542
4643Negative 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).
4744
4845Normally, you want to use Positive font size values.
4946
5047It might be useful to note, that User Interface is typically presenting the size in typographs points.
5148
52-<figure>
53-<img src="fontdialog.png" title="|toto" />
54-<figcaption>|toto</figcaption>
55-</figure>
49+![](/wiki-images/f/f4/Fontdialog.png)
5650
5751In this example, the selected font would have Font.Size=16
5852
5953#### Size to Height
6054
6155Once should use the following formal to convert from Size to height
6256
6357`Font.Height := -Font.Size * DPI / 72`
6458
6559and from Height to Size
6660
6761`Font.Size := -Font.Height / DPI * 72`
6862
6963Note, the use of negative , due to reverse logic.
7064
7165### Style
7266
7367Defines the style of the text to be displayed or printed.
7468
7569---
7670*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).*
7771Category: GUI
7872Category: LCL

Back to history