zoukankan      html  css  js  c++  java
  • GetFontResourceInfo 函数: 获取字体文件对应的字体名

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

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

    另外看到一篇,通过读取字体文件,分析结构,找到字体名: https://bbs.csdn.net/topics/390317612?list=3482466

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

    来源:http://www.undocprint.org/winspool/getfontresourceinfo

    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 

  • 相关阅读:
    iOS项目中的网络请求和上下拉刷新封装
    iOS 自定义转场动画浅谈
    python中通过xlwt、xlrd和xlutils操作xls
    Python: PS 滤镜--水波特效
    Python: PS 滤镜--旋涡特效
    Python: PS 滤镜--USM 锐化
    Python: PS 滤镜--素描
    Python: PS 图像调整--饱和度调整
    Python: PS 图像特效 — 模糊玻璃
    Python: PS 滤镜--表面模糊
  • 原文地址:https://www.cnblogs.com/personnel/p/10643771.html
Copyright © 2011-2022 走看看