-/* SWFFont: copy all t1 font outlines to a local
- array. */
-SWFFont::SWFFont(char*name, int id, char*filename)
-{
- if(!T1_GetFontName(id))
- T1_LoadFont(id);
-
- this->name = strdup(T1_GetFontFileName(id));
- this->fontid = strdup(name);
- this->t1id = id;
-
- char**a= T1_GetAllCharNames(id);
- int t, outlinepos=0;
- char*map[256];
-
- t=0;
- while(a[t])
- t++;
- this->charnum = t;
-
- if(!charnum)
- return;
- logf("<verbose> Font %s(%d): Storing %d outlines.\n", FIXNULL(name), id, charnum);
-
- this->standardtablesize = 256;
- if(this->charnum < this->standardtablesize)
- this->standardtablesize = this->charnum;
- this->standardtable = (char**)malloc(standardtablesize*sizeof(char*));
-
- for(t = 0; t < this->standardtablesize; t++) {
- char*name = T1_GetCharName(id,t);
- if(!name)
- name = "";
- standardtable[t] = strdup(name);
- }
-
- outline = (T1_OUTLINE**)malloc(charnum*sizeof(T1_OUTLINE*));
- charname = (char**)malloc(charnum*sizeof(char*));
- width = (int*)malloc(charnum*sizeof(int));
- memset(width, 0, charnum*sizeof(int));
- memset(charname, 0, charnum*sizeof(char*));
- used = (char*)malloc(charnum*sizeof(char));
- char2swfcharid = (U16*)malloc(charnum*2);
- swfcharid2char = (U16*)malloc(charnum*2);
- swfcharpos = 0;
-
- memset(used,0,charnum*sizeof(char));
-
- this->swfid = ++currentswfid;
-
- t=0;
- while(*a)
- {
- map[t] = *a;
- a++;
- t++;
- if(t==256 || !*a) {
- int s;
- for(s=t;s<256;s++)
- map[s] = ".notdef";
-
- int ret = T1_ReencodeFont(id, map);
- if(ret) {
- T1_DeleteFont(id);
- T1_LoadFont(id);
- int ret = T1_ReencodeFont(id, map);
- if(ret)
- fprintf(stderr,"Can't reencode font: (%s) ret:%d\n",filename, ret);
- }
-
- // parsecharacters
- for(s=0;s<t;s++)
- {
- char* name = T1_GetCharName(id, s);
- if(!name) name = "";
- this->outline[outlinepos] = T1_CopyOutline(T1_GetCharOutline(id, s, 100.0, 0));
- this->width[outlinepos] = T1_GetCharWidth(id, s);
- this->charname[outlinepos] = strdup(name);
- outlinepos++;
- }
- t=0;
- }
- }
-}
-
-/* free all tables, write out definefont tags */
-SWFFont::~SWFFont()