我必须在firemonkey android应用上为标签添加自定义字体
因此在部署部分添加了新字体
,并将FMX.FontGlyphs.Android.pas
更改为此:
FontFile := TPath.GetDocumentsPath + PathDelim + CurrentSettings.Family + '.ttf';
if FileExists(FontFile) then
Typeface := TJTypeface.JavaClass.createFromFile(StringToJString(FontFile))
else
Typeface := TJTypeface.JavaClass.Create(FamilyName,Typefaceflag);
然后 我将字体添加到标签中
Label1.StyledSettings := Label1.StyledSettings - [TStyledSetting.Family]
Label1.TextSettings.Font.Family := 'IRANSansMobile';
已部署并存在于目标移动设备上的字体文件,但标签字体完全没有更改!
我的代码怎么了?!
uodate
要检查字体是否存在,我在表单上添加了一个按钮来运行它,它说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;