Path: utzoo!utgpu!watmath!watdcsu!dmurdoch From: dmurdoch@watdcsu.waterloo.edu (D.J. Murdoch - Statistics) Newsgroups: comp.sys.ibm.pc Subject: Re: Borland Graphics Interface (BGI) file formats?? Message-ID: <5424@watdcsu.waterloo.edu> Date: 14 Jan 89 20:05:14 GMT References: <392@deimos.cis.ksu.edu> <28@cpro.UUCP> <1892@daimi.dk> <1285@cc.helsinki.fi> <826@dinl.mmc.UUCP> Reply-To: dmurdoch@watdcsu.waterloo.edu (D.J. Murdoch - Statistics) Organization: U. of Waterloo, Ontario Lines: 68 I got the following from Compuserve's Borland forum. I haven't tested it at all, but it should be a start. It was called BGIFMT.TXT. I didn't write it and can't answer any questions about it. --------- cut here ----------- The following is what I have been able to decipher about the format of BGI font files. This is NOT from Borland International. Hope this helps someone start on a font designer program while we wait for BI to officially announce the format. FontSig : array[1..4] of byte; { PK#8#8 } FontDesc : array[1..199] of char; { null terminated string } { length can vary } EndOfDesc : char; { #26 } OffSetToFontData : word; { location of font information } { from beginning of file } FontName : array[1..4] of char; SizeOfFontInfo : word; UnKnown1 : byte; { Always 43????? } NumberOfChars : word; UnKnown2 : byte; FirstASCIIChar : byte; OffsetToCommands : word; { Add 2 offsets together to get } { location from beginning of file} UnKnown3 : byte; MaxXSize : shortint; UnKnown4 : byte; MinYSize : shortint; UnKnown5 : array[1..5] of byte; OffSetTable : array[1..# chars] of word; { contains offset to commands } { for drawing characters } WidthTable : array[1..# chars] of byte; The rest of the file contains a variable length list of 2 byte commands followed by 2 null characters. This is where the offset table helps you to locate the particular commands for each character. The 2 byte commands have the following format: Byte 1 --------------------------------- | 1 | | | | | | | | --------------------------------- ^ ^ ^ ^ ^ ^ ^ ^ | | | | | | | | | ---------------------------- X offset of command |------ always 1???? Byte 2 --------------------------------- 2nd byte of command | | | | | | | | | --------------------------------- ^ ^ ^ ^ ^ ^ ^ ^ | | | | | | | | | ---------------------------- Y offset of command |------ 0 = MoveTo command 1 = LineTo command The following is an example of the commands to draw the "!" character in the litt.chr font. 128 0 128 128 128 2 128 135 131 0 0 0 This would be translated to: MoveTo(x+0,y+0); LineTo(x+0,y+0); MoveTo(x+0,y+2); LineTo(x+0,y+7); MoveTo(x+3,y+0); ------------------ end of BGIFMT.TXT ---------------------