comparison libvo/font_load.c @ 727:cc208ebcb9f6

Deals with unicode/nounicode.
author atmosfear
date Tue, 08 May 2001 19:50:22 +0000
parents 8a7666a78f83
children 138d38a5915a
comparison
equal deleted inserted replaced
726:2cbe922e2f3c 727:cc208ebcb9f6
42 char section[64]; 42 char section[64];
43 int i,j; 43 int i,j;
44 int chardb=0; 44 int chardb=0;
45 int fontdb=-1; 45 int fontdb=-1;
46 int version=0; 46 int version=0;
47 int sub_unicode=0;
47 48
48 desc=malloc(sizeof(font_desc_t));if(!desc) return NULL; 49 desc=malloc(sizeof(font_desc_t));if(!desc) return NULL;
49 memset(desc,0,sizeof(font_desc_t)); 50 memset(desc,0,sizeof(font_desc_t));
50 51
51 f=fopen(fname,"rt");if(!f){ printf("font: can't open file: %s\n",fname); return NULL;} 52 f=fopen(fname,"rt");if(!f){ printf("font: can't open file: %s\n",fname); return NULL;}
172 if(strcmp(section,"[characters]")==0){ 173 if(strcmp(section,"[characters]")==0){
173 if(pdb==3){ 174 if(pdb==3){
174 int chr=p[0][0]; 175 int chr=p[0][0];
175 int start=atoi(p[1]); 176 int start=atoi(p[1]);
176 int end=atoi(p[2]); 177 int end=atoi(p[2]);
177 if(chr>=0x80) chr=(chr<<8)+p[0][1]; 178 if(sub_unicode && (chr>=0x80)) chr=(chr<<8)+p[0][1];
178 else if(strlen(p[0])!=1) chr=strtol(p[0],NULL,0); 179 else if(strlen(p[0])!=1) chr=strtol(p[0],NULL,0);
179 if(end<start) { 180 if(end<start) {
180 printf("error in font desc: end<start for char '%c'\n",chr); 181 printf("error in font desc: end<start for char '%c'\n",chr);
181 } else { 182 } else {
182 desc->start[chr]=start; 183 desc->start[chr]=start;