this objects provides access to the mathan font file
it allows the output of ttf-like fonts in different styles,
sizes and alignments/directions
| field name | field type | description |
| FONTalign | BYTE | the current alignment |
| FONTvis | BYTE | the current direction |
| FONTfound | boolean | true if font found |
| FONTbuf | TBufStream | interface to the font file |
| FONTopen | BOOLEAN | true if font openstring |
| FONThead | MFF_File_HEADER | the font-header structure of the font file |
| FONTstyle | MFF_STYLE_Header | the font-style structure of a font-style |
| FONTchar | MFF_CHAR_Header | the font-char structure of a char-entry in a font-style |
| FONTerror | byte | the current error-code |
| FONTstyles | MFF_ALL_STYLES_INFO | the main memory-mapped strcuture of the font-styles |
constructor INIT(fontname,shortName:string);
| field name | field type | description |
| fontname | string | filename of the font file (with path and extension) |
| shortName | string | a short name used for setfontstyle to not use filename every time |
×initializes the object:
×opens the font file, saves different info's in memory
destructor DONE;
×deletes the object:
×removes all infos out of memory
×closes font file if still openstring
procedure AddFont(fontname:string;shortName:string);
| field name | field type | description |
| fontname | string | the path+filename of the new font file |
| shortName | string | a short name used for setfontstyle to not use filename every time |
×add an other font file to the object
procedure SetFontStyle(name:string;size:BYTE;options:BYTE;speed:boolean);
| field name | field type | description |
| name | string | font-name |
| size | BYTE | font-size |
| options | BYTE | font-options as fnt STANDARD,fntBOLD,fntITALIC |
| speed | boolean | true=speed increasd,false=memory usage reduced |
×selects a special font style:
×if this style is not allready memory-mapped it will be mapped
procedure SetFontJustify(alignment:BYTE;vis:BYTE);
| field name | field type | description |
| alignment | BYTE | alignment to set : horLEFT,horRIGHT,horCENTER,verTOP,verBOTTOM,verCENTER |
| vis | BYTE | direction to set : LT (left to right),TBH(top to bottom on head) etc. |
×sets the alignment and direction with which text will be displayed
function OutText5(X,Y:INTEGER;TEXT:STRING;ForeColor:LONGINT):INTEGER;
| field name | field type | description |
| X | INTEGER | x-pixel-position where to start output |
| Y | INTEGER | y-pixel-position where to start output |
| TEXT | STRING | the string to display |
| ForeColor | LONGINT | the color to be used |
| RETURN | INTEGER | the x-pixel-position of a string to be displayed just after this |
×main method of the object to display a string on the screen
function OutText5(X:INTEGER;Y:INTEGER;TEXT:STRING;ForeColor:LONGINT;LX1,LY1,LX2,LY2:INTEGER):INTEGER;
| field name | field type | description |
| X | INTEGER | x-pixel-position where to start output |
| Y | INTEGER | y-pixel-position where to start output |
| TEXT | STRING | the string to display |
| ForeColor | LONGINT | the color to be used |
| LX1 | INTEGER | minimum x-pixel-coordinate |
| LY1 | INTEGER | minimum y-pixel-coordinate |
| LX2 | INTEGER | maximum x-pixel-coordinate |
| LY2 | INTEGER | maximum y-pixel-coordinate |
| RETURN | INTEGER | the x-pixel-position of a string to be displayed just after this |
×method to display string on screen in limited area
overloads OutText5
function GetLength(S:STRING):LONGINT;
| field name | field type | description |
| S | STRING | the string which length should be calculated |
| RETURN | LONGINT | the length calculated |
×method to get the dimension in pixels of the length of a text with this font style
function LOADED:BOOLEAN;
| field name | field type | description |
| RETURN | BOOLEAN | returns true if font file is loaded |
×method to deterine wether the font file is loaded or not
function GetFontName:STRING;
| field name | field type | description |
| RETURN | STRING | returns name of the font |
×method to get the name of the font loaded
function GetFontSize:BYTE;
| field name | field type | description |
| RETURN | BYTE | returns current font size |
×method to get the current font size
function GetFontStyle:BYTE;
| field name | field type | description |
| RETURN | BYTE | returns current font style such as fntSTANDARD,fntBOLD,fntITALIC |
×method to get the current font style
function GetError:BYTE;
| field name | field type | description |
| RETURN | BYTE | returns current error-code |
function GetErrorString(ErrorCode:byte):string;
| field name | field type | description |
| ErrorCode | byte | the error-code |
| RETURN | string | returns the error-string of the given error-code |
×method to get an error-string of a specific error-code
procedure DeSelectFontStyle(styleNAME:string;styleSIZE:BYTE;styleSPECIAL:byte);
| field name | field type | description |
| styleNAME | string | the font name |
| styleSIZE | BYTE | the font size of the style |
| styleSPECIAL | byte | the font style of the style |
×method to unmap an font style
×removes all char data of the given font style out of memory
procedure CheckCRC;
×method to calculate the CRC-checksum
procedure errorSTREAM;
method to exit if stream is not ok
procedure checkSTREAM;
×method to check wether stream is ok or not
procedure READCHARSspeed(SPEC:P_SPECIFIC_STYLE_INFO);
| field name | field type | description |
| SPEC | P_SPECIFIC_STYLE_INFO | index of the style in memory-map-list |
×methods reads all chars of a font from file into memory
procedure READCHARSsize(SPEC:P_SPECIFIC_STYLE_INFO);
| field name | field type | description |
| SPEC | P_SPECIFIC_STYLE_INFO | index of the style in memory-map-list |
×like READCHARSspeed only 8 times less memory usage
procedure DONECHARS(STYLEindex:byte);
| field name | field type | description |
| STYLEindex | byte | index of the style in memory-map-list |
×method removes char-data from memory
(c) 2001 Mathan Software created by PasDoc