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.

90 lines
2.6 KiB

  1. //
  2. // uctuil.cpp
  3. //
  4. #include "private.h"
  5. #include "debug.h"
  6. #include "ucutil.h"
  7. /* C P G F R O M C H S */
  8. /*------------------------------------------------------------------------------
  9. ------------------------------------------------------------------------------*/
  10. UINT CpgFromChs( BYTE chs )
  11. {
  12. DWORD dwChs = chs;
  13. CHARSETINFO ChsInfo = {0};
  14. if (chs != SYMBOL_CHARSET && TranslateCharsetInfo( &dwChs, &ChsInfo, TCI_SRCCHARSET ))
  15. {
  16. return ChsInfo.ciACP;
  17. }
  18. return GetACP();
  19. }
  20. //
  21. // conversion functions
  22. //
  23. /* C O N V E R T L O G F O N T W T O A */
  24. /*------------------------------------------------------------------------------
  25. Convert LOGFONTW to LOGFONTA
  26. ------------------------------------------------------------------------------*/
  27. void ConvertLogFontWtoA( CONST LOGFONTW *plfW, LOGFONTA *plfA )
  28. {
  29. UINT cpg;
  30. plfA->lfHeight = plfW->lfHeight;
  31. plfA->lfWidth = plfW->lfWidth;
  32. plfA->lfEscapement = plfW->lfEscapement;
  33. plfA->lfOrientation = plfW->lfOrientation;
  34. plfA->lfWeight = plfW->lfWeight;
  35. plfA->lfItalic = plfW->lfItalic;
  36. plfA->lfUnderline = plfW->lfUnderline;
  37. plfA->lfStrikeOut = plfW->lfStrikeOut;
  38. plfA->lfCharSet = plfW->lfCharSet;
  39. plfA->lfOutPrecision = plfW->lfOutPrecision;
  40. plfA->lfClipPrecision = plfW->lfClipPrecision;
  41. plfA->lfQuality = plfW->lfQuality;
  42. plfA->lfPitchAndFamily = plfW->lfPitchAndFamily;
  43. cpg = CpgFromChs( plfW->lfCharSet );
  44. ConvertStrWtoA( plfW->lfFaceName, -1, plfA->lfFaceName, ARRAYSIZE(plfA->lfFaceName), cpg );
  45. }
  46. /* C O N V E R T L O G F O N T A T O W */
  47. /*------------------------------------------------------------------------------
  48. Convert LOGFONTA to LOGFONTW
  49. ------------------------------------------------------------------------------*/
  50. void ConvertLogFontAtoW( CONST LOGFONTA *plfA, LOGFONTW *plfW )
  51. {
  52. UINT cpg;
  53. plfW->lfHeight = plfA->lfHeight;
  54. plfW->lfWidth = plfA->lfWidth;
  55. plfW->lfEscapement = plfA->lfEscapement;
  56. plfW->lfOrientation = plfA->lfOrientation;
  57. plfW->lfWeight = plfA->lfWeight;
  58. plfW->lfItalic = plfA->lfItalic;
  59. plfW->lfUnderline = plfA->lfUnderline;
  60. plfW->lfStrikeOut = plfA->lfStrikeOut;
  61. plfW->lfCharSet = plfA->lfCharSet;
  62. plfW->lfOutPrecision = plfA->lfOutPrecision;
  63. plfW->lfClipPrecision = plfA->lfClipPrecision;
  64. plfW->lfQuality = plfA->lfQuality;
  65. plfW->lfPitchAndFamily = plfA->lfPitchAndFamily;
  66. cpg = CpgFromChs( plfA->lfCharSet );
  67. ConvertStrAtoW( plfA->lfFaceName, -1, plfW->lfFaceName, ARRAYSIZE(plfW->lfFaceName), cpg );
  68. }