Jump to content
SayWhat

Skia and default FontService

Recommended Posts

Currently I use a default font service to globally change font/font size. I found it somewhere on the interwebs a while back, and it is great as I no longer have to iterate through all the controls setting them on font change.


 

TDefaultFont = class(TInterfacedObject, IFMXSystemFontService)
public
    function GetDefaultFontFamilyName: string;
    function GetDefaultFontSize: Single;
end;


function TDefaultFont.GetDefaultFontFamilyName: string;
begin
  result := 'Segoe UI';
end;

function TDefaultFont.GetDefaultFontSize: Single;
begin
  result := 16.0;
end;


initialization

TFont.FontService := TDefaultFont.Create;

 

What I'm looking for is to the do same with skLabel, as this method doesn't work as the library uses TskTextSettings instead of TTextSettings. Any recommendations would be very helpful!

 

** EDIT **

 

We have custom controls that use TLabel's - which we swapped out for TskLabel's. We have unique requirements for text formatting that we had to use TCanvas for rendering. Swapping to TskLabels, we don't have to do that anymore!

 

Until we find a global solution, we added to the controls an internal TTextSettings that we pull the global default font values from then assign them to the corresponding skLabel properties. Of course, provided that the TStyledSettings aren't active for the respective property.

Edited by SayWhat

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×