Jump to content
Sign in to follow this  
pro_imaj

Delphi fmx comes standard in iOS font

Recommended Posts

Hi,

I am using Edit and Label Segoe UI font in Delphi FMX project. While it looks properly on Windows, there are standard fonts on the ios side. How can I fix this.

 

* I was viewing correctly on my ios phone without any additional settings before. I am facing this problem after the macOS renewal but I think the problem is in Delphi.

I would appreciate your help.

 

Delphi: 10.3.3
macOS: 10.15.4
xcode: 11.4

Edited by pro_imaj

Share this post


Link to post

No, the problem is not with delphi, yo can see the full list of default font of the iOS https://developer.apple.com/fonts/system-fonts/

The current default font is Helvetica Neue. If you put a font family name that not exists, the iOS will load the Helvetica Neue font.

To avoid install custom font, the best you can do is find a similar default font to use in the iOS

  • Like 1

Share this post


Link to post
7 hours ago, vfbb said:

No, the problem is not with delphi, yo can see the full list of default font of the iOS https://developer.apple.com/fonts/system-fonts/

The current default font is Helvetica Neue. If you put a font family name that not exists, the iOS will load the Helvetica Neue font.

To avoid install custom font, the best you can do is find a similar default font to use in the iOS

Thank you for the answer.

 

But before I was developing with the same font without any problems, I published the applications to the app store and there was no problem.

If I apply the solution you said, I will have to deal with it while compiling to the android side at this time, whereas in the past, I was working smoothly with the same font on both windows and Andriod and iOS without doing anything like this.

 

* Now the problem is not only with this font, none of the fonts in Windows are not working by ios!

 

Thank you.

Share this post


Link to post
38 minutes ago, pro_imaj said:

But before I was developing with the same font without any problems, I published the applications to the app store and there was no problem.

Please indicate what you mean by "before", e.g. was it a different version of Delphi? Deploying to a device with a different version of iOS, if so, which version(s)? Were your applications deploying the custom fonts?

  • Like 1

Share this post


Link to post
16 minutes ago, Dave Nottage said:

Please indicate what you mean by "before", e.g. was it a different version of Delphi? Deploying to a device with a different version of iOS, if so, which version(s)? Were your applications deploying the custom fonts?

Hi,

 

Everything is the same on the Delphi side. I made the last updates on the macOS, Xcode and ios phone I saw the result.

 

macOs: 10.15.4
Xcode: 11.4
ios: 13.4.1

 

The app uses the Segoe UI font, before it was running by the macos without installing this font.

 

Thank you for the answer.

Share this post


Link to post

I formatted the computer, reinstalled everything but my problem is still not resolved.

 

Problem is this;
Delphi fmx uses Segoe UI as the standard font family, which is how I used the whole project. But macOs replaces this font with Helvetica Nue, which looks very bad.

Is there an easy way to make the Segoe UI the font of the project I compiled by macOs?

Edited by pro_imaj

Share this post


Link to post
1 hour ago, pro_imaj said:

Can you look at the project file I made in the annex

Your info.plist.TemplateiOS.xml file is incorrect. Instead of:

<key>Segoe UI</key>

It should be:

<key>UIAppFonts</key>

As per the article

Share this post


Link to post
7 hours ago, Dave Nottage said:

Your info.plist.TemplateiOS.xml file is incorrect. Instead of:


<key>Segoe UI</key>

It should be:


<key>UIAppFonts</key>

As per the article

Have you tried and seen the correct result?
It is also tried as you said, but the result is negative!

Share this post


Link to post
On 4/16/2020 at 7:00 PM, pro_imaj said:

Have you tried and seen the correct result?

Yes, as per the article.

 

Make sure you're actually deploying the font files (Project|Deployment in the Delphi IDE), and to the correct Remote Path. i.e:  .\

 

Also make sure that the entries in info.plist.TemplateiOS.xml match exactly with the actual filename - filenames are case sensitive on iOS.

  • Like 1

Share this post


Link to post
22 hours ago, Dave Nottage said:

Yes, as per the article.

 

Make sure you're actually deploying the font files (Project|Deployment in the Delphi IDE), and to the correct Remote Path. i.e:  .\

 

Also make sure that the entries in info.plist.TemplateiOS.xml match exactly with the actual filename - filenames are case sensitive on iOS.

Thank you for your answer.

 

My conclusion on this issue;
There is a mismatch problem between the latest version of Delphi (10.3.3) and the latest version of xcode. No problem when compiling the same project in older xcode versions.

So I think this problem will be solved when 10.4 is released. I spent all 10 days rebuilding everything including the computer to solve this problem and the final result I got was negative.

 

I am continuing the project. I will recompile the ios project with the new version in 10.4 version.

 

Thanks.

Share this post


Link to post
14 minutes ago, pro_imaj said:

There is a mismatch problem between the latest version of Delphi (10.3.3) and the latest version of xcode.

I'm using Delphi 10.3.3, the latest released version of Xcode (11.4), building against the latest iOS SDK (13.4) and it works on my iPhone X which has iOS 13.4.

 

