Sign in Join
Wiki copytemporary

Font: what changed

Revision 2 to 3. 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
1313![](/wiki-images/f/f1/Font_height.png)
1414
1515Negative value takes into account only the height of font characters.
1616
1717Positive 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).
1818
1919Normally, you want to use Negative font height.
2020
2121### Name
2222
2323The name property defines the name of the font to be used.
2424
2525### Pitch
2626
2727This property determines the spacing between the letters. It may have one of the following values:
2828
2929- *fpDefault*
3030- *fpFixed*
3131- *fxVariable*
3232
3333### Size
3434
3535Is the size of the font in Typographic points.
3636
3737In order to convert from Typographic points to Pixels one should use a device (Screen or Printer) dots per point value (DPI)
3838
3939The size is also using Positive and Negative values, but in reverse order.
4040
4141Positive value takes into account only the height of font characters. (it's a typographic standard)
4242
4343Negative 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).
4444
4545Normally, you want to use Positive font size values.
4646
4747It might be useful to note, that User Interface is typically presenting the size in typographs points.
4848
4949![](/wiki-images/f/f4/Fontdialog.png)
5050
5151In this example, the selected font would have Font.Size=16
5252
5353#### Size to Height
5454
5555Once should use the following formal to convert from Size to height
5656
57-`Font.Height := -Font.Size * DPI / 72`
57+``` pascal
58+Font.Height := -Font.Size * DPI / 72
59+```
5860
5961and from Height to Size
6062
61-`Font.Size := -Font.Height / DPI * 72`
63+``` pascal
64+Font.Size := -Font.Height / DPI * 72
65+```
6266
6367Note, the use of negative , due to reverse logic.
6468
6569### Style
6670
6771Defines the style of the text to be displayed or printed.
6872
6973---
7074*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).*
7175Category: GUI
7276Category: LCL

Back to history