Unit Information Global Constants Types MFFFont

Main Object Information
this objects provides access to the mathan font file
it allows the output of ttf-like fonts in different styles,
sizes and alignments/directions

Fields
field namefield typedescription
FONTalign BYTEthe current alignment
FONTvis BYTEthe current direction
FONTfound booleantrue if font found
FONTbuf TBufStreaminterface to the font file
FONTopen BOOLEANtrue if font openstring
FONThead MFF_File_HEADERthe font-header structure of the font file
FONTstyle MFF_STYLE_Headerthe font-style structure of a font-style
FONTchar MFF_CHAR_Headerthe font-char structure of a char-entry in a font-style
FONTerror bytethe current error-code
FONTstyles MFF_ALL_STYLES_INFOthe main memory-mapped strcuture of the font-styles

Constructor(s)

constructor INIT(fontname,shortName:string);
field namefield typedescription
fontnamestringfilename of the font file (with path and extension)
shortNamestringa 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(s)

destructor DONE;
	×deletes the object:
	×removes all infos out of memory
	×closes font file if still openstring

Method(s)

procedure AddFont(fontname:string;shortName:string);
field namefield typedescription
fontnamestringthe path+filename of the new font file
shortNamestringa 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 namefield typedescription
namestringfont-name
sizeBYTEfont-size
optionsBYTEfont-options as fnt STANDARD,fntBOLD,fntITALIC
speedbooleantrue=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 namefield typedescription
alignmentBYTEalignment to set : horLEFT,horRIGHT,horCENTER,verTOP,verBOTTOM,verCENTER
visBYTEdirection 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 namefield typedescription
XINTEGERx-pixel-position where to start output
YINTEGERy-pixel-position where to start output
TEXTSTRINGthe string to display
ForeColorLONGINTthe color to be used
RETURNINTEGERthe 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 namefield typedescription
XINTEGERx-pixel-position where to start output
YINTEGERy-pixel-position where to start output
TEXTSTRINGthe string to display
ForeColorLONGINTthe color to be used
LX1INTEGERminimum x-pixel-coordinate
LY1INTEGERminimum y-pixel-coordinate
LX2INTEGERmaximum x-pixel-coordinate
LY2INTEGERmaximum y-pixel-coordinate
RETURNINTEGERthe 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 namefield typedescription
SSTRINGthe string which length should be calculated
RETURNLONGINTthe length calculated
	×method to get the dimension in pixels of the length of a text with this font style

function LOADED:BOOLEAN;
field namefield typedescription
RETURNBOOLEANreturns true if font file is loaded
	×method to deterine wether the font file is loaded or not

function GetFontName:STRING;
field namefield typedescription
RETURNSTRINGreturns name of the font
	×method to get the name of the font loaded

function GetFontSize:BYTE;
field namefield typedescription
RETURNBYTEreturns current font size
	×method to get the current font size

function GetFontStyle:BYTE;
field namefield typedescription
RETURNBYTEreturns current font style such as fntSTANDARD,fntBOLD,fntITALIC
	×method to get the current font style

function GetError:BYTE;
field namefield typedescription
RETURNBYTEreturns current error-code


function GetErrorString(ErrorCode:byte):string;
field namefield typedescription
ErrorCodebytethe error-code
RETURNstringreturns 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 namefield typedescription
styleNAMEstringthe font name
styleSIZEBYTEthe font size of the style
styleSPECIALbytethe 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 namefield typedescription
SPECP_SPECIFIC_STYLE_INFOindex 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 namefield typedescription
SPECP_SPECIFIC_STYLE_INFOindex of the style in memory-map-list
	×like READCHARSspeed only 8 times less memory usage

procedure DONECHARS(STYLEindex:byte);
field namefield typedescription
STYLEindexbyteindex of the style in memory-map-list
	×method removes char-data from memory


(c) 2001 Mathan Software created by PasDoc