Mercurial > mplayer.hg
annotate libvo/font_load.c @ 27082:2a486144b5c7
remove some useless functions from vidix api
author | ben |
---|---|
date | Fri, 20 Jun 2008 20:21:31 +0000 |
parents | 6bc98534572a |
children | 0f4e0c39c20e |
rev | line source |
---|---|
7122
0dc9cb756b68
freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents:
5928
diff
changeset
|
1 #include "config.h" |
0dc9cb756b68
freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents:
5928
diff
changeset
|
2 |
213 | 3 #include <stdio.h> |
4 #include <stdlib.h> | |
5 #include <string.h> | |
1446 | 6 #include <sys/types.h> |
7 #include <sys/stat.h> | |
8 #include <unistd.h> | |
213 | 9 |
10 #include "font_load.h" | |
13897
41a4fc8421e9
Converted printf calls to mp_msg, reduced verbosity.
diego
parents:
13641
diff
changeset
|
11 #include "mp_msg.h" |
213 | 12 |
339 | 13 raw_file* load_raw(char *name,int verbose){ |
213 | 14 int bpp; |
15 raw_file* raw=malloc(sizeof(raw_file)); | |
16 unsigned char head[32]; | |
17 FILE *f=fopen(name,"rb"); | |
17791 | 18 if(!f) goto err_out; // can't open |
19 if(fread(head,32,1,f)<1) goto err_out; // too small | |
20 if(memcmp(head,"mhwanh",6)) goto err_out; // not raw file | |
213 | 21 raw->w=head[8]*256+head[9]; |
22 raw->h=head[10]*256+head[11]; | |
23 raw->c=head[12]*256+head[13]; | |
5928
48e91dc9534b
.raw width>=65536 support by Georgi Georgiev <chutz@chubaka.homeip.net>
arpi
parents:
2476
diff
changeset
|
24 if(raw->w == 0) // 2 bytes were not enough for the width... read 4 bytes from the end of the header |
48e91dc9534b
.raw width>=65536 support by Georgi Georgiev <chutz@chubaka.homeip.net>
arpi
parents:
2476
diff
changeset
|
25 raw->w = ((head[28]*0x100 + head[29])*0x100 + head[30])*0x100 + head[31]; |
17791 | 26 if(raw->c>256) goto err_out; // too many colors!? |
13897
41a4fc8421e9
Converted printf calls to mp_msg, reduced verbosity.
diego
parents:
13641
diff
changeset
|
27 mp_msg(MSGT_OSD, MSGL_DBG2, "RAW: %s %d x %d, %d colors\n",name,raw->w,raw->h,raw->c); |
213 | 28 if(raw->c){ |
29 raw->pal=malloc(raw->c*3); | |
30 fread(raw->pal,3,raw->c,f); | |
31 bpp=1; | |
32 } else { | |
33 raw->pal=NULL; | |
34 bpp=3; | |
35 } | |
36 raw->bmp=malloc(raw->h*raw->w*bpp); | |
37 fread(raw->bmp,raw->h*raw->w*bpp,1,f); | |
38 fclose(f); | |
39 return raw; | |
17791 | 40 |
41 err_out: | |
42 if (f) | |
43 fclose(f); | |
44 free(raw); | |
45 return NULL; | |
213 | 46 } |
47 | |
728 | 48 extern int sub_unicode; |
49 | |
18980
ed69754aa58d
Marks several string parameters as const when they are not modified in the function, Patch by Stefan Huehner, stefan AT huehner-org
reynaldo
parents:
17791
diff
changeset
|
50 font_desc_t* read_font_desc(const char* fname,float factor,int verbose){ |
213 | 51 unsigned char sor[1024]; |
52 unsigned char sor2[1024]; | |
53 font_desc_t *desc; | |
17766
b8be9bedc108
initialize f to NULL, needed if desc=malloc... fails
reimar
parents:
14065
diff
changeset
|
54 FILE *f = NULL; |
2222
ddf897c38fb1
read font files from the same dir as font.desc or as specified in font.desc
atlka
parents:
1446
diff
changeset
|
55 char *dn; |
24245 | 56 //struct stat fstate; |
213 | 57 char section[64]; |
58 int i,j; | |
59 int chardb=0; | |
60 int fontdb=-1; | |
214 | 61 int version=0; |
8635
81dbd28ef7c0
these patches let ,,oldstyle'' and freetype subtitle renderers live
arpi
parents:
7122
diff
changeset
|
62 int first=1; |
213 | 63 |
13641 | 64 desc=malloc(sizeof(font_desc_t));if(!desc) goto fail_out; |
213 | 65 memset(desc,0,sizeof(font_desc_t)); |
66 | |
14065 | 67 f=fopen(fname,"rt");if(!f){ mp_msg(MSGT_OSD, MSGL_V, "font: can't open file: %s\n",fname); goto fail_out;} |
213 | 68 |
2222
ddf897c38fb1
read font files from the same dir as font.desc or as specified in font.desc
atlka
parents:
1446
diff
changeset
|
69 i = strlen (fname) - 9; |
2223 | 70 if ((dn = malloc(i+1))){ |
2222
ddf897c38fb1
read font files from the same dir as font.desc or as specified in font.desc
atlka
parents:
1446
diff
changeset
|
71 strncpy (dn, fname, i); |
ddf897c38fb1
read font files from the same dir as font.desc or as specified in font.desc
atlka
parents:
1446
diff
changeset
|
72 dn[i]='\0'; |
ddf897c38fb1
read font files from the same dir as font.desc or as specified in font.desc
atlka
parents:
1446
diff
changeset
|
73 } |
ddf897c38fb1
read font files from the same dir as font.desc or as specified in font.desc
atlka
parents:
1446
diff
changeset
|
74 |
ddf897c38fb1
read font files from the same dir as font.desc or as specified in font.desc
atlka
parents:
1446
diff
changeset
|
75 desc->fpath = dn; // search in the same dir as fonts.desc |
1446 | 76 |
2222
ddf897c38fb1
read font files from the same dir as font.desc or as specified in font.desc
atlka
parents:
1446
diff
changeset
|
77 // desc->fpath=get_path("font/"); |
ddf897c38fb1
read font files from the same dir as font.desc or as specified in font.desc
atlka
parents:
1446
diff
changeset
|
78 // if (stat(desc->fpath, &fstate)!=0) desc->fpath=DATADIR"/font"; |
ddf897c38fb1
read font files from the same dir as font.desc or as specified in font.desc
atlka
parents:
1446
diff
changeset
|
79 |
ddf897c38fb1
read font files from the same dir as font.desc or as specified in font.desc
atlka
parents:
1446
diff
changeset
|
80 |
ddf897c38fb1
read font files from the same dir as font.desc or as specified in font.desc
atlka
parents:
1446
diff
changeset
|
81 |
1446 | 82 |
213 | 83 // set up some defaults, and erase table |
84 desc->charspace=2; | |
85 desc->spacewidth=12; | |
86 desc->height=0; | |
12609
4be019266884
array initialization fix by SungKwanKang <ksquarekr at yahoo.com>
faust3
parents:
10272
diff
changeset
|
87 for(i=0;i<65536;i++) desc->start[i]=desc->width[i]=desc->font[i]=-1; |
213 | 88 |
89 section[0]=0; | |
90 | |
91 while(fgets(sor,1020,f)){ | |
92 unsigned char* p[8]; | |
93 int pdb=0; | |
94 unsigned char *s=sor; | |
95 unsigned char *d=sor2; | |
96 int ec=' '; | |
97 int id=0; | |
98 sor[1020]=0; | |
8635
81dbd28ef7c0
these patches let ,,oldstyle'' and freetype subtitle renderers live
arpi
parents:
7122
diff
changeset
|
99 |
81dbd28ef7c0
these patches let ,,oldstyle'' and freetype subtitle renderers live
arpi
parents:
7122
diff
changeset
|
100 /* skip files that look like: TTF (0x00, 0x01), PFM (0x00, 0x01), PFB |
81dbd28ef7c0
these patches let ,,oldstyle'' and freetype subtitle renderers live
arpi
parents:
7122
diff
changeset
|
101 * (0x80, 0x01), PCF (0x01, 0x66), fon ("MZ"), gzipped (0x1f, 0x8b) */ |
81dbd28ef7c0
these patches let ,,oldstyle'' and freetype subtitle renderers live
arpi
parents:
7122
diff
changeset
|
102 |
81dbd28ef7c0
these patches let ,,oldstyle'' and freetype subtitle renderers live
arpi
parents:
7122
diff
changeset
|
103 if (first) { |
81dbd28ef7c0
these patches let ,,oldstyle'' and freetype subtitle renderers live
arpi
parents:
7122
diff
changeset
|
104 if (!sor[0] || sor[1] == 1 || (sor[0] == 'M' && sor[1] == 'Z') || (sor[0] == 0x1f && sor[1] == 0x8b) || (sor[0] == 1 && sor[1] == 0x66)) { |
19551 | 105 mp_msg(MSGT_OSD, MSGL_ERR, "%s doesn't look like a bitmap font description, ignoring.\n", fname); |
13641 | 106 goto fail_out; |
8635
81dbd28ef7c0
these patches let ,,oldstyle'' and freetype subtitle renderers live
arpi
parents:
7122
diff
changeset
|
107 } |
81dbd28ef7c0
these patches let ,,oldstyle'' and freetype subtitle renderers live
arpi
parents:
7122
diff
changeset
|
108 first = 0; |
81dbd28ef7c0
these patches let ,,oldstyle'' and freetype subtitle renderers live
arpi
parents:
7122
diff
changeset
|
109 } |
81dbd28ef7c0
these patches let ,,oldstyle'' and freetype subtitle renderers live
arpi
parents:
7122
diff
changeset
|
110 |
213 | 111 p[0]=d;++pdb; |
112 while(1){ | |
113 int c=*s++; | |
114 if(c==0 || c==13 || c==10) break; | |
115 if(!id){ | |
116 if(c==39 || c==34){ id=c;continue;} // idezojel | |
117 if(c==';' || c=='#') break; | |
118 if(c==9) c=' '; | |
119 if(c==' '){ | |
120 if(ec==' ') continue; | |
121 *d=0; ++d; | |
122 p[pdb]=d;++pdb; | |
123 if(pdb>=8) break; | |
124 continue; | |
125 } | |
126 } else { | |
127 if(id==c){ id=0;continue;} // idezojel | |
128 | |
129 } | |
130 *d=c;d++; | |
131 ec=c; | |
132 } | |
133 if(d==sor2) continue; // skip empty lines | |
134 *d=0; | |
135 | |
136 // printf("params=%d sor=%s\n",pdb,sor); | |
137 // for(i=0;i<pdb;i++) printf(" param %d = '%s'\n",i,p[i]); | |
138 | |
139 if(pdb==1 && p[0][0]=='['){ | |
140 int len=strlen(p[0]); | |
141 if(len && len<63 && p[0][len-1]==']'){ | |
142 strcpy(section,p[0]); | |
13897
41a4fc8421e9
Converted printf calls to mp_msg, reduced verbosity.
diego
parents:
13641
diff
changeset
|
143 mp_msg(MSGT_OSD, MSGL_DBG2, "font: Reading section: %s\n",section); |
213 | 144 if(strcmp(section,"[files]")==0){ |
145 ++fontdb; | |
13897
41a4fc8421e9
Converted printf calls to mp_msg, reduced verbosity.
diego
parents:
13641
diff
changeset
|
146 if(fontdb>=16){ mp_msg(MSGT_OSD, MSGL_ERR, "font: Too many bitmaps defined.\n");goto fail_out;} |
213 | 147 } |
148 continue; | |
149 } | |
150 } | |
151 | |
1353 | 152 if(strcmp(section,"[fpath]")==0){ |
153 if(pdb==1){ | |
2222
ddf897c38fb1
read font files from the same dir as font.desc or as specified in font.desc
atlka
parents:
1446
diff
changeset
|
154 if (desc->fpath) |
ddf897c38fb1
read font files from the same dir as font.desc or as specified in font.desc
atlka
parents:
1446
diff
changeset
|
155 free (desc->fpath); // release previously allocated memory |
1353 | 156 desc->fpath=strdup(p[0]); |
157 continue; | |
158 } | |
159 } else | |
160 | |
25335 | 161 #ifdef __AMIGAOS4__ |
19386
01853e915882
Make path separator for font path a define and set it to a better value for AMIGAOS
reimar
parents:
18980
diff
changeset
|
162 #define FONT_PATH_SEP "" |
01853e915882
Make path separator for font path a define and set it to a better value for AMIGAOS
reimar
parents:
18980
diff
changeset
|
163 #else |
01853e915882
Make path separator for font path a define and set it to a better value for AMIGAOS
reimar
parents:
18980
diff
changeset
|
164 //! path seperator for font paths, may not be more than one character |
01853e915882
Make path separator for font path a define and set it to a better value for AMIGAOS
reimar
parents:
18980
diff
changeset
|
165 #define FONT_PATH_SEP "/" |
01853e915882
Make path separator for font path a define and set it to a better value for AMIGAOS
reimar
parents:
18980
diff
changeset
|
166 #endif |
01853e915882
Make path separator for font path a define and set it to a better value for AMIGAOS
reimar
parents:
18980
diff
changeset
|
167 |
213 | 168 if(strcmp(section,"[files]")==0){ |
19386
01853e915882
Make path separator for font path a define and set it to a better value for AMIGAOS
reimar
parents:
18980
diff
changeset
|
169 char *default_dir=MPLAYER_DATADIR FONT_PATH_SEP "font"; |
213 | 170 if(pdb==2 && strcmp(p[0],"alpha")==0){ |
1353 | 171 char *cp; |
13641 | 172 if (!(cp=malloc(strlen(desc->fpath)+strlen(p[1])+2))) goto fail_out; |
1353 | 173 |
19386
01853e915882
Make path separator for font path a define and set it to a better value for AMIGAOS
reimar
parents:
18980
diff
changeset
|
174 snprintf(cp,strlen(desc->fpath)+strlen(p[1])+2,"%s" FONT_PATH_SEP "%s", |
1353 | 175 desc->fpath,p[1]); |
176 if(!((desc->pic_a[fontdb]=load_raw(cp,verbose)))){ | |
216
338b5664ea13
Search font files in ~/.mplayer/font/ instead of current dir
lgb
parents:
215
diff
changeset
|
177 free(cp); |
2238
be4160d7db48
if not found using fpath try to load font bitmaps from default dir
atlka
parents:
2223
diff
changeset
|
178 if (!(cp=malloc(strlen(default_dir)+strlen(p[1])+2))) |
13641 | 179 goto fail_out; |
19386
01853e915882
Make path separator for font path a define and set it to a better value for AMIGAOS
reimar
parents:
18980
diff
changeset
|
180 snprintf(cp,strlen(default_dir)+strlen(p[1])+2,"%s" FONT_PATH_SEP "%s", |
2238
be4160d7db48
if not found using fpath try to load font bitmaps from default dir
atlka
parents:
2223
diff
changeset
|
181 default_dir,p[1]); |
be4160d7db48
if not found using fpath try to load font bitmaps from default dir
atlka
parents:
2223
diff
changeset
|
182 if (!((desc->pic_a[fontdb]=load_raw(cp,verbose)))){ |
13897
41a4fc8421e9
Converted printf calls to mp_msg, reduced verbosity.
diego
parents:
13641
diff
changeset
|
183 mp_msg(MSGT_OSD, MSGL_ERR, "Can't load font bitmap: %s\n",p[1]); |
2238
be4160d7db48
if not found using fpath try to load font bitmaps from default dir
atlka
parents:
2223
diff
changeset
|
184 free(cp); |
13641 | 185 goto fail_out; |
2238
be4160d7db48
if not found using fpath try to load font bitmaps from default dir
atlka
parents:
2223
diff
changeset
|
186 } |
213 | 187 } |
216
338b5664ea13
Search font files in ~/.mplayer/font/ instead of current dir
lgb
parents:
215
diff
changeset
|
188 free(cp); |
213 | 189 continue; |
190 } | |
191 if(pdb==2 && strcmp(p[0],"bitmap")==0){ | |
1353 | 192 char *cp; |
13641 | 193 if (!(cp=malloc(strlen(desc->fpath)+strlen(p[1])+2))) goto fail_out; |
1353 | 194 |
19386
01853e915882
Make path separator for font path a define and set it to a better value for AMIGAOS
reimar
parents:
18980
diff
changeset
|
195 snprintf(cp,strlen(desc->fpath)+strlen(p[1])+2,"%s" FONT_PATH_SEP "%s", |
1353 | 196 desc->fpath,p[1]); |
197 if(!((desc->pic_b[fontdb]=load_raw(cp,verbose)))){ | |
216
338b5664ea13
Search font files in ~/.mplayer/font/ instead of current dir
lgb
parents:
215
diff
changeset
|
198 free(cp); |
2238
be4160d7db48
if not found using fpath try to load font bitmaps from default dir
atlka
parents:
2223
diff
changeset
|
199 if (!(cp=malloc(strlen(default_dir)+strlen(p[1])+2))) |
13641 | 200 goto fail_out; |
19386
01853e915882
Make path separator for font path a define and set it to a better value for AMIGAOS
reimar
parents:
18980
diff
changeset
|
201 snprintf(cp,strlen(default_dir)+strlen(p[1])+2,"%s" FONT_PATH_SEP "%s", |
2238
be4160d7db48
if not found using fpath try to load font bitmaps from default dir
atlka
parents:
2223
diff
changeset
|
202 default_dir,p[1]); |
be4160d7db48
if not found using fpath try to load font bitmaps from default dir
atlka
parents:
2223
diff
changeset
|
203 if (!((desc->pic_b[fontdb]=load_raw(cp,verbose)))){ |
13897
41a4fc8421e9
Converted printf calls to mp_msg, reduced verbosity.
diego
parents:
13641
diff
changeset
|
204 mp_msg(MSGT_OSD, MSGL_ERR, "Can't load font bitmap: %s\n",p[1]); |
2238
be4160d7db48
if not found using fpath try to load font bitmaps from default dir
atlka
parents:
2223
diff
changeset
|
205 free(cp); |
13641 | 206 goto fail_out; |
2238
be4160d7db48
if not found using fpath try to load font bitmaps from default dir
atlka
parents:
2223
diff
changeset
|
207 } |
213 | 208 } |
216
338b5664ea13
Search font files in ~/.mplayer/font/ instead of current dir
lgb
parents:
215
diff
changeset
|
209 free(cp); |
213 | 210 continue; |
211 } | |
212 } else | |
213 | |
214 if(strcmp(section,"[info]")==0){ | |
214 | 215 if(pdb==2 && strcmp(p[0],"name")==0){ |
216 desc->name=strdup(p[1]); | |
217 continue; | |
218 } | |
219 if(pdb==2 && strcmp(p[0],"descversion")==0){ | |
220 version=atoi(p[1]); | |
221 continue; | |
222 } | |
213 | 223 if(pdb==2 && strcmp(p[0],"spacewidth")==0){ |
224 desc->spacewidth=atoi(p[1]); | |
225 continue; | |
226 } | |
227 if(pdb==2 && strcmp(p[0],"charspace")==0){ | |
228 desc->charspace=atoi(p[1]); | |
229 continue; | |
230 } | |
231 if(pdb==2 && strcmp(p[0],"height")==0){ | |
232 desc->height=atoi(p[1]); | |
233 continue; | |
234 } | |
235 } else | |
214 | 236 |
213 | 237 if(strcmp(section,"[characters]")==0){ |
219 | 238 if(pdb==3){ |
213 | 239 int chr=p[0][0]; |
240 int start=atoi(p[1]); | |
241 int end=atoi(p[2]); | |
727 | 242 if(sub_unicode && (chr>=0x80)) chr=(chr<<8)+p[0][1]; |
706
8a7666a78f83
better .smi support and display two-byte characters- patch by Sunjin Yang
arpi_esp
parents:
340
diff
changeset
|
243 else if(strlen(p[0])!=1) chr=strtol(p[0],NULL,0); |
213 | 244 if(end<start) { |
13897
41a4fc8421e9
Converted printf calls to mp_msg, reduced verbosity.
diego
parents:
13641
diff
changeset
|
245 mp_msg(MSGT_OSD, MSGL_WARN, "error in font desc: end<start for char '%c'\n",chr); |
213 | 246 } else { |
247 desc->start[chr]=start; | |
248 desc->width[chr]=end-start+1; | |
249 desc->font[chr]=fontdb; | |
250 // printf("char %d '%c' start=%d width=%d\n",chr,chr,desc->start[chr],desc->width[chr]); | |
251 ++chardb; | |
252 } | |
253 continue; | |
254 } | |
255 } | |
13897
41a4fc8421e9
Converted printf calls to mp_msg, reduced verbosity.
diego
parents:
13641
diff
changeset
|
256 mp_msg(MSGT_OSD, MSGL_ERR, "Syntax error in font desc: %s",sor); |
13641 | 257 goto fail_out; |
213 | 258 |
259 } | |
260 fclose(f); | |
13641 | 261 f = NULL; |
213 | 262 |
12793
a9429d90157a
avoid using corrupted font descriptions patch by Daniel von Dincklage <danielvd+mpl@cs.colorado.edu>
faust3
parents:
12609
diff
changeset
|
263 if (first == 1) { |
13897
41a4fc8421e9
Converted printf calls to mp_msg, reduced verbosity.
diego
parents:
13641
diff
changeset
|
264 mp_msg(MSGT_OSD, MSGL_ERR, "%s is empty or a directory, ignoring.\n", fname); |
13641 | 265 goto fail_out; |
12793
a9429d90157a
avoid using corrupted font descriptions patch by Daniel von Dincklage <danielvd+mpl@cs.colorado.edu>
faust3
parents:
12609
diff
changeset
|
266 } |
a9429d90157a
avoid using corrupted font descriptions patch by Daniel von Dincklage <danielvd+mpl@cs.colorado.edu>
faust3
parents:
12609
diff
changeset
|
267 |
213 | 268 //printf("font: pos of U = %d\n",desc->start[218]); |
269 | |
270 for(i=0;i<=fontdb;i++){ | |
271 if(!desc->pic_a[i] || !desc->pic_b[i]){ | |
13897
41a4fc8421e9
Converted printf calls to mp_msg, reduced verbosity.
diego
parents:
13641
diff
changeset
|
272 mp_msg(MSGT_OSD, MSGL_ERR, "font: Missing bitmap(s) for sub-font #%d\n",i); |
13641 | 273 goto fail_out; |
213 | 274 } |
249 | 275 //if(factor!=1.0f) |
276 { | |
215 | 277 // re-sample alpha |
278 int f=factor*256.0f; | |
279 int size=desc->pic_a[i]->w*desc->pic_a[i]->h; | |
280 int j; | |
13897
41a4fc8421e9
Converted printf calls to mp_msg, reduced verbosity.
diego
parents:
13641
diff
changeset
|
281 mp_msg(MSGT_OSD, MSGL_DBG2, "font: resampling alpha by factor %5.3f (%d) ",factor,f);fflush(stdout); |
215 | 282 for(j=0;j<size;j++){ |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
728
diff
changeset
|
283 int x=desc->pic_a[i]->bmp[j]; // alpha |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
728
diff
changeset
|
284 int y=desc->pic_b[i]->bmp[j]; // bitmap |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
728
diff
changeset
|
285 |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
728
diff
changeset
|
286 #ifdef FAST_OSD |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
728
diff
changeset
|
287 x=(x<(255-f))?0:1; |
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
728
diff
changeset
|
288 #else |
249 | 289 |
250 | 290 x=255-((x*f)>>8); // scale |
291 //if(x<0) x=0; else if(x>255) x=255; | |
292 //x^=255; // invert | |
293 | |
249 | 294 if(x+y>255) x=255-y; // to avoid overflows |
295 | |
296 //x=0; | |
297 //x=((x*f*(255-y))>>16); | |
298 //x=((x*f*(255-y))>>16)+y; | |
215 | 299 //x=(x*f)>>8;if(x<y) x=y; |
250 | 300 |
249 | 301 if(x<1) x=1; else |
302 if(x>=252) x=0; | |
947
76fd9463b9d3
FAST_OSD option to disable font outline antialiasing
arpi_esp
parents:
728
diff
changeset
|
303 #endif |
250 | 304 |
215 | 305 desc->pic_a[i]->bmp[j]=x; |
250 | 306 // desc->pic_b[i]->bmp[j]=0; // hack |
215 | 307 } |
13897
41a4fc8421e9
Converted printf calls to mp_msg, reduced verbosity.
diego
parents:
13641
diff
changeset
|
308 mp_msg(MSGT_OSD, MSGL_DBG2, "DONE!\n"); |
215 | 309 } |
213 | 310 if(!desc->height) desc->height=desc->pic_a[i]->h; |
311 } | |
312 | |
313 j='_';if(desc->font[j]<0) j='?'; | |
12609
4be019266884
array initialization fix by SungKwanKang <ksquarekr at yahoo.com>
faust3
parents:
10272
diff
changeset
|
314 for(i=0;i<65536;i++) |
213 | 315 if(desc->font[i]<0){ |
316 desc->start[i]=desc->start[j]; | |
317 desc->width[i]=desc->width[j]; | |
318 desc->font[i]=desc->font[j]; | |
319 } | |
320 desc->font[' ']=-1; | |
321 desc->width[' ']=desc->spacewidth; | |
322 | |
19551 | 323 mp_msg(MSGT_OSD, MSGL_V, "Bitmap font %s loaded successfully! (%d chars)\n",fname,chardb); |
213 | 324 |
325 return desc; | |
13641 | 326 |
327 fail_out: | |
328 if (f) | |
329 fclose(f); | |
330 if (desc->fpath) | |
331 free(desc->fpath); | |
332 if (desc->name) | |
333 free(desc->name); | |
334 if (desc) | |
335 free(desc); | |
336 return NULL; | |
213 | 337 } |
338 | |
339 #if 0 | |
25100 | 340 int main(void){ |
213 | 341 |
339 | 342 read_font_desc("high_arpi.desc",1); |
213 | 343 |
344 } | |
345 #endif | |
7122
0dc9cb756b68
freetype 2.0/2.1+ support - disabled by default until bugs fixed
arpi
parents:
5928
diff
changeset
|
346 |