【函数】
GetFontData【操作系统】
Win9X:Yes
WinNT:Yes【声明】
GetFontData Lib "gdi32" Alias "GetFontDataA" (ByVal hdc As Long, ByVal dwTable As Long, ByVal dwOffset As Long, lpvBuffer As Any, ByVal cbData As Long) As Long【说明】  接收一种可缩放字体文件的数据。随后,可用这些数据将字体信息嵌入一个文档。如果需要在文档使用一种特殊字体,同时这种字体在大多数系统中都不常见,而且程序员希望文档无论如何都要显示这种字体,那么这种技术就相当有用了 
  在VB里使用 
  未经测试 
  Use with VB:Untested 【返回值】
【其它】
【参数表】

解决方案 »

  1.   


      HDC hdc,           // handle to device context
      DWORD dwTable,     // metric table to query
      DWORD dwOffset,    // offset into table being queried
      LPVOID lpvBuffer,  // pointer to buffer for returned data
      DWORD cbData       // length of data to query
    );
     
    Parameters
    hdc 
    Handle to the device context. 
    dwTable 
    Specifies the name of a font metric table from which the font data is to be retrieved. This parameter can identify one of the metric tables documented in the TrueType Font Files specification published by Microsoft Corporation. If this parameter is zero, the information is retrieved starting at the beginning of the font file. 
    dwOffset 
    Specifies the offset from the beginning of the font metric table to the location where the function should begin retrieving information. If this parameter is zero, the information is retrieved starting at the beginning of the table specified by the dwTable parameter. If this value is greater than or equal to the size of the table, an error occurs. 
    lpvBuffer 
    Pointer to a buffer to receive the font information. If this parameter is NULL, the function returns the size of the buffer required for the font data. 
    cbData 
    Specifies the length, in bytes, of the information to be retrieved. If this parameter is zero, GetFontData returns the size of the data specified in the dwTable parameter. 
    Return Values
    If the function succeeds, the return value is the number of bytes returned.If the function fails, the return value is GDI_ERROR. Windows NT: To get extended error information, callGetLastError.Res
    An application can sometimes use the GetFontData function to save a TrueType font with a document. To do this, the application determines whether the font can be embedded by checking the otmfsType member of the OUTLINETEXTMETRIC structure. If bit 1 of otmfsType is set, embedding is not permitted for the font. If bit 1 is clear, the font can be embedded. If bit 2 is set, the embedding is read-only. If embedding is permitted, the application can retrieve the entire font file, specifying zero for the dwTable, dwOffset, and cbData parameters. If an application attempts to use this function to retrieve information for a non-TrueType font, an error occurs. QuickInfo
      Windows NT: Requires version 3.1 or later.
      Windows: Requires Windows 95 or later.
      Windows CE: Unsupported.
      Header: Declared in wingdi.h.
      Import Library: Use gdi32.lib.See Also
    Fonts and Text Overview, Font and Text Functions, GetTextMetrics, OUTLINETEXTMETRIC
      

  2.   

    以上资料来源于袁飞API工具
    建议下载:
    ygyuan.3322.net
      

  3.   

    http://support.microsoft.com/default.aspx?scid=kb;EN-US;q241020
      

  4.   

    可否给个例子,我程序中用到了自己做的一种字体。本来我想把这个字体拷入Fonts目录,但必须要重新启动系统才能用。