#include <MFT_FontManager.hxx>
Public Member Functions | |
| Standard_EXPORT | MFT_FontManager (const Standard_CString anAliasName) |
| Gives access to the font <analiasname> associated to the file $CSF_MDTVFontDirectory/<analiasname>.mft in ReadOnly access mode. Warning: If the symbol CSF_MDTVFontDirectory is not defined try to reads or writes in $PWD directory. Example: myFontManager = new MFT_FontManager("Helvetica-Bold") permits to access to the file $CSF_MDTVFontDirectory/"helvetica-bold.mft" Trigger: If the font file don't exist or if the file don't have an MFT signature. . | |
| Standard_EXPORT | MFT_FontManager (const Aspect_FontStyle &aFont, const OSD_OpenMode aFileMode=OSD_ReadOnly, const Standard_Boolean isComposite=Standard_False) |
| Gives access to the font <afont> associated to the file $CSF_MDTVFontDirectory/<aFont.AliasName()>.mft with the open mode <afilemode> and the composite flag <iscomposite>. Example: The flag must be sets to TRUE for KANJI extended fonts. Warning: If the symbol CSF_MDTVFontDirectory is not defined try to reads or writes in $PWD directory. Trigger: If <afilemode> is ReadOnly or ReadWrite and the font file don't exist or if the file don't have an MFT signature. . | |
| Standard_EXPORT void | Destroy () |
| Save the font file when the open mode is Write or ReadWrite and Close it in all the case. . | |
| ~MFT_FontManager () | |
| Standard_EXPORT void | SetFont (const Aspect_FontStyle &aFont) |
| Updates the font name. Trigger: If the font file is not opened in WriteOnly or ReadWrite mode . | |
| Standard_EXPORT void | SetChar (const Standard_Character aChar) |
| Defines and Enable the char <achar> for writing. Trigger: If the font file is not opened in WriteOnly or ReadWrite mode or the char is already defined. . | |
| Standard_EXPORT void | SetAccentChar (const Standard_Character aChar) |
| Defines and Enable the accent char <achar> for writing. Trigger: If the font file is not opened in WriteOnly or ReadWrite mode or the char is already defined. . | |
| Standard_EXPORT void | SetChar (const Standard_ExtCharacter aChar) |
| Defines and Enable the char <achar> for writing. This char being current for adding command. Warning: The char must have an UNICODE UCS2 encoding. Trigger: If the font file is not opened in WriteOnly or ReadWrite mode or if the font is not a composite font. . | |
| Standard_EXPORT void | SetEncoding (const Standard_Integer aPosition, const Standard_CString anEncoding) |
| Changes the default encoding of the char position <aposition>. Example: SetEncoding(233,"eacute") change the default encoding of the char position 233 from "Oslash" to "eacute". //! Trigger - If the font file is not opened in WriteOnly or ReadWrite mode. or if the char encoding is not defined. . | |
| Standard_EXPORT void | DelChar (const Standard_Character aChar) |
| Remove the definition of the char <achar> //! Trigger - If the font file is not opened in WriteOnly or ReadWrite mode. . | |
| Standard_EXPORT void | DelChar (const Standard_ExtCharacter aChar) |
| Remove the definition of the char <achar> This char being current for adding command. //! Trigger - If the font file is not opened in WriteOnly or ReadWrite mode or if the font is not a composite font. . | |
| Standard_EXPORT void | AddCommand (const MFT_TypeOfCommand aCommand) |
| Adds the command <acommand> of <anumberofvalues> to describe the current char. This command being current for adding parameters if any. //!---Purpose Trigger - If the font file is not opened in WriteOnly or ReadWrite mode or if a current char don't have being defined. Warning: the last command of the char descriptor must have a type MFC_TOC_ENDCHAR. . | |
| Standard_EXPORT void | AddValue (const Standard_Integer aValue) |
| Adds the integer parameter <avalue> to fill the current command. //! Trigger - If the font file is not opened in WriteOnly or ReadWrite mode or if a current command don't have being defined, or if the number of values is > MaxCommandValues() . | |
| Standard_EXPORT void | AddValue (const Standard_Real aValue) |
| Adds the float parameter <avalue> to fill the current command. //! Trigger - If the font file is not opened in WriteOnly or ReadWrite mode or if a current command don't have being defined or if the number of values is > MaxCommandValues() . | |
| Standard_EXPORT void | AddValue (const Standard_CString aValue) |
| Adds the string parameter <avalue> to fill the current command. //! Trigger - If the font file is not opened in WriteOnly or ReadWrite mode or if a current command don't have being defined, or if the number of values is > MaxCommandValues() Warning: The max length of a string must be < MaxCommandValues()*4-1 . | |
| Standard_EXPORT void | SetBoundingBox (const Standard_Integer aMinX=0, const Standard_Integer aMinY=0, const Standard_Integer aMaxX=1000, const Standard_Integer aMaxY=1000) |
| Sets the bounding box of the font. //! Trigger - If the font file is not opened in WriteOnly or ReadWrite mode or if the bounding box has a wrong value. Warning: The bounding box coordinates default are : 0,0,1000,1000 . | |
| Standard_EXPORT void | SetFontMatrix (const Standard_Real M1=0.001, const Standard_Real M2=0.0, const Standard_Real M3=0.0, const Standard_Real M4=0.001, const Standard_Real M5=0.0, const Standard_Real M6=0.0) |
| Sets the font matrix. //! Trigger - If the font file is not opened in WriteOnly or ReadWrite mode Warning: The font matrix default are : 0.001,0,0,0.001,0,0 . | |
| Standard_EXPORT void | SetPaintType (const Standard_Integer aValue=0) |
| Sets the paint type of the font. //! Trigger - If the font file is not opened in WriteOnly or ReadWrite mode or if the value is not a Type 1 font value. Warning: The paint type <avalue> must be one of Type 1 font value 0 for FILL , 1 for STROKE or 2 for OUTLINE. . | |
| Standard_EXPORT void | SetFixedPitch (const Standard_Boolean aFlag=Standard_False) |
| Sets the fixed pitch flag of the font as TRUE if the font must have an fixed char width or FALSE if the font must have a proportionnal char width. //! Trigger - If the font file is not opened in WriteOnly or ReadWrite mode . | |
| Standard_EXPORT void | SetItalicAngle (const Quantity_PlaneAngle anAngle=0.0) |
| Sets the italic angle of the font given in RAD clock-wise from vertical. //! Trigger - If the font file is not opened in WriteOnly or ReadWrite mode . | |
| Standard_EXPORT void | ComputeBoundingBox () |
| Computes the bounding box of the font from the min-max of all chars of the font. Warning: this must be call after all characters has been defined. //! Trigger - If the font file is not opened in WriteOnly or ReadWrite mode. . | |
| Standard_EXPORT void | SetFontAttribs (const Quantity_Length aWidth, const Quantity_Length aHeight, const Quantity_PlaneAngle aSlant=0.0, const Quantity_Factor aPrecision=0.02, const Standard_Boolean aCapsHeight=Standard_False) |
| Sets the current font attributes. <awidth> : the maximum width of one character. <aheight> : the maximum height of one character according to the <acapsheight> parameter. <aslant> : the slant of one character given in RAD clock-wise from vertical. <aprecision> : the relative interpolator precision is the maximum flatness error deflection for the curves. <acapsheight> : if TRUE the font height is apply only on the ascent component of the characters; if FALSE the font height is apply both on the ascent and descent components of the characters. . | |
| Standard_EXPORT void | DrawText (const Handle(MFT_TextManager)&aTextManager, const Standard_CString aString, const Quantity_Length anX, const Quantity_Length anY, const Quantity_PlaneAngle anOrientation=0.0) |
| Drawn an ANSI text <atextmanager> : the draw manager to call for each vertex of the string. <astring> : the string to interpret <anx>,<any> : the position of the text <anorientation> : the orientation angle in RAD from horizontal. . | |
| Standard_EXPORT void | DrawText (const Handle(MFT_TextManager)&aTextManager, const Standard_ExtString aString, const Quantity_Length anX, const Quantity_Length anY, const Quantity_PlaneAngle anOrientation=0.0) |
| Drawn an EXTENDED text <atextmanager> : the draw manager to call for each vertex of the string. <astring> : the string to interpret <anx>,<any> : the position of the text <anorientation> : the orientation angle in RAD from horizontal. //! Trigger - If the font is not a composite font and the string is not ASCII. . | |
| Standard_EXPORT void | BoundingBox (Standard_Integer &aMinX, Standard_Integer &aMinY, Standard_Integer &aMaxX, Standard_Integer &aMaxY) const |
| Retrieves the bounding box of the font. . | |
| Standard_EXPORT void | CharBoundingBox (const Standard_Integer aPosition, Standard_Integer &aMinX, Standard_Integer &aMinY, Standard_Integer &aMaxX, Standard_Integer &aMaxY) |
| Retrieves the bounding box of a character. //! Trigger - If the position <aposition> is < 0 or > MaxCharPosition(). . | |
| Standard_EXPORT Standard_Integer | PaintType () const |
| Retrieves the paint type of the font. . | |
| Standard_EXPORT Standard_Boolean | FixedPitch () const |
| Retrieves the fixed pitch flag of the font . | |
| Standard_EXPORT Quantity_PlaneAngle | ItalicAngle () const |
| Retrieves the italic angle of the font . | |
| Standard_EXPORT Standard_CString | FontAttribs (Quantity_Length &aWidth, Quantity_Length &aHeight, Quantity_Length &aDescent, Quantity_PlaneAngle &aSlant, Quantity_Factor &aPrecision, Standard_Boolean &aCapsHeight) |
| Runs the interpretor with the current attributes setting (font and text attributes) and returns : The max char width of the font CharSet <awidth>. The max char height of the font CharSet <aheight>. The max char descent value below the baseline <adescent> The slant angle of the font <aslant> The interpolator precision of the font <aprecision> The caps height flag <acapsheight> The FULL font name. . | |
| Standard_EXPORT void | TextSize (const Standard_CString aString, Quantity_Length &aWidth, Quantity_Length &anAscent, Quantity_Length &aLbearing, Quantity_Length &aDescent) |
| Runs the interpretor on the ASCII text <astring> with the current font attributes setting and returns : The string width <awidth>. The string ascent <anascent>. The string left bearing value from the origine <albearing> The string descent value below the baseline <adescent> . | |
| Standard_EXPORT void | TextSize (const Standard_ExtString aString, Quantity_Length &aWidth, Quantity_Length &anAscent, Quantity_Length &aLbearing, Quantity_Length &aDescent) |
| Runs the interpretor on the EXTENDED text <astring> with the current font attributes setting and returns : The string width <awidth>. The string ascent <anascent>. The string left bearing value from the origine <albearing> The string descent value below the baseline <adescent> //! Trigger - If the font is not a composite font and the string is not ASCII. . | |
| Standard_EXPORT Standard_Boolean | CharSize (const Standard_Character aChar, Quantity_Length &aWidth, Quantity_Length &aLbearing, Quantity_Length &aRbearing, Quantity_Length &anAscent, Quantity_Length &aDescent) |
| Runs the interpretor with the current attributes setting (font attributes) and returns : The char width <awidth>. The char left bearing <albearing>. The char right bearing <arbearing>. The char ascent <anascent>. The char descent value below the baseline <adescent> And returns TRUE if the character is defined. . | |
| Standard_EXPORT Standard_Boolean | CharSize (const Standard_ExtCharacter aChar, Quantity_Length &aWidth, Quantity_Length &aLbearing, Quantity_Length &aRbearing, Quantity_Length &anAscent, Quantity_Length &aDescent) |
| Runs the interpretor with the current attributes setting (font attributes) and returns : The extended char width <awidth>. The extended char left bearing <albearing>. The extended char right bearing <arbearing>. The extended char ascent <anascent>. The extended char descent value below the baseline <adescent> And returns TRUE if the character is defined. //! Trigger - If the font is not a composite font and the char is not ASCII. . | |
| Standard_EXPORT Aspect_FontStyle | Font () const |
| Retrieves the font descriptor of this font . | |
| Standard_EXPORT Standard_Boolean | IsComposite () const |
| Returns TRUE if the font is composite. Example: KANJI fonts returns TRUE. . | |
| Standard_EXPORT Standard_CString | Encoding (const Standard_Integer aPosition) |
| Returns the encoding of the char position <aposition>. //! Trigger - If the char is not defined . | |
| Standard_EXPORT Standard_Integer | Encoding (const Standard_CString anEncoding) |
| Returns the char position from the encoding <anencoding>. //! Trigger - If the char is not defined . | |
| Standard_EXPORT void | Dump () |
| Dumps the font descriptor of all characters. . | |
| Standard_EXPORT void | Dump (const Standard_Character aChar) |
| Dumps the font descriptor of the character <achar>. . | |
| Standard_EXPORT void | Dump (const Standard_ExtCharacter aChar) |
| Dumps the font descriptor of the extended character <achar>. //! Trigger - If the font is not a composite font. . | |
| Standard_EXPORT Standard_Boolean | Save () |
| Saves the entire MFT font in an ASCII format readable by the Restore() method. to the file $CSF_MDTVFontDirectory/<analiasname>.dat And returns TRUE if the file have been saves correctly. . | |
| Standard_EXPORT Quantity_Length | UnderlinePosition () const |
| Returns the Underline descent position from the origin of the text according to the current font attributes. . | |
| Standard_EXPORT const | Handle (Standard_Type)&DynamicType() const |
Static Public Member Functions | |
| static Standard_EXPORT Standard_Boolean | IsKnown (const Standard_CString anAliasName) |
| Returns TRUE if the font $CSF_MDTVFontDirectory/<analiasname>.mft does exist. . | |
| static Standard_EXPORT Aspect_FontStyle | Font (const Standard_CString anAliasName) |
| Retrieves the font descriptor from an existing font //! Trigger - If the font does not exist. . | |
| static Standard_EXPORT Standard_Integer | FontNumber (const Standard_CString aFilter="*") |
| Returns the MFT font number available in the directory $CSF_MDTVFontDirectory according to the filter : "-foundry-family-weight-slant-swidth-adstyl-pixelsize-pointsize- <br> resx-resy-spacing-avdWidth-registry-encoding" Examples: number = MFT_FontMAnager::FontNumber("-euclid3"); returns only the euclid3 fonts. number = MFT_FontMAnager::FontNumber( "-*-*-*-*-*-*-*-*-*-*-*-*-japanese"); returns only the japanese fonts. . | |
| static Standard_EXPORT Aspect_FontStyle | Font (const Standard_Integer aRank) |
| Retrieves the font descriptor of index <arank> from the directory $CSF_MDTVFontDirectory //! Trigger - If the font rank <arank> is < 1 or > FontNumber(). . | |
| static Standard_EXPORT Standard_Integer | MaxCommandValues () |
| Returns the max values of any defined command . | |
| static Standard_EXPORT Standard_Boolean | Restore (const Standard_CString anAliasName) |
| Restores the entire MFT font from the file $CSF_MDTVFontDirectory/<analiasname>.dat And returns TRUE if the file have been restores correctly. . | |
Private Member Functions | |
| Standard_EXPORT Standard_Boolean | Close () |
| Saves updated records and Close this file. Returns TRUE if the file was successfully closed. . | |
| Standard_EXPORT Standard_Integer | MaxCharPosition () const |
| Returns the max position of any defined char in the header of the file according with the type of the font. . | |
| Standard_EXPORT void | SetTextAttribs (const Standard_CString aString, const Quantity_PlaneAngle anOrientation=0.0) |
| Sets the text attributes. <astring> : the string to interpret <anorientation> : the orientation angle in RAD from horizontal. . | |
| Standard_EXPORT void | SetTextAttribs (const Standard_ExtString aString, const Quantity_PlaneAngle anOrientation=0.0) |
| Sets the extended text attributes. <astring> : the string to interpret <anorientation> : the orientation angle in RAD from horizontal. //! Trigger - If the font is not a composite font and the string is not ASCII. . | |
| Standard_EXPORT Standard_Boolean | IsDefinedChar (const Standard_Integer aPosition) const |
| Returns TRUE if the char at position <aposition> is defined in the header of the file. //! Trigger - If the position <aposition> is < 0 or > MaxCharPosition(). . | |
| Standard_EXPORT Standard_Integer | FirstDefinedChar () const |
| Returns the first defined char position in the header of the file.. . | |
| Standard_EXPORT Standard_Integer | LastDefinedChar () const |
| Returns the last defined char position in the header of the file.. . | |
| Standard_EXPORT void | SetChar (const Standard_Integer aPosition) |
| Enable the char at position <aposition> for reading. . | |
| Standard_EXPORT Standard_Boolean | DrawChar (const Handle(MFT_TextManager)&aTextManager, const Standard_Integer aPosition) |
| Drawn the char at position <aposition> with the draw manager <atextmanager>. and returns FALSE if the drawing must be ended. . | |
| Standard_EXPORT void | ComputeBoundingBox (const Standard_Integer aPosition) |
| Computes the bounding box of the char position <aposition>. . | |
| Standard_EXPORT void | Dump (const Standard_Integer aPosition) |
| Dumps the font descriptor of the character at position <aposition>. . | |
Static Private Member Functions | |
| static Standard_EXPORT MFT_FileHandle | Open (const TCollection_AsciiString &aFileName, const OSD_OpenMode aFileMode) |
| Open the file ,load and verify the header and returns a file handle >= 0 . | |
| static Standard_EXPORT Standard_Boolean | Close (const MFT_FileHandle &aFileHandle) |
| Close the file. Returns TRUE if the file was successfully closed. . | |
| static Standard_EXPORT Standard_Boolean | Read (MFT_FileRecord &aRecord) |
| Reads a record from the file. Returns TRUE if the file was successfully read. . | |
| static Standard_EXPORT Standard_Boolean | Write (MFT_FileRecord &aRecord) |
| Writes a record to the file. Returns TRUE if the file was successfully written. . | |
| static Standard_EXPORT Standard_Address | Locate (MFT_FileRecord &aRecord, const MFT_FilePosition &aFilePosition) |
| Locates an information from the file record. and returns the info address. Warning: May read or write the current record from/to the file and reload an other record according the file position info. . | |
| static Standard_EXPORT Standard_CString | Path (const TCollection_AsciiString &aFileName, const Standard_CString anExtension=".mft") |
| Computes the full path of the font file name $CSF_MDTVFontDirectory/<afilename><anextension> . | |
| static Standard_EXPORT MFT_CommandDescriptor | NextCommand (MFT_FileRecord &aRecord) |
| Returns the next command descriptor from the current char (see SetChar()). Warning: the last command of the char descriptor has a type MFC_TOC_ENDCHAR. . | |
| static Standard_EXPORT MFT_TypeOfValue | Value (const MFT_CommandDescriptor &aDescriptor, const Standard_Integer aRank) |
| Returns the value type at position <arank> from the descriptor command. //! Trigger - If the position <arank> is < 1 or > the command length. . | |
| static Standard_EXPORT Standard_Integer | IValue (MFT_FileRecord &aRecord, const Standard_Integer aRank) |
| Returns the integer parameter at position <arank> of the current command. //! Trigger --If the position <arank> is < 1 or > the command length. or if the value is not an INT value. . | |
| static Standard_EXPORT Standard_ShortReal | FValue (MFT_FileRecord &aRecord, const Standard_Integer aRank) |
| Returns the float parameter at position <arank> of the current command. //! Trigger - If the position <arank> is < 1 or > the command length. or if the value is not a FLOAT value. . | |
| static Standard_EXPORT Standard_CString | SValue (MFT_FileRecord &aRecord, const Standard_Integer aRank) |
| Returns the string parameter at position <arank> of the current command. //! Trigger - If the position <arank> is < 1 or > the command length. or if the value is not a STRING value. . | |
Private Attributes | |
| TCollection_AsciiString | myFileName |
| OSD_OpenMode | myFileMode |
| MFT_FileHandle | myFileHandle |
| Standard_Boolean | myIsComposite |
| Standard_Boolean | myIsFixedPitch |
| Standard_ShortReal | myItalicAngle |
| Standard_Integer | myPaintType |
| Standard_ShortReal | myCharWidth |
| Standard_ShortReal | myCharHeight |
| Standard_ShortReal | myCharSlant |
| Standard_ShortReal | myCharPrecision |
| Standard_Boolean | myCharCapsHeight |
| MFT_FileRecord | myFileHeader |
| MFT_FileRecord | myCharEntries |
| MFT_FileRecord | myCommandBuffer |
|
|
|
|
||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||||||||||
|
|
|
||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
|
|
||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||||||||||||||||||
|
|
|
|
|
|
||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
|
|
|
|
|
||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
|
|
|
|
|
||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
||||||||||||
|
|
|
|
|
|
|
|
|
||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||||||
|
|
|
|
|
|
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||
|
|
|
||||||||||||||||||||||||
|
|
|
||||||||||||||||||||||||
|
|
|
|
|
|
||||||||||||
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1.4.1