Changeset 287 for trunk/thune/gl
- Timestamp:
- 09/30/06 03:47:37 (2 years ago)
- Location:
- trunk/thune/gl
- Files:
-
- 6 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/thune/gl/TexFont.c
r286 r287 499 499 free( txf->kerning ); 500 500 txf->kerning = (uint8_t*) kern.ptr; 501 txf->kern_bytes = kern.used; 502 } 503 else 504 { 505 txf->kerning = 0; 506 txf->kern_bytes = 0; 501 507 } 502 508 #endif -
trunk/thune/gl/TexFont.h
r286 r287 24 24 typedef struct 25 25 { 26 TexGlyphInfo* tgi; 27 TexGlyphInfo** table; 28 uint8_t* kerning; 29 26 30 int16_t tex_width; 27 31 int16_t tex_height; 28 32 int16_t max_ascent; 29 33 int16_t max_descent; 30 int 32_t num_glyphs;34 int16_t num_glyphs; 31 35 int16_t min_glyph; 32 36 int16_t table_size; 33 34 TexGlyphInfo* tgi; 35 TexGlyphInfo** table; 36 uint8_t* kerning; 37 int16_t kern_bytes; 37 38 } 38 39 TexFont; -
trunk/thune/gl/draw_list.c
r286 r287 143 143 144 144 145 /* *145 /* 146 146 Returns TexGlyphInfo of rendered glyph. 147 147 Advances x. -
trunk/thune/gl/gx.c
r286 r287 33 33 /* 34 34 #include "math3d.h" 35 #include "res_font.h"36 #include "dlist.h"37 35 #include <time.h> 38 36 */ -
trunk/thune/gl/rfont.c
r286 r287 93 93 " ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz" 94 94 "?.;,!*:\"/+-|'@#$%^&<>()[]{}_"; 95 96 97 static int _kernTableSize( uint8_t* kern )98 {99 int count = 0;100 if( kern )101 {102 while( *kern++ )103 ++count;104 }105 return count;106 }107 95 108 96 … … 145 133 TexFont* btf; 146 134 int gs, ts, ks; 135 TexGlyphInfo** dst; 136 TexGlyphInfo** src; 137 TexGlyphInfo** end; 147 138 148 139 // TODO: Track & delete texture. … … 154 145 gs = sizeof(TexGlyphInfo) * tf.num_glyphs; 155 146 ts = sizeof(TexGlyphInfo*) * tf.table_size; 156 ks = _kernTableSize( tf.kerning );147 ks = tf.kerning ? tf.kern_bytes : 0; 157 148 158 149 binN = ur_makeBinary( sizeof(TexFont) + gs + ts + ks ); 159 150 bin = ur_binPtr( binN ); 151 bin->used = bin->avail; 160 152 161 153 btf = (TexFont*) bin->ptr.v; … … 163 155 164 156 btf->table = (TexGlyphInfo**) (btf + 1); 165 memCpy( btf->table, tf.table, ts ); 166 167 btf->tgi = (TexGlyphInfo*) (btf->table + tf.table_size); 157 btf->tgi = (TexGlyphInfo*) (btf->table + tf.table_size); 158 159 src = tf.table; 160 end = src + tf.table_size; 161 dst = btf->table; 162 while( src != end ) 163 { 164 if( *src ) 165 *dst++ = btf->tgi + (*src - tf.tgi); 166 else 167 *dst++ = 0; 168 ++src; 169 } 170 //memCpy( btf->table, tf.table, ts ); 171 168 172 memCpy( btf->tgi, tf.tgi, gs ); 169 173 -
trunk/thune/gl/test.t
r286 r287 117 117 call bg-list 118 118 pop 119 119 120 font fontA color $ffffff 120 121 text "Hello^/There" … … 122 123 text -200,-200 "-200,-200" 123 124 text mouse-pos mouse-pos 125 126 ;font fontF 127 ;text 0,40 "Ceti Alpha III" 128 124 129 ;children ['draw get do] iter 125 130 ] … … 223 228 224 229 font! ["data/20thfont.ttf" 22] make :fontA 230 ;font! ["data/FederationBold_KR.ttf" 12 256,128] make :fontF 225 231 226 232
