Delphi Firemonkey does not display fonts correctly

  

I’m building cross-platform desktop app with additional font (Abilene). On startup I check is the font installed and if it is not, I install it and use it. For Mac everything seems to be fine, but Windows version (and the IDE!!) does not display the font correctly. Here is the font installation procedure:

procedure InstallFont;
const
REG_NT = ‘SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts’;

var
Reg: TRegistry;
res: Boolean;
installName,FileName: UnicodeString;

begin
Reg := TRegistry.Create(KEY_ALL_ACCESS);
try
Reg.RootKey := HKEY_LOCAL_MACHINE;
res := Reg.OpenKey(REG_NT, False);
if not Res then Exit;

installName := ‘Abilene Regular (TrueType)’;
FileName:=ExtractFilePath(ParamCount(0)+’\Abilene.ttf’;
Reg.WriteString(installName, FileName);
Reg.CloseKey;
finally
Reg.Free;
end;

AddFontResourceW(PWideChar(FileName));
SendMessage(HWND_BROADCAST, WM_FONTCHANGE,0,0);
end;

After installing the font it is displayed as shortcut in the Control panel, but all other programs can use it. Even Delphi can, but with VCL, not FMX applications (see attached pictures). I’ve attached pictures from the IDE. In the runtime it’s the same.

Is there anything that must be done additionally for the font installation especially for FMX apps? Or this is just a bug which must be reported to Embarcaderro QC?

Edit: Adding some details: If I install the font by downloading it, clicking with the right mouse button and choose ‘Install’ then everything is OK. If I install it by my proc then the font is visible and usable for the whole world except the Delphi FMX. Delphi VCL can use it also. To test this I install ed the font with my proc in my %APPDATA% folder. Word, Excel, Delphi VCL can use it. Delphi FMX cannot.

Edit2: Added SendMessage(HWND_BROADCAST, WM_FONTCHANGE,0,0). No change.

Edit3: In the Font dialog the font is displayed correctly (image 3)

Comments are closed.