Open CASCADE Technology
6.5.4
|
This class permits to manage MDTV fonts.
Warning: A FontManager is associated to a xxx.mft font file
The coordinates of the outline vectors of each character
must be given in the space defined by the font bounding box
#include <MFT_FontManager.hxx>
Public Member Functions | |
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. | |
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. | |
void | Destroy () |
Save the font file when the open mode is Write or ReadWrite and Close it in all the case. | |
~MFT_FontManager () | |
void | SetFont (const Aspect_FontStyle &aFont) |
Updates the font name. Trigger: If the font file is not opened in WriteOnly or ReadWrite mode | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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. | |
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() | |
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() | |
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 | |
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 | |
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 | |
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. | |
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 | |
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 | |
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. | |
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. | |
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. | |
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. | |
void | BoundingBox (Standard_Integer &aMinX, Standard_Integer &aMinY, Standard_Integer &aMaxX, Standard_Integer &aMaxY) const |
Retrieves the bounding box of the font. | |
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_Integer | PaintType () const |
Retrieves the paint type of the font. | |
Standard_Boolean | FixedPitch () const |
Retrieves the fixed pitch flag of the font | |
Quantity_PlaneAngle | ItalicAngle () const |
Retrieves the italic angle of the font | |
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. | |
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> | |
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_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_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. | |
Aspect_FontStyle | Font () const |
Retrieves the font descriptor of this font | |
Standard_Boolean | IsComposite () const |
Returns TRUE if the font is composite. Example: KANJI fonts returns TRUE. | |
Standard_CString | Encoding (const Standard_Integer aPosition) |
Returns the encoding of the char position <aPosition>. //! Trigger - If the char is not defined | |
Standard_Integer | Encoding (const Standard_CString anEncoding) |
Returns the char position from the encoding <anEncoding>. //! Trigger - If the char is not defined | |
void | Dump () |
Dumps the font descriptor of all characters. | |
void | Dump (const Standard_Character aChar) |
Dumps the font descriptor of the character <aChar>. | |
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_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. | |
Quantity_Length | UnderlinePosition () const |
Returns the Underline descent position from the origin of the text according to the current font attributes. | |
Static Public Member Functions | |
static Standard_Boolean | IsKnown (const Standard_CString anAliasName) |
Returns TRUE if the font $CSF_MDTVFontDirectory/<anAliasName>.mft does exist. | |
static Aspect_FontStyle | Font (const Standard_CString anAliasName) |
Retrieves the font descriptor from an existing font //! Trigger - If the font does not exist. | |
static 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 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_Integer | MaxCommandValues () |
Returns the max values of any defined command | |
static 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. |
MFT_FontManager::MFT_FontManager | ( | const Standard_CString | anAliasName | ) |
MFT_FontManager::MFT_FontManager | ( | const Aspect_FontStyle & | aFont, |
const OSD_OpenMode | aFileMode = OSD_ReadOnly , |
||
const Standard_Boolean | isComposite = Standard_False |
||
) |
MFT_FontManager::~MFT_FontManager | ( | ) | [inline] |
void MFT_FontManager::AddCommand | ( | const MFT_TypeOfCommand | aCommand | ) |
void MFT_FontManager::AddValue | ( | const Standard_Integer | aValue | ) |
void MFT_FontManager::AddValue | ( | const Standard_Real | aValue | ) |
void MFT_FontManager::AddValue | ( | const Standard_CString | aValue | ) |
void MFT_FontManager::BoundingBox | ( | Standard_Integer & | aMinX, |
Standard_Integer & | aMinY, | ||
Standard_Integer & | aMaxX, | ||
Standard_Integer & | aMaxY | ||
) | const |
void MFT_FontManager::CharBoundingBox | ( | const Standard_Integer | aPosition, |
Standard_Integer & | aMinX, | ||
Standard_Integer & | aMinY, | ||
Standard_Integer & | aMaxX, | ||
Standard_Integer & | aMaxY | ||
) |
Standard_Boolean MFT_FontManager::CharSize | ( | const Standard_Character | aChar, |
Quantity_Length & | aWidth, | ||
Quantity_Length & | aLbearing, | ||
Quantity_Length & | aRbearing, | ||
Quantity_Length & | anAscent, | ||
Quantity_Length & | aDescent | ||
) |
Standard_Boolean MFT_FontManager::CharSize | ( | const Standard_ExtCharacter | aChar, |
Quantity_Length & | aWidth, | ||
Quantity_Length & | aLbearing, | ||
Quantity_Length & | aRbearing, | ||
Quantity_Length & | anAscent, | ||
Quantity_Length & | aDescent | ||
) |
void MFT_FontManager::DrawText | ( | const Handle< MFT_TextManager > & | aTextManager, |
const Standard_CString | aString, | ||
const Quantity_Length | anX, | ||
const Quantity_Length | anY, | ||
const Quantity_PlaneAngle | anOrientation = 0.0 |
||
) |
void MFT_FontManager::DrawText | ( | const Handle< MFT_TextManager > & | aTextManager, |
const Standard_ExtString | aString, | ||
const Quantity_Length | anX, | ||
const Quantity_Length | anY, | ||
const Quantity_PlaneAngle | anOrientation = 0.0 |
||
) |
void MFT_FontManager::Dump | ( | const Standard_Character | aChar | ) |
Standard_CString MFT_FontManager::Encoding | ( | const Standard_Integer | aPosition | ) |
Standard_Integer MFT_FontManager::Encoding | ( | const Standard_CString | anEncoding | ) |
Standard_Boolean MFT_FontManager::FixedPitch | ( | ) | const |
Aspect_FontStyle MFT_FontManager::Font | ( | ) | const |
static Aspect_FontStyle MFT_FontManager::Font | ( | const Standard_CString | anAliasName | ) | [static] |
static Aspect_FontStyle MFT_FontManager::Font | ( | const Standard_Integer | aRank | ) | [static] |
Standard_CString MFT_FontManager::FontAttribs | ( | Quantity_Length & | aWidth, |
Quantity_Length & | aHeight, | ||
Quantity_Length & | aDescent, | ||
Quantity_PlaneAngle & | aSlant, | ||
Quantity_Factor & | aPrecision, | ||
Standard_Boolean & | aCapsHeight | ||
) |
static Standard_Integer MFT_FontManager::FontNumber | ( | const Standard_CString | aFilter = "*" | ) | [static] |
Standard_Boolean MFT_FontManager::IsComposite | ( | ) | const |
static Standard_Boolean MFT_FontManager::IsKnown | ( | const Standard_CString | anAliasName | ) | [static] |
static Standard_Integer MFT_FontManager::MaxCommandValues | ( | ) | [static] |
Standard_Integer MFT_FontManager::PaintType | ( | ) | const |
static Standard_Boolean MFT_FontManager::Restore | ( | const Standard_CString | anAliasName | ) | [static] |
void MFT_FontManager::SetBoundingBox | ( | const Standard_Integer | aMinX = 0 , |
const Standard_Integer | aMinY = 0 , |
||
const Standard_Integer | aMaxX = 1000 , |
||
const Standard_Integer | aMaxY = 1000 |
||
) |
void MFT_FontManager::SetEncoding | ( | const Standard_Integer | aPosition, |
const Standard_CString | anEncoding | ||
) |
void MFT_FontManager::SetFont | ( | const Aspect_FontStyle & | aFont | ) |
void MFT_FontManager::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 |
||
) |
void MFT_FontManager::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 |
||
) |
void MFT_FontManager::SetItalicAngle | ( | const Quantity_PlaneAngle | anAngle = 0.0 | ) |
void MFT_FontManager::SetPaintType | ( | const Standard_Integer | aValue = 0 | ) |
void MFT_FontManager::TextSize | ( | const Standard_CString | aString, |
Quantity_Length & | aWidth, | ||
Quantity_Length & | anAscent, | ||
Quantity_Length & | aLbearing, | ||
Quantity_Length & | aDescent | ||
) |
void MFT_FontManager::TextSize | ( | const Standard_ExtString | aString, |
Quantity_Length & | aWidth, | ||
Quantity_Length & | anAscent, | ||
Quantity_Length & | aLbearing, | ||
Quantity_Length & | aDescent | ||
) |