您的位置:首页 > 其它

GDI+ 学习记录(24) 输出文本3

2010-12-08 20:02 423 查看


//获取字体信息
var
fontFamily: TGPFontFamily;
font: TGPFont;
begin
fontFamily := TGPFontFamily.Create('宋体');
font := TGPFont.Create(fontFamily, 9, FontStyleRegular, UnitPixel);

ShowMessage(FloatToStr(font.GetSize));                             {字号大小}
ShowMessage(IntToStr(fontFamily.GetEmHeight(FontStyleRegular)));   {字体高度, 采用设计时单位}
ShowMessage(IntToStr(fontFamily.GetLineSpacing(FontStyleRegular)));{行间距, 采用设计时单位}
ShowMessage(IntToStr(fontFamily.GetCellAscent(FontStyleRegular))); {上升距, 采用设计时单位}
ShowMessage(IntToStr(fontFamily.GetCellDescent(FontStyleRegular)));{下降距, 采用设计时单位}

font.Free;
fontFamily.Free;
end;




//获取已安装字体的列表
var
fonts: TGPFontCollection;
fArr: array of TGPFontFamily;
count,ti: Integer;
s: string;
i: Integer;
begin
fonts := TGPInstalledFontCollection.Create;
count := fonts.GetFamilyCount;

SetLength(fArr, count);

for i := 0 to count - 1 do
begin
fArr[i] := TGPFontFamily.Create;
end;

fonts.GetFamilies(count, fArr, ti);

Memo1.Clear;
for i := 0 to count - 1 do
begin
fArr[i].GetFamilyName(s);
Memo1.Lines.Add(s);
fArr[i].Free;
end;

fonts.Free;
end;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: