Iām trying to find a way to globally change the font in a FireMonkey project. What is the easiest way to do it without having to change the font property for all the components? If there a way to set the font of an entire application or an entire form (like in VCL)?
Asked
Active
Viewed 3,145 times
5
-
what have you tried? It seems that the new XE2 "live bindings" system might be useful for doing things like this. ā Warren P Dec 18 '11 at 21:11
3 Answers
1
You should be able to do this with Duck Duck Delphi...
This would change all of the fonts for components on a form:
Form1.duck.all.on('Font').setTo('Name','Arial').setTo('Color',TAlphaColors.Red);
And I haven't tried it, but either of these "should" work for doing the same application-wide:
Application.duck.all.each.on('Font').setTo('Name','Arial').setTo('Color',TAlphaColors.Red);
Screen.duck.all.each.on('Font').setTo('Name','Arial').setTo('Color',TAlphaColors.Red);
Duck Duck Delphi can be found here:

Jason Southwell
- 351
- 2
- 9
-
Broken link. Now appears to reside at: https://github.com/deadserious/duckduckdelphi. But not updated in 5 years? ā Dave Nottage Jan 31 '19 at 04:23
1
FireMonkey styles are the way to do this. Note that the VCL way of doing things with ParentXXX
is not offered in FMX.
This article covers the topic in some detail.

David Heffernan
- 601,492
- 42
- 1,072
- 1,490
0
Just to set a new TFont.FontService , you can change default font size and
family
unit ChangeDefaultFont;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes,FMX.graphics;
type
TDefaultFont = class (TInterfacedObject, IFMXSystemFontService)
public
function GetDefaultFontFamilyName: string;
function GetDefaultFontSize: Single;
end;
implementation
{ TDefaultFont }
function TDefaultFont.GetDefaultFontFamilyName: string;
begin
Result := 'Tahoma';
end;
function TDefaultFont.GetDefaultFontSize: Single;
begin
Result := 26.0;
end;
initialization
TFont.FontService := TDefaultFont.Create;
end.

SunYu
- 1