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.

100 lines
3.2 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. PLOGFONTA plfa
  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, plfa->lfHeight, CY_MAG);
  28. if (plfa->lfHeight < 0) // preserve sign
  29. Win16LogFont.lfHeight = -Win16LogFont.lfHeight;
  30. Win16LogFont.lfWidth = (SHORT) iMagnitudeXform(pLocalDC, plfa->lfWidth, CX_MAG);
  31. if (plfa->lfWidth < 0) // preserve sign
  32. Win16LogFont.lfWidth = -Win16LogFont.lfWidth;
  33. Win16LogFont.lfEscapement = (SHORT) plfa->lfEscapement;
  34. Win16LogFont.lfOrientation = (SHORT) plfa->lfOrientation;
  35. Win16LogFont.lfWeight = (SHORT) plfa->lfWeight;
  36. Win16LogFont.lfItalic = plfa->lfItalic;
  37. Win16LogFont.lfUnderline = plfa->lfUnderline;
  38. Win16LogFont.lfStrikeOut = plfa->lfStrikeOut;
  39. Win16LogFont.lfCharSet = plfa->lfCharSet;
  40. Win16LogFont.lfOutPrecision = plfa->lfOutPrecision;
  41. Win16LogFont.lfClipPrecision = plfa->lfClipPrecision;
  42. Win16LogFont.lfQuality = plfa->lfQuality;
  43. Win16LogFont.lfPitchAndFamily = plfa->lfPitchAndFamily;
  44. //vUnicodeToAnsi(pLocalDC->hdcHelper,(PCHAR) Win16LogFont.lfFaceName,
  45. // (PWCH) plfa->lfFaceName,
  46. // LF_FACESIZE);
  47. CopyMemory(&Win16LogFont.lfFaceName, &plfa->lfFaceName, LF_FACESIZE);
  48. // Allocate the W16 handle.
  49. ihW16 = iAllocateW16Handle(pLocalDC, ihFont, REALIZED_FONT) ;
  50. if (ihW16 == -1)
  51. goto error_exit ;
  52. // Create the w32 font and store it in the w16 slot table.
  53. // This font is needed by the helper DC for TextOut simulations.
  54. pLocalDC->pW16ObjHndlSlotStatus[ihW16].w32Handle
  55. = CreateFontIndirectA(plfa);
  56. ASSERTGDI(pLocalDC->pW16ObjHndlSlotStatus[ihW16].w32Handle != 0,
  57. "MF3216: CreateFontIndirectW failed");
  58. // Emit the Win16 CreateFont metafile record.
  59. b = bEmitWin16CreateFontIndirect(pLocalDC, &Win16LogFont);
  60. error_exit:
  61. return(b);
  62. }
  63. /***************************************************************************
  64. * SetMapperFlags - Win32 to Win16 Metafile Converter Entry Point
  65. **************************************************************************/
  66. BOOL WINAPI DoSetMapperFlags
  67. (
  68. PLOCALDC pLocalDC,
  69. DWORD f
  70. )
  71. {
  72. BOOL b ;
  73. // Do it to the helper DC.
  74. SetMapperFlags(pLocalDC->hdcHelper, (DWORD) f);
  75. // Emit the Win16 metafile drawing order.
  76. b = bEmitWin16SetMapperFlags(pLocalDC, f) ;
  77. return(b) ;
  78. }