comparison libvo/font_load.c @ 29263:0f1b5b68af32

whitespace cosmetics: Remove all trailing whitespace.
author diego
date Wed, 13 May 2009 02:58:57 +0000
parents 7681eab10aea
children 622ac29edfc8
comparison
equal deleted inserted replaced
29262:7d545a6b8aff 29263:0f1b5b68af32
89 strncpy (dn, fname, i); 89 strncpy (dn, fname, i);
90 dn[i]='\0'; 90 dn[i]='\0';
91 } 91 }
92 92
93 desc->fpath = dn; // search in the same dir as fonts.desc 93 desc->fpath = dn; // search in the same dir as fonts.desc
94 94
95 // desc->fpath=get_path("font/"); 95 // desc->fpath=get_path("font/");
96 // if (stat(desc->fpath, &fstate)!=0) desc->fpath=DATADIR"/font"; 96 // if (stat(desc->fpath, &fstate)!=0) desc->fpath=DATADIR"/font";
97 97
98 98
99 99
100 100
101 // set up some defaults, and erase table 101 // set up some defaults, and erase table
102 desc->charspace=2; 102 desc->charspace=2;
103 desc->spacewidth=12; 103 desc->spacewidth=12;
104 desc->height=0; 104 desc->height=0;
105 for(i=0;i<65536;i++) desc->start[i]=desc->width[i]=desc->font[i]=-1; 105 for(i=0;i<65536;i++) desc->start[i]=desc->width[i]=desc->font[i]=-1;
115 int id=0; 115 int id=0;
116 sor[1020]=0; 116 sor[1020]=0;
117 117
118 /* skip files that look like: TTF (0x00, 0x01), PFM (0x00, 0x01), PFB 118 /* skip files that look like: TTF (0x00, 0x01), PFM (0x00, 0x01), PFB
119 * (0x80, 0x01), PCF (0x01, 0x66), fon ("MZ"), gzipped (0x1f, 0x8b) */ 119 * (0x80, 0x01), PCF (0x01, 0x66), fon ("MZ"), gzipped (0x1f, 0x8b) */
120 120
121 if (first) { 121 if (first) {
122 if (!sor[0] || sor[1] == 1 || (sor[0] == 'M' && sor[1] == 'Z') || (sor[0] == 0x1f && sor[1] == 0x8b) || (sor[0] == 1 && sor[1] == 0x66)) { 122 if (!sor[0] || sor[1] == 1 || (sor[0] == 'M' && sor[1] == 'Z') || (sor[0] == 0x1f && sor[1] == 0x8b) || (sor[0] == 1 && sor[1] == 0x66)) {
123 mp_msg(MSGT_OSD, MSGL_ERR, "%s doesn't look like a bitmap font description, ignoring.\n", fname); 123 mp_msg(MSGT_OSD, MSGL_ERR, "%s doesn't look like a bitmap font description, ignoring.\n", fname);
124 goto fail_out; 124 goto fail_out;
125 } 125 }
126 first = 0; 126 first = 0;
127 } 127 }
128 128
129 p[0]=d;++pdb; 129 p[0]=d;++pdb;
130 while(1){ 130 while(1){
131 int c=*s++; 131 int c=*s++;
132 if(c==0 || c==13 || c==10) break; 132 if(c==0 || c==13 || c==10) break;
133 if(!id){ 133 if(!id){
141 if(pdb>=8) break; 141 if(pdb>=8) break;
142 continue; 142 continue;
143 } 143 }
144 } else { 144 } else {
145 if(id==c){ id=0;continue;} // idezojel 145 if(id==c){ id=0;continue;} // idezojel
146 146
147 } 147 }
148 *d=c;d++; 148 *d=c;d++;
149 ec=c; 149 ec=c;
150 } 150 }
151 if(d==sor2) continue; // skip empty lines 151 if(d==sor2) continue; // skip empty lines
152 *d=0; 152 *d=0;
153 153
154 // printf("params=%d sor=%s\n",pdb,sor); 154 // printf("params=%d sor=%s\n",pdb,sor);
155 // for(i=0;i<pdb;i++) printf(" param %d = '%s'\n",i,p[i]); 155 // for(i=0;i<pdb;i++) printf(" param %d = '%s'\n",i,p[i]);
156 156
157 if(pdb==1 && p[0][0]=='['){ 157 if(pdb==1 && p[0][0]=='['){
158 int len=strlen(p[0]); 158 int len=strlen(p[0]);
164 if(fontdb>=16){ mp_msg(MSGT_OSD, MSGL_ERR, "font: Too many bitmaps defined.\n");goto fail_out;} 164 if(fontdb>=16){ mp_msg(MSGT_OSD, MSGL_ERR, "font: Too many bitmaps defined.\n");goto fail_out;}
165 } 165 }
166 continue; 166 continue;
167 } 167 }
168 } 168 }
169 169
170 if(strcmp(section,"[fpath]")==0){ 170 if(strcmp(section,"[fpath]")==0){
171 if(pdb==1){ 171 if(pdb==1){
172 if (desc->fpath) 172 if (desc->fpath)
173 free (desc->fpath); // release previously allocated memory 173 free (desc->fpath); // release previously allocated memory
174 desc->fpath=strdup(p[0]); 174 desc->fpath=strdup(p[0]);
175 continue; 175 continue;
176 } 176 }
177 } else 177 } else
178 178
179 #ifdef __AMIGAOS4__ 179 #ifdef __AMIGAOS4__
180 #define FONT_PATH_SEP "" 180 #define FONT_PATH_SEP ""
181 #else 181 #else
182 //! path seperator for font paths, may not be more than one character 182 //! path seperator for font paths, may not be more than one character
191 191
192 snprintf(cp,strlen(desc->fpath)+strlen(p[1])+2,"%s" FONT_PATH_SEP "%s", 192 snprintf(cp,strlen(desc->fpath)+strlen(p[1])+2,"%s" FONT_PATH_SEP "%s",
193 desc->fpath,p[1]); 193 desc->fpath,p[1]);
194 if(!((desc->pic_a[fontdb]=load_raw(cp,verbose)))){ 194 if(!((desc->pic_a[fontdb]=load_raw(cp,verbose)))){
195 free(cp); 195 free(cp);
196 if (!(cp=malloc(strlen(default_dir)+strlen(p[1])+2))) 196 if (!(cp=malloc(strlen(default_dir)+strlen(p[1])+2)))
197 goto fail_out; 197 goto fail_out;
198 snprintf(cp,strlen(default_dir)+strlen(p[1])+2,"%s" FONT_PATH_SEP "%s", 198 snprintf(cp,strlen(default_dir)+strlen(p[1])+2,"%s" FONT_PATH_SEP "%s",
199 default_dir,p[1]); 199 default_dir,p[1]);
200 if (!((desc->pic_a[fontdb]=load_raw(cp,verbose)))){ 200 if (!((desc->pic_a[fontdb]=load_raw(cp,verbose)))){
201 mp_msg(MSGT_OSD, MSGL_ERR, "Can't load font bitmap: %s\n",p[1]); 201 mp_msg(MSGT_OSD, MSGL_ERR, "Can't load font bitmap: %s\n",p[1]);
212 212
213 snprintf(cp,strlen(desc->fpath)+strlen(p[1])+2,"%s" FONT_PATH_SEP "%s", 213 snprintf(cp,strlen(desc->fpath)+strlen(p[1])+2,"%s" FONT_PATH_SEP "%s",
214 desc->fpath,p[1]); 214 desc->fpath,p[1]);
215 if(!((desc->pic_b[fontdb]=load_raw(cp,verbose)))){ 215 if(!((desc->pic_b[fontdb]=load_raw(cp,verbose)))){
216 free(cp); 216 free(cp);
217 if (!(cp=malloc(strlen(default_dir)+strlen(p[1])+2))) 217 if (!(cp=malloc(strlen(default_dir)+strlen(p[1])+2)))
218 goto fail_out; 218 goto fail_out;
219 snprintf(cp,strlen(default_dir)+strlen(p[1])+2,"%s" FONT_PATH_SEP "%s", 219 snprintf(cp,strlen(default_dir)+strlen(p[1])+2,"%s" FONT_PATH_SEP "%s",
220 default_dir,p[1]); 220 default_dir,p[1]);
221 if (!((desc->pic_b[fontdb]=load_raw(cp,verbose)))){ 221 if (!((desc->pic_b[fontdb]=load_raw(cp,verbose)))){
222 mp_msg(MSGT_OSD, MSGL_ERR, "Can't load font bitmap: %s\n",p[1]); 222 mp_msg(MSGT_OSD, MSGL_ERR, "Can't load font bitmap: %s\n",p[1]);
308 x=255-((x*f)>>8); // scale 308 x=255-((x*f)>>8); // scale
309 //if(x<0) x=0; else if(x>255) x=255; 309 //if(x<0) x=0; else if(x>255) x=255;
310 //x^=255; // invert 310 //x^=255; // invert
311 311
312 if(x+y>255) x=255-y; // to avoid overflows 312 if(x+y>255) x=255-y; // to avoid overflows
313 313
314 //x=0; 314 //x=0;
315 //x=((x*f*(255-y))>>16); 315 //x=((x*f*(255-y))>>16);
316 //x=((x*f*(255-y))>>16)+y; 316 //x=((x*f*(255-y))>>16)+y;
317 //x=(x*f)>>8;if(x<y) x=y; 317 //x=(x*f)>>8;if(x<y) x=y;
318 318
319 if(x<1) x=1; else 319 if(x<1) x=1; else