Bonjour, j'aimerais convertir un TFont enTGPFont.

J'ai trouvé ca :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function TButtonCustom.FontToTGPFont(DFont:TFont):TGPFont;
var
  GPFontFamily:TGPFontFamily;
begin
  GPFontFamily := TGPFontFamily.Create(DFont.Name);
  Result := TGPFont.Create(GPFontFamily, DFont.Size, GetGPFontStyle(DFont.Style));
end;
 
function TButtonCustom.GetGPFontStyle(AFontStyles: TFontStyles): Integer;
begin
  if fsStrikeOut in AFontStyles then
    Result := 8
  else if fsUnderline in AFontStyles then
    Result := 4
  else if (fsBold in AFontStyles) and (fsItalic in AFontStyles) then
    Result := 3
  else if fsItalic in AFontStyles then
    Result := 2
  else if fsBold in AFontStyles then
    Result := 1
  else
    Result := 0;
  {FontStyleRegular    = Integer(0);
   FontStyleBold       = Integer(1);
   FontStyleItalic     = Integer(2);
   FontStyleBoldItalic = Integer(3);
   FontStyleUnderline  = Integer(4);
   FontStyleStrikeout  = Integer(8);}
end;
Mais j'ai l'impression que ca ne colle pas exactement.
Quelqu'un a une idée?