CHRWIDTH.CPP 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. *
  20. * C O N F I D E N T I A L -- W E S T W O O D S T U D I O S
  21. *
  22. *---------------------------------------------------------------------------
  23. *
  24. * FILE
  25. * chrwidth.c
  26. *
  27. * DESCRIPTION
  28. * Character pixel width.
  29. *
  30. * PROGRAMMER
  31. * Denzil E. Long, Jr.
  32. *
  33. * DATE
  34. * June 9, 1995
  35. *
  36. *---------------------------------------------------------------------------
  37. *
  38. * PUBLIC
  39. * Char_Pixel_Width - Get the pixel width of a character.
  40. *
  41. ****************************************************************************/
  42. #include "font.h"
  43. /****************************************************************************
  44. *
  45. * NAME
  46. * Char_Pixel_Width - Get the pixel width of a character.
  47. *
  48. * SYNOPSIS
  49. * Width = Char_Pixel_Width(Character)
  50. *
  51. * long Char_Pixel_Width(char);
  52. *
  53. * FUNCTION
  54. * Gets the pixel width of the specified character.
  55. *
  56. * INPUTS
  57. * Character - Character to get the width for.
  58. *
  59. * RESULT
  60. * Width - Width in pixels.
  61. *
  62. ****************************************************************************/
  63. #ifdef __WATCOMC__
  64. long cdecl __saveregs Char_Pixel_Width(char chr)
  65. #else
  66. #pragma saveregs
  67. long cdecl Char_Pixel_Width(char chr)
  68. #endif
  69. {
  70. return (*(FontWidthBlockPtr + chr) + FontXSpacing);
  71. }