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.

98 lines
3.0 KiB

  1. /*****************************************************************************
  2. *
  3. * fonts - Entry points for Win32 to Win 16 converter
  4. *
  5. * Date: 7/1/91
  6. * Author: Jeffrey Newman (c-jeffn)
  7. *
  8. * Copyright 1991 Microsoft Corp
  9. *****************************************************************************/
  10. #include "precomp.h"
  11. #pragma hdrstop
  12. /***************************************************************************
  13. * ExtCreateFont - Win32 to Win16 Metafile Converter Entry Point
  14. **************************************************************************/
  15. BOOL WINAPI DoExtCreateFont
  16. (
  17. PLOCALDC pLocalDC,
  18. INT ihFont,
  19. PLOGFONTW plfw
  20. )
  21. {
  22. BOOL b ;
  23. INT ihW16 ;
  24. WIN16LOGFONT Win16LogFont;
  25. b = FALSE;
  26. // Create a win16 logfont(a)
  27. Win16LogFont.lfHeight = (SHORT) iMagnitudeXform(pLocalDC, plfw->lfHeight, CY_MAG);
  28. if (plfw->lfHeight < 0) // preserve sign
  29. Win16LogFont.lfHeight = -Win16LogFont.lfHeight;
  30. Win16LogFont.lfWidth = (SHORT) iMagnitudeXform(pLocalDC, plfw->lfWidth, CX_MAG);
  31. if (plfw->lfWidth < 0) // preserve sign
  32. Win16LogFont.lfWidth = -Win16LogFont.lfWidth;
  33. Win16LogFont.lfEscapement = (SHORT) plfw->lfEscapement;
  34. Win16LogFont.lfOrientation = (SHORT) plfw->lfOrientation;
  35. Win16LogFont.lfWeight = (SHORT) plfw->lfWeight;
  36. Win16LogFont.lfItalic = plfw->lfItalic;
  37. Win16LogFont.lfUnderline = plfw->lfUnderline;
  38. Win16LogFont.lfStrikeOut = plfw->lfStrikeOut;
  39. Win16LogFont.lfCharSet = plfw->lfCharSet;
  40. Win16LogFont.lfOutPrecision = plfw->lfOutPrecision;
  41. Win16LogFont.lfClipPrecision = plfw->lfClipPrecision;
  42. Win16LogFont.lfQuality = plfw->lfQuality;
  43. Win16LogFont.lfPitchAndFamily = plfw->lfPitchAndFamily;
  44. vUnicodeToAnsi((PCHAR) Win16LogFont.lfFaceName,
  45. (PWCH) plfw->lfFaceName,
  46. LF_FACESIZE);
  47. // Allocate the W16 handle.
  48. ihW16 = iAllocateW16Handle(pLocalDC, ihFont, REALIZED_FONT) ;
  49. if (ihW16 == -1)
  50. goto error_exit ;
  51. // Create the w32 font and store it in the w16 slot table.
  52. // This font is needed by the helper DC for TextOut simulations.
  53. pLocalDC->pW16ObjHndlSlotStatus[ihW16].w32Handle
  54. = CreateFontIndirectW(plfw);
  55. ASSERTGDI(pLocalDC->pW16ObjHndlSlotStatus[ihW16].w32Handle != 0,
  56. "MF3216: CreateFontIndirectW failed");
  57. // Emit the Win16 CreateFont metafile record.
  58. b = bEmitWin16CreateFontIndirect(pLocalDC, &Win16LogFont);
  59. error_exit:
  60. return(b);
  61. }
  62. /***************************************************************************
  63. * SetMapperFlags - Win32 to Win16 Metafile Converter Entry Point
  64. **************************************************************************/
  65. BOOL WINAPI DoSetMapperFlags
  66. (
  67. PLOCALDC pLocalDC,
  68. DWORD f
  69. )
  70. {
  71. BOOL b ;
  72. // Do it to the helper DC.
  73. SetMapperFlags(pLocalDC->hdcHelper, (DWORD) f);
  74. // Emit the Win16 metafile drawing order.
  75. b = bEmitWin16SetMapperFlags(pLocalDC, f) ;
  76. return(b) ;
  77. }