Defines a TFont descendant class for defining a font which is a derivative of another thing. For example, say you wanted to have a Title Font which is based on the normal Font for your component except it is bold. You can use this class to define that derivative font and set it up to automatically update its characteristics as the normal Font changes.
The TRSCustomDeltaFont class provides a font class which tracks what characteristics of the font have changed from an original font. When the original font changes, you call the UpdateNonDelta method of the TRSCustomDeltaFont and pass in the original font.
The TRSCustomDeltaFont class does not publish any new properties so it can be used interchangeably with the TFont class. The FMX.RS.DeltaFont.TRSDeltaFont class published the Deltas property.
To use the TRSCustomDeltaFont class, you need to perform three steps:
• Create the Delta Font class for your component
• Hook up the DeltaFont to your original font using the OnGetOriginalFont event.
• Call the UpdateNonDelta method when the original font changes.
Namespace: FMX.RS.DeltaFont
TFont |
Delphi |
type |
|
|
|
|
Create the Delta Font class for your component: Delphi |
constructor TMyControl.Create(AOwner: TComponent); |
Hook up the DeltaFont to your original font using the OnGetOriginalFont event:
Delphi
procedure TMyControl.GetOriginalFont(Sender: TObject;
var Font: TFont);
begin
Font := Self.Font;
end;
Call the UpdateNonDelta method when the original font changes:
Delphi
procedure TMyControl.FontChanged;
begin
inherited FontChanged;
if FTitleFont <> nil then
(FTitleFont as TRSCustomDeltaFont).UpdateNonDelta(Font);
end;