/************************************************************************/ /* */ /* FontConverter V2.0 */ /* */ /* Freeware © 1992 by */ /* */ /* Andreas Baum */ /* Eugen-Roth-Straße 25 */ /* W-8430 Neumarkt */ /* Germany */ /* */ /* Convert Fonts in C-Source */ /* */ /* Usage: FontConverter_V2.0 */ /* */ /* Needs OS2 */ /* */ /* Compiler: DICE */ /* */ /* Compilerusage: DCC -oFontConverter_V2.0 FC_V2.0.c */ /* */ /************************************************************************/ #include #include #include struct FontRequester *FontRequester; struct FileRequester *FileRequester; struct TagItem *MyTags; struct WBArg *fargs; UWORD YSize, XSize, Baseline, BoldSmear, Accessors, Modulo; UWORD Dat_Value; ULONG Font, CharData, CharLoc, CharSpace, CharKern; ULONG In_Datei, Out_Datei, Dat_Length; ULONG x, y; UBYTE Style, Flags, LoChar, HiChar; UBYTE In_Name[200], Out_Name[200], Font_Name[50], Data[100], Compal[]=":"; main() { printf("\n\033[1m\033[33mFontConverter_V2.0\033[0m\n\n"); printf("© 1992 by Baum Andreas\n\n"); FontRequester=(struct FontRequester *)AllocAslRequest(ASL_FontRequest,NULL); MyTags=(struct MyTags *)AllocateTagItems(3); MyTags[0].ti_Tag=ASL_Hail; MyTags[0].ti_Data="Select Font"; MyTags[1].ti_Tag=ASL_MaxHeight; MyTags[1].ti_Data=25; MyTags[2].ti_Tag=TAG_DONE; if(AslRequest(FontRequester, MyTags)) { FreeTagItems(MyTags); FreeAslRequest(FontRequester); sprintf(In_Name,"Fonts:%s/%d",strtok(FontRequester->fo_Attr.ta_Name,"."),FontRequester->fo_Attr.ta_YSize); sprintf(Font_Name,"%s%d",strtok(FontRequester->fo_Attr.ta_Name,"."),FontRequester->fo_Attr.ta_YSize); if(In_Datei=Open(In_Name,MODE_OLDFILE)) { Seek(In_Datei,48,OFFSET_BEGINNING); Read(In_Datei,&Font,4); if(Font==0x1a0f80) { FileRequester=(struct FileRequester *)AllocAslRequest(ASL_FileRequest,NULL); MyTags=(struct MyTags *)AllocateTagItems(5); MyTags[0].ti_Tag=ASL_Hail; MyTags[0].ti_Data="Select Datei"; MyTags[1].ti_Tag=ASL_FuncFlags; MyTags[1].ti_Data=FILF_SAVE; MyTags[2].ti_Tag=ASL_File; MyTags[2].ti_Data="Font.c"; MyTags[3].ti_Tag=ASL_Dir; MyTags[3].ti_Data="Ram:"; MyTags[4].ti_Tag=TAG_DONE; if(AslRequest(FileRequester, MyTags)) { printf("\033[3mWorking so hard ... Please Wait\033[0m\n\n"); FreeTagItems(MyTags); FreeAslRequest(FileRequester); if(strcmp(FileRequester->rf_Dir[strlen(FileRequester->rf_Dir)-1],Compal[0])) sprintf(Out_Name,"%s/%s",FileRequester->rf_Dir,FileRequester->rf_File); else sprintf(Out_Name,"%s%s",FileRequester->rf_Dir,FileRequester->rf_File); Out_Datei=Open(Out_Name,MODE_NEWFILE); Seek(In_Datei,110,OFFSET_BEGINNING); Read(In_Datei,&YSize,2); Read(In_Datei,&Style,1); Read(In_Datei,&Flags,1); Read(In_Datei,&XSize,2); Read(In_Datei,&Baseline,2); Read(In_Datei,&BoldSmear,2); Read(In_Datei,&Accessors,2); Read(In_Datei,&LoChar,1); Read(In_Datei,&HiChar,1); Read(In_Datei,&CharData,4); Read(In_Datei,&Modulo,2); Read(In_Datei,&CharLoc,4); Read(In_Datei,&CharSpace,4); Read(In_Datei,&CharKern,4); Dat_Length=(Modulo*YSize+(HiChar-LoChar+2)*4)/2; if(CharSpace!=0) Dat_Length=Dat_Length+(HiChar-LoChar+2); if(CharKern!=0) Dat_Length=Dat_Length+(HiChar-LoChar+2); sprintf(Data,"/* FontConverter_V2.0 © 1992 by Andreas Baum */\n\n"); Write(Out_Datei,Data,strlen(Data)); sprintf(Data,"#include \n\n"); Write(Out_Datei,Data,strlen(Data)); sprintf(Data,"UWORD %sdump[] =\n",Font_Name); Write(Out_Datei,Data,strlen(Data)); sprintf(Data," {\n"); Write(Out_Datei,Data,strlen(Data)); y=1; for(x=0;x