Reference: MSEgui/TFont: what changed
Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.
Title: Reference: MSEgui/TFont
| Old | New | Line | |
|---|---|---|---|
| 1 | + | # TFont | |
| 2 | + | ||
| 3 | + | The font of text. Ancestor of classes like TWidgetFont; | |
| 4 | + | ||
| 5 | + | ## Reference | |
| 6 | + | ||
| 7 | + | ### Hierarchy | |
| 8 | + | ||
| 9 | + | - TObject | |
| 10 | + | - TPersistent | |
| 11 | + | - TVirtualPersistent | |
| 12 | + | - TNullInterfacedPersistent | |
| 13 | + | - TLinkedPersistent | |
| 14 | + | - TLinkedOptionalPersistent | |
| 15 | + | - TFont | |
| 16 | + | ||
| 17 | + | ### Properties | |
| 18 | + | ||
| 19 | + | #### Colors | |
| 20 | + | ||
| 21 | + | You can specify the Color of the text and it's background color. If you can select text on the widget (for example at TMemoEdit), you can also sepcify the Color of the selected text and it's background color. | |
| 22 | + | ||
| 23 | + |  | |
| 24 | + | ||
| 25 | + | #### Extraspace | |
| 26 | + | ||
| 27 | + | Specifys the distance between the lines; accept negative values too. | |
| 28 | + | ||
| 29 | + |  | |
| 30 | + | ||
| 31 | + | #### Gloss and Shadow | |
| 32 | + | ||
| 33 | + | Gloss and shadow both duplicate the character and move the copy the specified number of pixels. By default gloss is left and over the original character, and shadow is right and below it. If you habe both, gloss and shadow, the "layer" of gloss is over the layer of shadow. The top layer is always the original character. | |
| 34 | + | ||
| 35 | + | If the widget is grayed (enabled = false or textflags = \[tf_grayed\]), neither gloss nor shadow is visible. | |
| 36 | + | ||
| 37 | + |  | |
| 38 | + | ||
| 39 | + | ``` pascal | |
| 40 | + | property Shadow_Solor: colorty default cl_none; | |
| 41 | + | property Shadow_ShiftX: integer default 1; | |
| 42 | + | property Shadow_ShiftY: integer default 1; | |
| 43 | + | ||
| 44 | + | property Gloss_Color: colorty cl_none; | |
| 45 | + | property Gloss_ShiftX: integer -1; | |
| 46 | + | property Gloss_ShiftY: integer -1; | |
| 47 | + | ``` | |
| 48 | + | ||
| 49 | + | #### Height, Width and XScale | |
| 50 | + | ||
| 51 | + | The propterty Height defines the size of the font in pixels. To define the horizontal stretching of the font you can use Width or XScale. Width defines the average char width in 1/10 pixels, so it's indepently of the height - if you change the height, the relations of width to height changes too. | |
| 52 | + | ||
| 53 | + | With the usage of xscale then ratio of width to height stays constant if you're changing height. If the XScale is 1, Width is used, with all other values of XScale XScale is used. | |
| 54 | + | ||
| 55 | + |  | |
| 56 | + | ||
| 57 | + | ``` pascal | |
| 58 | + | property Height: integer; | |
| 59 | + | property Width: integer; //avg. character width in 1/10 pixel, 0 = default | |
| 60 | + | property xscale: real;//default 1.0 | |
| 61 | + | ``` | |
| 62 | + | ||
| 63 | + | #### Grayed | |
| 64 | + | ||
| 65 | + | You can specify how the Font looks like if the widget is grayed (e.g. enabled = false). | |
| 66 | + | ||
| 67 | + |  | |
| 68 | + | ||
| 69 | + | ``` pascal | |
| 70 | + | property grayed_color: colorty; //default cl_grayed | |
| 71 | + | property grayed_colorshadow: colorty; //default cl_grayedshadow | |
| 72 | + | property grayed_shiftx: integer default 1; | |
| 73 | + | property grayed_shifty: integer default 1; | |
| 74 | + | ``` | |
| 75 | + | ||
| 76 | + | #### Template and LocalProps | |
| 77 | + | ||
| 78 | + | You can assign Template to a TFontComp-instance to take the font settings of this non-visual component. | |
| 79 | + | ||
| 80 | + | If a special property of TFont should not specified by Template but the local TFont-settings, use LocalProps to except this property of template settings for this widget. Note, that at design time always the local settings are applied, and at runtime only if LocalProps is set correctly (not sure if a bug or a feature...). | |
| 81 | + | ||
| 82 | + | ``` pascal | |
| 83 | + | fontlocalpropty = ( | |
| 84 | + | flp_color,flp_colorbackground,flp_colorselect,flp_colorselectbackground, | |
| 85 | + | flp_shadow_color,flp_shadow_shiftx,flp_shadow_shifty, | |
| 86 | + | flp_gloss_color,flp_gloss_shiftx,flp_gloss_shifty, | |
| 87 | + | flp_grayed_color,flp_grayed_colorshadow,flp_grayed_shiftx,flp_grayed_shifty, | |
| 88 | + | flp_style,flp_xscale,flp_height,flp_width,flp_extraspace,flp_name,flp_charset, | |
| 89 | + | flp_options | |
| 90 | + | ); | |
| 91 | + | fontlocalpropsty = set of fontlocalpropty; | |
| 92 | + | ||
| 93 | + | property LocalProps: fontlocalpropsty; | |
| 94 | + | property Template: TFontComp; | |
| 95 | + | ``` | |
| 96 | + | ||
| 97 | + | #### Options | |
| 98 | + | ||
| 99 | + | You can't combine all options. There are 3 group who are mutually exclusive: | |
| 100 | + | ||
| 101 | + | - foo_fixed and foo_proportional | |
| 102 | + | - foo_helvetica, foo_roman, foo_script and foo_decorative | |
| 103 | + | - foo_antialiased, foo_antialiased2 and foo_nonantialiased | |
| 104 | + | ||
| 105 | + |  | |
| 106 | + | ||
| 107 | + |  | |
| 108 | + | ||
| 109 | + | ``` pascal | |
| 110 | + | fontoptionty = (foo_fixed, // 'p' | |
| 111 | + | foo_proportional, // 'P' | |
| 112 | + | foo_helvetica, // 'H' | |
| 113 | + | foo_roman, // 'R' | |
| 114 | + | foo_script, // 'S' | |
| 115 | + | foo_decorative, // 'D' | |
| 116 | + | foo_antialiased, // 'A' | |
| 117 | + | foo_antialiased2, // 'B' cleartype on windows | |
| 118 | + | foo_nonantialiased // 'a' | |
| 119 | + | ); | |
| 120 | + | fontoptionsty = set of fontoptionty; | |
| 121 | + | ||
| 122 | + | property Options: fontoptionsty; | |
| 123 | + | ``` | |
| 124 | + | ||
| 125 | + | #### Style | |
| 126 | + | ||
| 127 | + | The Styles of the font. | |
| 128 | + | ||
| 129 | + | If you use fs_italic with TLabel (perhaps other widgets too), the last char may be cropped; You can remove ow1_autowidth of OptionsWidget1 and size the widget manually. Der better way is to enlarge Frame.Framei_right. | |
| 130 | + | ||
| 131 | + |  | |
| 132 | + | ||
| 133 | + | ``` pascal | |
| 134 | + | fontstylety = (fs_bold, fs_italic, fs_underline, fs_strikeout, fs_selected, fs_blank, fs_force); | |
| 135 | + | fontstylesty = set of fontstylety; | |
| 136 | + | ||
| 137 | + | property Style: fontstylesty default []; | |
| 138 | + | ``` | |
| 139 | + | ||
| 140 | + | ### Methods | |
| 141 | + | ||
| 142 | + | #### Scale | |
| 143 | + | ||
| 144 | + | With the Method Scale you can change Height and Width simultaneously. | |
| 145 | + | ||
| 146 | + | ``` pascal | |
| 147 | + | procedure Scale(const ascale: real); virtual; | |
| 148 | + | ``` | |
| 149 | + | ||
| 150 | + | ### Events | |
| 151 | + | ||
| 152 | + | #### OnChange | |
| 153 | + | ||
| 154 | + | Fired, when a propoerty changes. | |
| 155 | + | ||
| 156 | + | ``` pascal | |
| 157 | + | property OnChange: notifyeventty; | |
| 158 | + | ``` | |
| 159 | + | ||
| 160 | + | ## known issues | |
| 161 | + | ||
| 162 | + | ### issues of the class | |
| 163 | + | ||
| 164 | + | - fs_italic needs with TLabel (may be other widgets too) manually extension of Width or enlarging of Frame.framei_right. | |
| 165 | + | ||
| 166 | + | ### issues of this documentation | |
| 167 | + | ||
| 168 | + | Feel free to add your points here. | |
| 169 | + | ||
| 170 | + | - What does Font.Styles fs_force ? (Answered on MailingList, but answer not integrated here) | |
| 171 | + | ||
| 172 | + | --- | |
| 173 | + | *From the Free Pascal wiki, page "Reference: MSEgui/TFont", as it stood on 2020-02-25 after a change by Trev, 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).* | |
| 174 | + | Category: MSEide+MSEgui |
