Leaked source code of windows server 2003
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.

117 lines
2.8 KiB

  1. #include "_apipch.h"
  2. /**
  3. LOGFONT g_lfFolderNameHorz=
  4. {
  5. 0, // lfHeight
  6. 0, // lfWidth
  7. 0, // lfEscapement
  8. 0, // lfOrientation
  9. 400, // lfWeight
  10. 0, // lfItalic
  11. 0, // lfUnderline
  12. 0, // lfStrikeout
  13. DEFAULT_CHARSET, // lfCharSet
  14. OUT_DEFAULT_PRECIS, // lfOutPrecision
  15. CLIP_DEFAULT_PRECIS, // lfClipPrecision
  16. DEFAULT_QUALITY, // lfQuality
  17. DEFAULT_PITCH | FF_DONTCARE, // lfPitchAndFamily
  18. "" // lfFaceName
  19. };
  20. LOGFONT g_lfFolderNameVert=
  21. {
  22. 0, // lfHeight
  23. 0, // lfWidth
  24. 2700, // lfEscapement
  25. 0, // lfOrientation
  26. 400, // lfWeight
  27. 0, // lfItalic
  28. 0, // lfUnderline
  29. 0, // lfStrikeout
  30. DEFAULT_CHARSET, // lfCharSet
  31. OUT_DEFAULT_PRECIS, // lfOutPrecision
  32. CLIP_DEFAULT_PRECIS, // lfClipPrecision
  33. DEFAULT_QUALITY, // lfQuality
  34. DEFAULT_PITCH | FF_DONTCARE, // lfPitchAndFamily
  35. "" // lfFaceName
  36. };
  37. **/
  38. LOGFONT g_lfSysIcon,
  39. g_lfSysIconBold;
  40. // g_lfSysIconItalic,
  41. // g_lfSysIconItalicBold,
  42. // g_lfSysMenu;
  43. LOGFONT *g_rgplf[fntsMax]=
  44. {
  45. &g_lfSysIcon,
  46. &g_lfSysIconBold,
  47. // &g_lfSysIconItalic,
  48. // &g_lfSysIconItalicBold,
  49. // &g_lfSysMenu,
  50. // &g_lfFolderNameHorz,
  51. // &g_lfFolderNameVert
  52. };
  53. HFONT g_rgFont[fntsMax] = {0};
  54. static int g_yPerInch=0;
  55. HFONT GetFont(int ifont)
  56. {
  57. HFONT hfont;
  58. if (g_rgFont[ifont]==NULL)
  59. {
  60. hfont = CreateFontIndirect(g_rgplf[ifont]);
  61. g_rgFont[ifont] = hfont;
  62. }
  63. else
  64. {
  65. hfont = g_rgFont[ifont];
  66. }
  67. return(hfont);
  68. }
  69. #define CCHMAX_STRINGRES 64
  70. BOOL InitFonts(void)
  71. {
  72. NONCLIENTMETRICS ncm;
  73. ncm.cbSize = sizeof(ncm);
  74. if(SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(LOGFONT), &g_lfSysIcon, 0))
  75. {
  76. CopyMemory((LPBYTE)&g_lfSysIconBold, (LPBYTE)&g_lfSysIcon, sizeof(LOGFONT));
  77. //CopyMemory((LPBYTE)&g_lfSysIconItalic, (LPBYTE)&g_lfSysIcon, sizeof(LOGFONT));
  78. //CopyMemory((LPBYTE)&g_lfSysIconItalicBold, (LPBYTE)&g_lfSysIcon, sizeof(LOGFONT));
  79. g_lfSysIconBold.lfWeight = (g_lfSysIconBold.lfWeight < 700) ? 700 : 1000;
  80. //g_lfSysIconItalic.lfItalic=TRUE;
  81. //g_lfSysIconItalicBold.lfItalic=TRUE;
  82. //g_lfSysIconItalicBold.lfWeight = (g_lfSysIconItalicBold.lfWeight < 700) ? 700 : 1000;
  83. }
  84. //if(SystemParametersInfo(SPI_GETNONCLIENTMETRICS, sizeof(ncm), &ncm, 0))
  85. // CopyMemory((LPBYTE)&g_lfSysMenu, (LPBYTE)&ncm.lfMenuFont, sizeof(LOGFONT));
  86. return(TRUE);
  87. }
  88. void DeleteFonts(void)
  89. {
  90. int ifont;
  91. for (ifont = 0; ifont < fntsMax; ifont++)
  92. {
  93. if (g_rgFont[ifont] != NULL)
  94. {
  95. DeleteObject((HGDIOBJ)g_rgFont[ifont]);
  96. g_rgFont[ifont] = NULL;
  97. }
  98. }
  99. }