字体文件c语言,GetFontResourceInfo 函数: 获取字体文件对应的字体名

在 win 7, gdi32.dll,找不到 GetFontResourceInfo(), 但能找到 GetFontResourceInfoW(), 用法类似。

//--------------------------------------------------------------------------------------------------------------------------------------------------

//---------------------------------------------------------------------------------------------------------------------------------------------------

GetFontResourceInfo

The GetFontResourceInfo function retrieves information from a font resource file.

BOOL GetFontResourceInfo(

LPCTSTR lpszFilename, // font file name

LPDWORD cbBuffer, // size of buffer for resouce information

LPVOID lpBuffer, // buffer for returned resouce information

DWORD dwQueryType, // resouce information query type

);

Parameters

lpszFilename

[in] Pointer to a null-terminated character string that contains a valid font file name. This parameter can specify any of the following files. File extension Description .fon Font resource file. .fnt Raw bitmap font file. .ttf Raw TrueType file. .ttc East Asian Windows: TrueType font collection. .fot TrueType resource file. .otf PostScript OpenType font. .mmm multiple master Type1 font resource file. It must be used with .pfm and .pfb files. .pfb Type 1 font bits file. It is used with a .pfm file. .pfm Type 1 font metrics file. It is used with a .pfb file.

To add a font whose information comes from several resource files, point lpszFileName to a string with the file names separated by a | –for example, abcxxxxx.pfm | abcxxxxx.pfb.

cbBuffer

[in,out] Specifies the length, in bytes, of the information to be retrieved. If this parameter is zero, GetFontResourceInfo returns the size of the data specified in the dwQueryType parameter.

lpBuffer

[out] Pointer to a buffer that receives the font information. If this parameter is NULL, the function returns the size of the buffer required for the font data.

dwQueryType

Specifies the type of resouce information to return. This parameter can be one of the following values.

ValueMeaning

QFR_0

0

DWORD or LPVOID

unknown

QFR_DESCRIPTION

1

The function provides a string that an NT-based operating system will use to describe the font file. A null-terminated Unicode string is written to the buffer pointed to by lpBuffer.

QFR_LOGFONT

2

Array of LOGFONT

QFR_PDEV

3

PDEV ?

QFR_FONTFILE

4

scalable font file name

QFR_5

5

DWORD

Windows XP: Always returns 0

Return Values

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero.

Windows NT/2000/XP: To get extended error information, call GetLastError.

Remarks

When 4 is specified in dwQueryType and lpszFilename specifies a FOT file, then lpBuffer returns the file name of the linked .ttf file.

Requirements

Windows NT/2000/XP: Included in Windows NT ? and later.

Windows 95/98/Me: Included in Windows ? and later.

Header: Declared in Wingdi.h; include Windows.h.

Library: Use Gdi32.lib.

Unicode: Implemented as Unicode and ANSI versions on Windows NT/2000/XP

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值