In VCL
, I could load a font from resource and without saving it I could use it from memory.
Here is the code I use and it works in VCL
:
procedure TForm1.Button1Click(Sender: TObject);
var
ResStream : tResourceStream;
FontsCount : DWORD;
begin
ResStream := tResourceStream.Create(hInstance, 'MyResourceName', RT_RCDATA);
winapi.windows.AddFontMemResourceEx(ResStream.Memory, ResStream.Size, nil, @FontsCount);
ResStream.Free();
button1.Font.name := 'MySavedFontNameInResource';
end;
In Firemonkey I just changed button1.Font.name
to button1.Font.family
but unfortunately the font didn't change. So I think this code is not compatible with firemonkey.
So in Firemonkey, how can I load a font from resource and save it temporary to memory and use it directly from there?
Update:
I saw these pages: Install font in firemonkey, How to use external fonts?
According to Mr Ed 's answer, it seems that there is no solution for this problem in FMX. But maybe we could load the font if we install it before running the app. I tried almost everything but I still can't load the the font.