SET_FONT.CPP 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /*
  2. ** Command & Conquer Red Alert(tm)
  3. ** Copyright 2025 Electronic Arts Inc.
  4. **
  5. ** This program is free software: you can redistribute it and/or modify
  6. ** it under the terms of the GNU General Public License as published by
  7. ** the Free Software Foundation, either version 3 of the License, or
  8. ** (at your option) any later version.
  9. **
  10. ** This program is distributed in the hope that it will be useful,
  11. ** but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. ** GNU General Public License for more details.
  14. **
  15. ** You should have received a copy of the GNU General Public License
  16. ** along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. */
  18. /***************************************************************************
  19. ** 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 **
  20. ***************************************************************************
  21. * *
  22. * Project Name : Westwood Library *
  23. * *
  24. * File Name : SET_FONT.C *
  25. * *
  26. * Programmer : Joe L. Bostic *
  27. * *
  28. * Start Date : September 6, 1991 *
  29. * *
  30. * Last Update : June 29, 1994 [SKB] *
  31. * *
  32. *-------------------------------------------------------------------------*
  33. * Functions: *
  34. * Set_Font -- Changes the default text printing font. *
  35. * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
  36. #include "font.h"
  37. #include <wwstd.h>
  38. /***************************************************************************
  39. * SET_FONT -- Changes the default text printing font. *
  40. * *
  41. * This routine will change the default text printing font for all *
  42. * text output. It handles updating the system where necessary. *
  43. * *
  44. * INPUT: fontptr -- Pointer to the font to change to. *
  45. * *
  46. * OUTPUT: Returns with a pointer to the previous font. *
  47. * *
  48. * WARNINGS: none *
  49. * *
  50. * HISTORY: *
  51. * 09/06/1991 JLB : Created. *
  52. * 09/17/1991 JLB : Fixed return value bug. *
  53. * 01/31/1992 DRD : Modified to use new font format. *
  54. * 06/29/1994 SKB : modified for 32 bit library *
  55. *=========================================================================*/
  56. void * __cdecl Set_Font(void const *fontptr)
  57. {
  58. void *oldfont;
  59. char const *blockptr;
  60. oldfont = (void *) FontPtr;
  61. if (fontptr) {
  62. FontPtr = (void *) fontptr;
  63. /*
  64. ** Inform the system about the new font.
  65. */
  66. FontWidthBlockPtr = (char*)fontptr + *(unsigned short *)((char*)fontptr + FONTWIDTHBLOCK);
  67. blockptr = (char*)fontptr + *(unsigned short *)((char*)fontptr + FONTINFOBLOCK);
  68. FontHeight = *(blockptr + FONTINFOMAXHEIGHT);
  69. FontWidth = *(blockptr + FONTINFOMAXWIDTH);
  70. //Draw_Char_Setup();
  71. #if FALSE
  72. WindowLines = WinH / FontHeight;
  73. WindowWidth = WinW << 3;
  74. WindowColumns = WindowWidth / FontWidth;
  75. #endif
  76. }
  77. return(oldfont);
  78. }