是否是TrueType字体

  • 主题发起人 主题发起人 import
  • 开始时间 开始时间
I

import

Unregistered / Unconfirmed
GUEST, unregistred user!
判断TrueType字体
 
function IsTrueTypeFont(FontName : string) : boolean;
const
PITCH_MASK: byte = $0F;
var
TxMetric: TTextMetric;
TempCanvas : TCanvas;
PitchTest : byte;
begin
TempCanvas := TCanvas.Create;
TempCanvas.Handle := CreateCompatibleDC(0));
TempCanvas.Font.Name := FontName;
GetTextMetrics(TempCanvas.Handle, TxMetric);
PitchTest := TxMetric.tmPitchAndFamily and PITCH_MASK;
Result := ((PitchTest and TMPF_TRUETYPE) <> 0));
TempCanvas.free;
end;
 

Similar threads

后退
顶部