Mercurial > mplayer.hg
comparison gui/skin/font.c @ 32789:236a95445ebb
Always access font characters in the same way
and avoid needless type conversion.
author | ib |
---|---|
date | Thu, 10 Feb 2011 12:28:43 +0000 |
parents | d55d0bb7d00f |
children | 5c23e57bb0a4 |
comparison
equal
deleted
inserted
replaced
32788:fb6f8ea9d38a | 32789:236a95445ebb |
---|---|
92 cutItem( ptmp,command,'=',0 ); cutItem( ptmp,param,'=',1 ); | 92 cutItem( ptmp,command,'=',0 ); cutItem( ptmp,param,'=',1 ); |
93 if ( command[0] == '"' ) | 93 if ( command[0] == '"' ) |
94 { | 94 { |
95 int i; | 95 int i; |
96 cutItem( command,command,'"',1 ); | 96 cutItem( command,command,'"',1 ); |
97 if ( !command[0] ) i=(int)'"'; | 97 if ( !command[0] ) i='"'; |
98 else if ( command[0] & 0x80 ) | 98 else if ( command[0] & 0x80 ) |
99 { | 99 { |
100 for ( i = 0; i < EXTRA_CHRS; i++ ) | 100 for ( i = 0; i < EXTRA_CHRS; i++ ) |
101 { | 101 { |
102 if ( !Fonts[id]->nonASCIIidx[i][0] ) | 102 if ( !Fonts[id]->nonASCIIidx[i][0] ) |
106 } | 106 } |
107 } | 107 } |
108 if ( i == EXTRA_CHRS ) continue; | 108 if ( i == EXTRA_CHRS ) continue; |
109 i += ASCII_CHRS; | 109 i += ASCII_CHRS; |
110 } | 110 } |
111 else i=(int)command[0]; | 111 else i=command[0]; |
112 cutItem( param,tmp,',',0 ); Fonts[id]->Fnt[i].x=atoi( tmp ); | 112 cutItem( param,tmp,',',0 ); Fonts[id]->Fnt[i].x=atoi( tmp ); |
113 cutItem( param,tmp,',',1 ); Fonts[id]->Fnt[i].y=atoi( tmp ); | 113 cutItem( param,tmp,',',1 ); Fonts[id]->Fnt[i].y=atoi( tmp ); |
114 cutItem( param,tmp,',',2 ); Fonts[id]->Fnt[i].sx=atoi( tmp ); | 114 cutItem( param,tmp,',',2 ); Fonts[id]->Fnt[i].sx=atoi( tmp ); |
115 cutItem( param,tmp,',',3 ); Fonts[id]->Fnt[i].sy=atoi( tmp ); | 115 cutItem( param,tmp,',',3 ); Fonts[id]->Fnt[i].sy=atoi( tmp ); |
116 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[font] char: '%s' params: %d,%d %dx%d\n",command,Fonts[id]->Fnt[i].x,Fonts[id]->Fnt[i].y,Fonts[id]->Fnt[i].sx,Fonts[id]->Fnt[i].sy ); | 116 mp_dbg( MSGT_GPLAYER,MSGL_DBG2,"[font] char: '%s' params: %d,%d %dx%d\n",command,Fonts[id]->Fnt[i].x,Fonts[id]->Fnt[i].y,Fonts[id]->Fnt[i].sx,Fonts[id]->Fnt[i].sy ); |
281 { | 281 { |
282 c = fntGetCharIndex( id, &u, utf8, 1 ); | 282 c = fntGetCharIndex( id, &u, utf8, 1 ); |
283 | 283 |
284 if ( c != -1 ) fw=Fonts[id]->Fnt[c].sx; | 284 if ( c != -1 ) fw=Fonts[id]->Fnt[c].sx; |
285 | 285 |
286 if ( c == -1 || fw == -1 ) { c=32; fw=Fonts[id]->Fnt[c].sx; } | 286 if ( c == -1 || fw == -1 ) { c=' '; fw=Fonts[id]->Fnt[c].sx; } |
287 | 287 |
288 fh=Fonts[id]->Fnt[c].sy; | 288 fh=Fonts[id]->Fnt[c].sy; |
289 fyc=Fonts[id]->Fnt[c].y * fbw + Fonts[id]->Fnt[c].x; | 289 fyc=Fonts[id]->Fnt[c].y * fbw + Fonts[id]->Fnt[c].x; |
290 yc=dx; | 290 yc=dx; |
291 | 291 |
309 { | 309 { |
310 c = fntGetCharIndex( id, &u, utf8, -1 ); | 310 c = fntGetCharIndex( id, &u, utf8, -1 ); |
311 | 311 |
312 if ( c != -1) fw=Fonts[id]->Fnt[c].sx; | 312 if ( c != -1) fw=Fonts[id]->Fnt[c].sx; |
313 | 313 |
314 if ( c == -1 || fw == -1 ) { c=32; fw=Fonts[id]->Fnt[c].sx; } | 314 if ( c == -1 || fw == -1 ) { c=' '; fw=Fonts[id]->Fnt[c].sx; } |
315 | 315 |
316 fh=Fonts[id]->Fnt[c].sy; | 316 fh=Fonts[id]->Fnt[c].sy; |
317 fyc=Fonts[id]->Fnt[c].y * fbw + Fonts[id]->Fnt[c].x; | 317 fyc=Fonts[id]->Fnt[c].y * fbw + Fonts[id]->Fnt[c].x; |
318 | 318 |
319 dx-=fw; yc=dx; | 319 dx-=fw; yc=dx; |