SET_FONT.CPP 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. //
  2. // Copyright 2020 Electronic Arts Inc.
  3. //
  4. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is free
  5. // software: you can redistribute it and/or modify it under the terms of
  6. // the GNU General Public License as published by the Free Software Foundation,
  7. // either version 3 of the License, or (at your option) any later version.
  8. // TiberianDawn.DLL and RedAlert.dll and corresponding source code is distributed
  9. // in the hope that it will be useful, but with permitted additional restrictions
  10. // under Section 7 of the GPL. See the GNU General Public License in LICENSE.TXT
  11. // distributed with this program. You should have received a copy of the
  12. // GNU General Public License along with permitted additional restrictions
  13. // with this program. If not, see https://github.com/electronicarts/CnC_Remastered_Collection
  14. /***************************************************************************
  15. ** C O N F I D E N T I A L --- W E S T W O O D A S S O C I A T E S **
  16. ***************************************************************************
  17. * *
  18. * Project Name : Westwood Library *
  19. * *
  20. * File Name : SET_FONT.C *
  21. * *
  22. * Programmer : Joe L. Bostic *
  23. * *
  24. * Start Date : September 6, 1991 *
  25. * *
  26. * Last Update : June 29, 1994 [SKB] *
  27. * *
  28. *-------------------------------------------------------------------------*
  29. * Functions: *
  30. * Set_Font -- Changes the default text printing font. *
  31. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  32. #include "font.h"
  33. #include <wwstd.h>
  34. /***************************************************************************
  35. * SET_FONT -- Changes the default text printing font. *
  36. * *
  37. * This routine will change the default text printing font for all *
  38. * text output. It handles updating the system where necessary. *
  39. * *
  40. * INPUT: fontptr -- Pointer to the font to change to. *
  41. * *
  42. * OUTPUT: Returns with a pointer to the previous font. *
  43. * *
  44. * WARNINGS: none *
  45. * *
  46. * HISTORY: *
  47. * 09/06/1991 JLB : Created. *
  48. * 09/17/1991 JLB : Fixed return value bug. *
  49. * 01/31/1992 DRD : Modified to use new font format. *
  50. * 06/29/1994 SKB : modified for 32 bit library *
  51. *=========================================================================*/
  52. void * __cdecl Set_Font(void const *fontptr)
  53. {
  54. void *oldfont;
  55. char const *blockptr;
  56. oldfont = (void *) FontPtr;
  57. if (fontptr) {
  58. FontPtr = (void *) fontptr;
  59. /*
  60. ** Inform the system about the new font.
  61. */
  62. FontWidthBlockPtr = (char*)fontptr + *(unsigned short *)((char*)fontptr + FONTWIDTHBLOCK);
  63. blockptr = (char*)fontptr + *(unsigned short *)((char*)fontptr + FONTINFOBLOCK);
  64. FontHeight = *(blockptr + FONTINFOMAXHEIGHT);
  65. FontWidth = *(blockptr + FONTINFOMAXWIDTH);
  66. //Draw_Char_Setup();
  67. #if FALSE
  68. WindowLines = WinH / FontHeight;
  69. WindowWidth = WinW << 3;
  70. WindowColumns = WindowWidth / FontWidth;
  71. #endif
  72. }
  73. return(oldfont);
  74. }