<div dir=ltr>
Problem/Question/Abstract:
I was just wondering what the best way to save a particular font to the registry would be. Do I have to save each of its attributes separately? Is there an easier way than storing it to the registry, perhaps? Seems like such a simple issue, but other than saving and loading each attribute separately, I can't think of a way to do it at one time!

Answer:
You can do it by getting a TLogfont record filled and save that to a binary key:
var
lf&#58; TLogfont;
begin
fillchar&#40;lf, sizeof&#40;lf&#41;, 0&#41;;
GetObject&#40;font.handle, sizeof&#40;lf&#41;, @lf&#41;;
registry.WriteBinarydata&#40;valuename, lf, sizeof&#40;lf&#41;&#41;;
end;

Reading it back would go like this:
registry.ReadBinarydata&#40;valuename, lf, sizeof&#40;lf&#41;&#41;;
font.handle &#58;= CreateFontIndirect&#40;lf&#41;;

A probably more Kylix-compatible method would be to create a non-visual wrapper component for a TFont and stream that, e.g. to a memory stream. The streams content could then be saved to a binary registry key.
type
TFontWrapper = class&#40;TComponent&#41;
private
FFont&#58; TFont;
procedure SetFont&#40;f&#58; TFont&#41;;
public
constructor Create&#40;AOwner&#58; TComponent&#41;; override;
destructor Destroy; override;
published
property Font&#58; TFont read FFont write SetFont;
end;

constructor TFontWrapper.Create&#40;AOwner&#58; TComponent&#41;;
begin
inherited Create&#40;aOwner&#41;;
FFont &#58;= TFont.Create;
end;

destructor TFontWrapper.Destroy;
begin
FFont.Free;
inherited Destroy;
end;

procedure TFontWrapper.SetFont&#40;f&#58; TFont&#41;;
begin
FFont.Assign&#40;f&#41;;
end;

procedure TScratchMain.SpeedButton2Click&#40;Sender&#58; TObject&#41;;
const
b&#58; Boolean = False;
var
fw&#58; TFontWrapper;
st&#58; TFileStream;
begin
if b then
begin
edit1.text &#58;= 'Loading font';
fw &#58;= nil;
st &#58;= TFileStream.Create&#40;'E&#58;\A\test.str', fmOpenRead&#41;;
try
fw &#58;= TFontWrapper.Create&#40;nil&#41;;
st.ReadComponent&#40;fw&#41;;
memo1.font.assign&#40;fw.font&#41;;
finally
fw.Free;
st.Free;
end;
end
else
begin
edit1.text &#58;= 'Saving font';
fw &#58;= nil;
st &#58;= TFileStream.Create&#40;'E&#58;\A\test.str', fmCreate&#41;;
try
fw &#58;= TFontWrapper.Create&#40;nil&#41;;
fw.Font &#58;= Font;
st.WriteComponent&#40;fw&#41;;
finally
fw.Free;
st.Free;
end;
end;
b &#58;= not b;
end;

</div>