Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

128 lines
4.0 KiB

  1. /***************************************************************************
  2. * fontinfo.h - declarations for the font info class
  3. *
  4. * This header defines interfaces for the following classes:
  5. * OS_2TableClass - holds info from the OS_2 table (not true class)
  6. * TTFInfoClass - holds partial info from the TT file.
  7. * FontInfoClass - hold font info - this is the true public interface
  8. *
  9. * By putting these guys in classes, not only do we ensure they're not
  10. * used in some bad fashions, but we can automatically handle memory
  11. * release (via destructors)
  12. *
  13. * Copyright (C) 1992-93 ElseWare Corporation. All rights reserved.
  14. ***************************************************************************/
  15. #ifndef __FONTINFO_H__
  16. #define __FONTINFO_H__
  17. typedef TCHAR FQNAME[255];
  18. class far OS_2TableClass {
  19. public : OS_2TableClass () {};
  20. public : // fields:
  21. WORD wVersion;
  22. short ixAvgCharWidth;
  23. WORD wusWeightClass;
  24. WORD wusWidthClass;
  25. short ifsType;
  26. short iySubXSize;
  27. short iySubYSize;
  28. short iySubXOffset;
  29. short iySubYOffset;
  30. short iySupXSize;
  31. short iySupYSize;
  32. short iySupXOffset;
  33. short iySupYOffset;
  34. short iyStrikeoutSize;
  35. short iyStrikeoutPosition;
  36. short isFamilyClass;
  37. PANOSEBytesClass PANOSE;
  38. ULONG ulCharRange[4];
  39. TCHAR achVendID[4];
  40. WORD wfsSelection;
  41. WORD wusFirstCharIndex;
  42. WORD wusLastCharIndex;
  43. WORD wusTypoAscender;
  44. WORD wusTypeoDescender;
  45. WORD wwsTypoLineGap;
  46. WORD wusWinAscent;
  47. WORD wusWinDescent;
  48. };
  49. typedef OS_2TableClass* LPOS_2TABLE;
  50. /* The string block is a dynamically allocated section of the
  51. * TRUETYPE info block. We don't have any idea how big these guys
  52. * can be until we probe and dig into the file
  53. */
  54. typedef struct _tagStrings {
  55. LPTSTR m_lpszCopyright;
  56. LPTSTR m_lpszTrademark;
  57. LPTSTR m_lpszVersion;
  58. } InfoStrings_t, FAR* LPInfoStrings;
  59. class far TTFInfoClass {
  60. public :
  61. TTFInfoClass () { vClear (); };
  62. ~TTFInfoClass () { vFree (); };
  63. VOID vFree( ) { if (m_lpInfoStrings.m_lpszCopyright)
  64. delete[] m_lpInfoStrings.m_lpszCopyright;
  65. if( m_lpInfoStrings.m_lpszTrademark )
  66. delete[] m_lpInfoStrings.m_lpszTrademark;
  67. if( m_lpInfoStrings.m_lpszVersion )
  68. delete[] m_lpInfoStrings.m_lpszVersion;
  69. vClear (); };
  70. BOOL bLoadInfo( HDC hDC );
  71. // BOOL bGrowTTFInfo (WORD wLen, LPWORD, LPWORD);
  72. private : // routines
  73. VOID vClear( ) { memset (this, 0, sizeof(*this) ); };
  74. public : // fields
  75. InfoStrings_t m_lpInfoStrings; // The OS2 table we've allocated
  76. };
  77. class FontInfoClass {
  78. public : // routines
  79. FontInfoClass () { vClear(); };
  80. VOID vClear () { m_bValid = FALSE; vFree (); };
  81. VOID vFree () { m_xTTFInfo.vFree(); };
  82. LPTSTR lpGetTrademark ()
  83. { LPTSTR lp = NULL;
  84. if( m_bValid )
  85. lp = m_xTTFInfo.m_lpInfoStrings.m_lpszTrademark;
  86. return lp; };
  87. LPTSTR lpGetCopyright ()
  88. { LPTSTR lp = NULL;
  89. if( m_bValid )
  90. lp = m_xTTFInfo.m_lpInfoStrings.m_lpszCopyright;
  91. return lp; };
  92. void vGetVersion( UINT id, PTSTR szVersion );
  93. BOOL bGetFontInfo( CFontClass* lpFontRec );
  94. BOOL bValid( ) { return m_bValid; };
  95. private : // fields
  96. BOOL m_bValid;
  97. TTFInfoClass m_xTTFInfo;
  98. OS_2TableClass m_OS_2Table;
  99. };
  100. #endif
  101. /****************************************************************************
  102. * $lgb$
  103. * 1.0 7-Mar-94 eric Initial revision.
  104. * $lge$
  105. *
  106. ****************************************************************************/
  107.