Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
delphi firemonkey添加自定义字体_Delphi_Firemonkey - Fatal编程技术网

delphi firemonkey添加自定义字体

delphi firemonkey添加自定义字体,delphi,firemonkey,Delphi,Firemonkey,我必须在firemonkey android应用程序上为我的标签添加自定义字体 所以在部署部分添加了新字体 并将FMX.fontlyphs.Android.pas更改为: FontFile := TPath.GetDocumentsPath + PathDelim + CurrentSettings.Family + '.ttf'; if FileExists(FontFile) then Typeface := TJTypeface.JavaClass.createFromFile(Str

我必须在firemonkey android应用程序上为我的标签添加自定义字体

所以在部署部分添加了新字体

并将
FMX.fontlyphs.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

为了检查字体是否存在,我在表单上添加了一个按钮来运行此操作,它显示“我
存在”

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;
项目树:

我假设“目标移动上存在”意味着您已调试并正在执行包含createFrom文件的行?不,我更新了字体Exix代码,如何检查是否执行
createFromFile
执行?使用调试程序,您不需要修改FMX源文件才能使用自定义字体。看和。@RemyLebeau我和你的例子一样。我的问题是为什么这对我的标签没有影响!?