font.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. /* -*- mode: c; tab-width: 4; c-basic-offset: 4; c-file-style: "linux" -*- */
  2. //
  3. // Copyright (c) 2009-2011, Wei Mingzhi <whistler_wmz@users.sf.net>.
  4. // Copyright (c) 2011-2017, SDLPAL development team.
  5. // All rights reserved.
  6. //
  7. // This file is part of SDLPAL.
  8. //
  9. // SDLPAL is free software: you can redistribute it and/or modify
  10. // it under the terms of the GNU General Public License as published by
  11. // the Free Software Foundation, either version 3 of the License, or
  12. // (at your option) any later version.
  13. //
  14. // This program is distributed in the hope that it will be useful,
  15. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. // GNU General Public License for more details.
  18. //
  19. // You should have received a copy of the GNU General Public License
  20. // along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. //
  22. #ifndef FONT_H
  23. #define FONT_H
  24. #include "common.h"
  25. #include "palcommon.h"
  26. #include "palcfg.h"
  27. PAL_C_LINKAGE_BEGIN
  28. /*++
  29. Purpose:
  30. Initialize the font subsystem.
  31. Parameters:
  32. [IN] cfg - Pointer to the configuration object.
  33. Return value:
  34. 0 = success, -1 = failure.
  35. --*/
  36. int
  37. PAL_InitFont(
  38. const CONFIGURATION* cfg
  39. );
  40. void
  41. PAL_FreeFont(
  42. void
  43. );
  44. /*++
  45. Purpose:
  46. Draw a Unicode character on a surface.
  47. Parameters:
  48. [IN] wChar - the unicode character to be drawn.
  49. [OUT] lpSurface - the destination surface.
  50. [IN] pos - the destination location of the surface.
  51. [IN] bColor - the color of the character.
  52. Return value:
  53. None.
  54. --*/
  55. void
  56. PAL_DrawCharOnSurface(
  57. uint16_t wChar,
  58. SDL_Surface *lpSurface,
  59. PAL_POS pos,
  60. uint8_t bColor,
  61. BOOL fUse8x8Font
  62. );
  63. /*++
  64. Purpose:
  65. Get the text width of a character.
  66. Parameters:
  67. [IN] wChar - the unicode character for width calculation.
  68. Return value:
  69. The width of the character in pixels, 16 for full-width char and 8 for half-width char.
  70. --*/
  71. int
  72. PAL_CharWidth(
  73. uint16_t wChar
  74. );
  75. /*++
  76. Purpose:
  77. Get the height of the currently used font.
  78. Parameters:
  79. None.
  80. Return value:
  81. The height of the font in pixels.
  82. --*/
  83. int
  84. PAL_FontHeight(
  85. void
  86. );
  87. PAL_C_LINKAGE_END
  88. #endif