font.h 2.3 KB

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