There is a sample code in How to check which character sets (codepages) font supports (has letters for)? on getting characters sets using GetGlyphIndices function, but it does not say anything how to call it, particularly how to assign a font to dc. Can someone help with this?
In VCL, the TCanvas.Handle
is the HDC of the canvas.
For instance, a TBitmap
has Canvas.Handle
. Your main form also has a Canvas.Handle
.
var
bm: TBitmap;
begin
bm := TBitmap.Create;
try
bm.Canvas.Font.Name := 'Segoe UI';
// Now you can use bm.Canvas.Handle as your HDC value
finally
bm.Free;
end;
or
procedure TForm1.FormPaint(Sender: TObject);
begin
Canvas.Font.Name := 'Segoe UI';
// Canvas.Handle is your HDC
end;