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