I've attached my test project (which uses the Anton font, from here: https://fonts.google.com/specimen/Anton). Perhaps if you have a test project, you could attach it so it might be discovered what is going wrong.

 

 

CustomFontDemo.zip

  • Thanks 1

Share this post


Link to post
18 hours ago, Dave Nottage said:

I'm using Delphi 10.3.3, the latest released version of Xcode (11.4), building against the latest iOS SDK (13.4) and it works on my iPhone X which has iOS 13.4.

 

I've attached my test project (which uses the Anton font, from here: https://fonts.google.com/specimen/Anton). Perhaps if you have a test project, you could attach it so it might be discovered what is going wrong.

 

 

CustomFontDemo.zip

 

Hi,

 

You are super! The deficiency I made was the codes that you added to the button, and it worked without any problem.

But the problem is this; I already set the fonts of all objects to "Segoe UI" so there are too many forms and objects. The font of all objects such as edits, labels, grids, etc.

What is the easiest way to apply the code you collectively write on the ios side with the "Segoe UI" set on Delphi side.

 

Thank you for your attention.

Share this post


Link to post
6 hours ago, pro_imaj said:

The deficiency I made was the codes that you added to the button,

It also works for me just by having the Font.Family property in TextSettings set to the correct value (i.e. Anton) at design time. Using the button and code was just to demonstrate that there's a very obvious change in the font.

 

I suspect there's something else wrong with your project, which is why I asked to post a test case.

  • Like 1

Share this post


Link to post
40 minutes ago, Dave Nottage said:

It also works for me just by having the Font.Family property in TextSettings set to the correct value (i.e. Anton) at design time. Using the button and code was just to demonstrate that there's a very obvious change in the font.

 

I suspect there's something else wrong with your project, which is why I asked to post a test case.

Hi,

 

Sample file is attached. If it's normal without pressing the button, you should see the font automatically, but it doesn't.

 

Thanks.

 

Project1.zip

Share this post


Link to post
5 hours ago, pro_imaj said:

you should see the font automatically, but it doesn't.

That's because you have Family in the StyledSettings property set to True in the Object Inspector (i.e. at design time). You need to set it to False

Share this post


Link to post
4 hours ago, Dave Nottage said:

That's because you have Family in the StyledSettings property set to True in the Object Inspector (i.e. at design time). You need to set it to False

If I don't press the button, it didn't work!

 

style.PNG

Edited by pro_imaj

Share this post


Link to post

I see what the problem is now: it's because selecting Segoe UI at design-time results in the Family value not being stored in the .fmx, because it's the default for Windows.

 

I'd consider that a design fault, since it does not account for using a font with the same name on platforms other than Windows.

 

Easiest solution: use something that looks like Segoe UI, but isn't 🙂 Any other solution would seem a bit difficult..

  • Like 2

Share this post


Link to post
28 minutes ago, Dave Nottage said:

I see what the problem is now: it's because selecting Segoe UI at design-time results in the Family value not being stored in the .fmx, because it's the default for Windows.

 

I'd consider that a design fault, since it does not account for using a font with the same name on platforms other than Windows.

 

Easiest solution: use something that looks like Segoe UI, but isn't 🙂 Any other solution would seem a bit difficult..

Yes, I have determined it this way, but the interesting thing is that I had no problems with the same delphi version before, so the source of this problem seems to be xcode.

It is a very troublesome and unnecessary job that I will have to make a continuous loop for objects in each form to solve the problem 😞

Share this post


Link to post

While I can specify the text family with the code below on the VCL side, I could not find out how to do it on the FMX side, so I can solve the problem in this way!

 


Application.Initialize;
Application.DefaultFont.Name: = 'Segoe UI';

 

  • Like 1

Share this post


Link to post
13 hours ago, pro_imaj said:

I can solve the problem in this way!

Excellent! I was not aware of that property; thanks 🙂

 

Share this post


Link to post
4 hours ago, Dave Nottage said:

Excellent! I was not aware of that property; thanks 🙂

 

This property is valid for VCL.
Unfortunately this property is not on the FMX side 😞

Share this post


Link to post

Hi,

I solved the problem permanently, adding the project to pass the following file.

 

*I add that someone might need it in the future.

 

unit uFont;

interface

uses
  FMX.Platform, FMX.Graphics;

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

implementation




function TmyFMXSystemFontService.GetDefaultFontFamilyName: string;
begin
  Result := 'Segoe UI';
end;

function TmyFMXSystemFontService.GetDefaultFontSize: Single;
begin
  Result := 12;
end;

procedure InitFont;
begin
  if TPlatformServices.Current.SupportsPlatformService(IFMXSystemFontService) then
    TPlatformServices.Current.RemovePlatformService(IFMXSystemFontService);

  TPlatformServices.Current.AddPlatformService(IFMXSystemFontService, TmyFMXSystemFontService.Create);
end;

initialization

InitFont;

end.

 

 

  • Like 2
  • Thanks 1

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
Sign in to follow this  

×