Debian Codegraph @

3rdparty/fonts/fntLocal.h

raw symbols SCIP
1 /*
2 PLIB - A Suite of Portable Game Libraries
3 Copyright (C) 1998,2002 Steve Baker
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library 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 GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public
16 License along with this library; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18
19 For further information visit http://plib.sourceforge.net
20
21 $Id: fntLocal.h 1727 2002-11-09 21:27:21Z ude $
22 */
23
24
25 #include "fnt.h"
26
27
28 extern int _fntIsSwapped ;
29 extern FILE *_fntCurrImageFd ;
30
31
32 inline void _fnt_swab_short ( unsigned short *x )
33 {
34 if ( _fntIsSwapped )
35 *x = (( *x >> 8 ) & 0x00FF ) |
36 (( *x << 8 ) & 0xFF00 ) ;
37 }
38
39
40 inline void _fnt_swab_int ( unsigned int *x )
41 {
42 if ( _fntIsSwapped )
43 *x = (( *x >> 24 ) & 0x000000FF ) |
44 (( *x >> 8 ) & 0x0000FF00 ) |
45 (( *x << 8 ) & 0x00FF0000 ) |
46 (( *x << 24 ) & 0xFF000000 ) ;
47 }
48
49
50 inline void _fnt_swab_int_array ( int *x, int leng )
51 {
52 if ( ! _fntIsSwapped )
53 return ;
54
55 for ( int i = 0 ; i < leng ; i++ )
56 {
57 *x = (( *x >> 24 ) & 0x000000FF ) |
58 (( *x >> 8 ) & 0x0000FF00 ) |
59 (( *x << 8 ) & 0x00FF0000 ) |
60 (( *x << 24 ) & 0xFF000000 ) ;
61 x++ ;
62 }
63 }
64
65
66 inline unsigned char _fnt_readByte ()
67 {
68 unsigned char x ;
69 fread ( & x, sizeof(unsigned char), 1, _fntCurrImageFd ) ;
70 return x ;
71 }
72
73 inline unsigned short _fnt_readShort ()
74 {
75 unsigned short x ;
76 fread ( & x, sizeof(unsigned short), 1, _fntCurrImageFd ) ;
77 _fnt_swab_short ( & x ) ;
78 return x ;
79 }
80
81 inline unsigned int _fnt_readInt ()
82 {
83 unsigned int x ;
84 fread ( & x, sizeof(unsigned int), 1, _fntCurrImageFd ) ;
85 _fnt_swab_int ( & x ) ;
86 return x ;
87 }
88
89
90 #define FNT_BYTE_FORMAT 0
91 #define FNT_BITMAP_FORMAT 1
92
93 struct TXF_Glyph
94 {
95 unsigned short ch ;
96 unsigned char w ;
97 unsigned char h ;
98 signed char x_off ;
99 signed char y_off ;
100 signed char step ;
101 signed char unknown ;
102 short x ;
103 short y ;
104
105 sgVec2 tx0 ; sgVec2 vx0 ;
106 sgVec2 tx1 ; sgVec2 vx1 ;
107 sgVec2 tx2 ; sgVec2 vx2 ;
108 sgVec2 tx3 ; sgVec2 vx3 ;
109 } ;
110
111
112 void fntSetError(int, const char* format, ...);