delphi firemonkey add custom font

  

i have to add a custom font for my labels on my firemonkey android app

so added new font in deployment section

and changed the FMX.FontGlyphs.Android.pas to this:

FontFile := TPath.GetDocumentsPath + PathDelim + CurrentSettings.Family + ‘.ttf’;
if FileExists(FontFile) then
Typeface := TJTypeface.JavaClass.createFromFile(StringToJString(FontFile))
else
Typeface := TJTypeface.JavaClass.Create(FamilyName, TypefaceFlag);

then
i added the font to my label

Label1.StyledSettings := Label1.StyledSettings – [TStyledSetting.Family]
Label1.TextSettings.Font.Family := ‘IRANSansMobile’;

the font file deployed and exists on target mobile but label fonts not changed at all!

whats wrong with my code?!

uodate

for check if the font exists i added a button on form to run this and it saies me exists

procedure TForm1.Button1Click(Sender: TObject);
var FontFile : string;
begin
FontFile := TPath.Combine( TPath.GetDocumentsPath , ‘IRANSansMobile.ttf’);
if FileExists(FontFile) then
showmessage(‘exists’)
else
showmessage(‘not exists’);
end;

project tree:

Comments are closed.