TalanSoft Toolkits  201707
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups Pages
List of all members
iFont Struct Referenceabstract
Inheritance diagram for iFont:
iUnknown

Detailed Description

Font interface.

Infos

virtual iHStringGetName () const =0
 Get the name of the font. {Property}. More...
 
virtual iHStringGetFamilyName () const =0
 Get the family name of the font. {Property}. More...
 
virtual iHStringGetStyleName () const =0
 Get the style name of the font. {Property}. More...
 
virtual iHStringGetFilePath () const =0
 Get the file path of the font. {Property}. More...
 
virtual tBool GetIsFixedResolution () const =0
 Return eTrue if the pixel size if fixed. More...
 
virtual tBool GetHasKerning () const =0
 Return eTrue if the font has kerning informations. {Property}. More...
 
virtual tU32 GetMaxResolution () const =0
 Return the maximum pixel size. {Property}. More...
 
virtual tBool GetIsInstance () const =0
 Return eTrue if this font is an instance. {Property}. More...
 

Instance

virtual iFontCreateFontInstance (iMaterial *apMaterial)=0
 Create an instance of this font. More...
 

Rendering parameters

virtual void SetTabSize (tU32 ulNumChar)=0
 Set the tabulation size. {Property}. More...
 
virtual tU32 GetTabSize () const =0
 Get the tabulation size. {Property}. More...
 
virtual void SetFiltering (tBool abLinear)=0
 Set the filtering mode. {Property}. More...
 
virtual tBool GetFiltering () const =0
 Get the filtering mode. {Property}. More...
 
virtual void SetColor (tU32 anColor)=0
 Set the default font color. {Property}. More...
 
virtual tU32 GetColor () const =0
 Get the default font color. {Property}. More...
 
virtual void SetBlendMode (eBlendMode aMode)=0
 Set the blending mode. {Property}. More...
 
virtual eBlendMode GetBlendMode () const =0
 Get the blending mode. {Property}. More...
 
virtual void SetSizeAndResolution (const sVec2f &avSize, const tU32 anResolution)=0
 Set the character rendering size and resolution. More...
 
virtual tU32 GetResolution () const =0
 Get the character's resolution. {Property}. More...
 
virtual sVec2f GetSize () const =0
 Get the character rendering size. {Property}. More...
 
virtual void SetDistanceField (tBool abDistanceField)=0
 Set whether the glyphs are using a distance field. {Property}. More...
 
virtual tBool GetDistanceField () const =0
 Get whether the glyphs are using a distance field. {Property}. More...
 

Metrics

virtual tF32 GetCharWidth (tU32 c) const =0
 Return the width of a character. More...
 
virtual tF32 GetCharHeight (tU32 c) const =0
 Return the height of a character. More...
 
virtual tF32 GetMaxCharWidth () const =0
 Return the maximum char width. {Property}. More...
 
virtual tF32 GetMaxCharHeight () const =0
 Return the maximum char height. {Property}. More...
 
virtual tF32 GetAverageCharWidth () const =0
 Return the average char width. More...
 
virtual tF32 GetAverageCharHeight () const =0
 Return the average char height. More...
 
virtual tF32 GetAscent () const =0
 Get the ascent (units above the base line) of characters. {Property}. More...
 
virtual tF32 GetDescent () const =0
 Get the descent (units below the base line) of characters. {Property}. More...
 
virtual tF32 GetInternalLeading () const =0
 Specifies the amount of leading (space) inside the bounds set by the height of the font. Accent marks and other diacritical characters may occur in this area. Might be zero. {Property}. More...
 
virtual tF32 GetLineGap () const =0
 The distance that must be placed between two lines of text. (also called External Leading) Might be zero. {Property}. More...
 
virtual tF32 GetHeight () const =0
 Get the height of a line (ascent + descent + linegap). {Property}. More...
 
virtual tU32 GetFirstChar () const =0
 Get the value of the first character defined in the font. {Property}. More...
 
virtual tU32 GetLastChar () const =0
 Get the value of the last character defined in the font. {Property}. More...
 
virtual tF32 GetAdvance (tU32 anChar) const =0
 Get the advance for the specified character. More...
 
virtual tF32 GetKerning (tU32 anPrevChar, tU32 anChar) const =0
 Get the kerning for the specified character. More...
 

Material and glyph cache

virtual tBool UpdateMaterial (tBool abUpdateMaterialStates)=0
 Update the font's material. More...
 
virtual tBool CacheText (const achar *aaszText)=0
 Cache the caracters contained in the passed string. More...
 
virtual tBool CacheRange (tU32 anFirst, tU32 anLast)=0
 Cache a range of character. More...
 
virtual tBool ClearCache ()=0
 Clear the glyph and texture caches. More...
 
virtual tIntPtr GetCacheID () const =0
 Get the ID of the current cache. {Property}. More...
 
virtual iMaterialGetMaterial () const =0
 Get the material used for the font's rendering. {Property}. More...
 
virtual sRectf GetCharTexCoo (tU32 c)=0
 Get the texture coordinate of a character. {Property}. More...
 
virtual iTextureGetCharTexture (tU32 anChar) const =0
 Get the texture in which the specified glyph is cached. {Property}. More...
 
virtual iBitmap2DGetCharBitmap (tU32 anChar) const =0
 Get the bitmaps in which the specified glyph is cached. {Property}. More...
 

Bitmap drawing

virtual sVec2i BlitChar (iBitmap2D *apBmp, tI32 anX, tI32 anY, tU32 anChar)=0
 Blit a character to the specified bitmap using the pixel size. More...
 
virtual sVec2i BlitCharStretch (iBitmap2D *apBmp, tI32 anX, tI32 anY, tU32 anChar)=0
 Blit a character to the specified bitmap to the current font size. More...
 
virtual sVec2i BlitCharEx (iBitmap2D *apBmp, tI32 anX, tI32 anY, tI32 anW, tI32 anH, tU32 anChar, eBlendMode aBlendMode)=0
 Blit a character to the specified bitmap with the specified size and blend mode. More...
 

Canvas drawing

virtual sRectf ComputeTextSize (const sRectf &aRect, const achar *aaszText, tFontFormatFlags aFormat)=0
 Compute text size in pixels. More...
 
virtual sRectf DrawText (ni::iCanvas *apCanvas, const sRectf &aposRect, tF32 afZ, const achar *aaszText, tFontFormatFlags aFormat)=0
 Draw text layed out in the specified rectangle. More...
 

Additional Inherited Members

- Public Member Functions inherited from iUnknown
virtual tBool IsOK () const =0
 Check if the object is valid. More...
 
virtual tI32 AddRef ()=0
 Signal that one more reference of the object has been created. More...
 
virtual tI32 Release ()=0
 Release a reference of the object. More...
 
virtual void DeleteThis ()=0
 Bypass any reference counting and delete this object. More...
 
virtual void Invalidate ()=0
 Invalidate the object. More...
 
virtual iUnknownQueryInterface (const tUUID &aIID)=0
 Query an interface. More...
 
virtual void ListInterfaces (iMutableCollection *apLst, tU32 anFlags) const =0
 Fill a UUID list containing the UUIDs of the implemented interfaces. More...
 
virtual tI32 SetNumRefs (tI32 anNumRefs)=0
 Set the reference counter directly. More...
 
virtual tI32 GetNumRefs () const =0
 Get the number of references to this object. More...
 

Member Function Documentation

virtual iHString* GetName ( ) const
pure virtual

Get the name of the font. {Property}.

virtual iHString* GetFamilyName ( ) const
pure virtual

Get the family name of the font. {Property}.

virtual iHString* GetStyleName ( ) const
pure virtual

Get the style name of the font. {Property}.

virtual iHString* GetFilePath ( ) const
pure virtual

Get the file path of the font. {Property}.

virtual tBool GetIsFixedResolution ( ) const
pure virtual

Return eTrue if the pixel size if fixed.

Remarks
Fixed size fonts are generaly bitmap fonts. {Property}
virtual tBool GetHasKerning ( ) const
pure virtual

Return eTrue if the font has kerning informations. {Property}.

virtual tU32 GetMaxResolution ( ) const
pure virtual

Return the maximum pixel size. {Property}.

virtual tBool GetIsInstance ( ) const
pure virtual

Return eTrue if this font is an instance. {Property}.

virtual iFont* CreateFontInstance ( iMaterial apMaterial)
pure virtual

Create an instance of this font.

Parameters
apMaterialis the material that the font will use instead of creating its own.
virtual void SetTabSize ( tU32  ulNumChar)
pure virtual

Set the tabulation size. {Property}.

virtual tU32 GetTabSize ( ) const
pure virtual

Get the tabulation size. {Property}.

virtual void SetFiltering ( tBool  abLinear)
pure virtual

Set the filtering mode. {Property}.

virtual tBool GetFiltering ( ) const
pure virtual

Get the filtering mode. {Property}.

virtual void SetColor ( tU32  anColor)
pure virtual

Set the default font color. {Property}.

virtual tU32 GetColor ( ) const
pure virtual

Get the default font color. {Property}.

virtual void SetBlendMode ( eBlendMode  aMode)
pure virtual

Set the blending mode. {Property}.

virtual eBlendMode GetBlendMode ( ) const
pure virtual

Get the blending mode. {Property}.

virtual void SetSizeAndResolution ( const sVec2f avSize,
const tU32  anResolution 
)
pure virtual

Set the character rendering size and resolution.

Remarks
If the avSize is (0,0) the pixel size is used as current size.
virtual tU32 GetResolution ( ) const
pure virtual

Get the character's resolution. {Property}.

virtual sVec2f GetSize ( ) const
pure virtual

Get the character rendering size. {Property}.

virtual void SetDistanceField ( tBool  abDistanceField)
pure virtual

Set whether the glyphs are using a distance field. {Property}.

virtual tBool GetDistanceField ( ) const
pure virtual

Get whether the glyphs are using a distance field. {Property}.

virtual tF32 GetCharWidth ( tU32  c) const
pure virtual

Return the width of a character.

Remarks
Passing zero will return the default width. {Property}
virtual tF32 GetCharHeight ( tU32  c) const
pure virtual

Return the height of a character.

Remarks
Passing zero will return the default height. {Property}
virtual tF32 GetMaxCharWidth ( ) const
pure virtual

Return the maximum char width. {Property}.

virtual tF32 GetMaxCharHeight ( ) const
pure virtual

Return the maximum char height. {Property}.

virtual tF32 GetAverageCharWidth ( ) const
pure virtual

Return the average char width.

Remarks
Generally defined as the width of the letter x. {Property}
virtual tF32 GetAverageCharHeight ( ) const
pure virtual

Return the average char height.

Remarks
Generally defined as the height of the letter x. {Property}
virtual tF32 GetAscent ( ) const
pure virtual

Get the ascent (units above the base line) of characters. {Property}.

virtual tF32 GetDescent ( ) const
pure virtual

Get the descent (units below the base line) of characters. {Property}.

virtual tF32 GetInternalLeading ( ) const
pure virtual

Specifies the amount of leading (space) inside the bounds set by the height of the font. Accent marks and other diacritical characters may occur in this area. Might be zero. {Property}.

virtual tF32 GetLineGap ( ) const
pure virtual

The distance that must be placed between two lines of text. (also called External Leading) Might be zero. {Property}.

virtual tF32 GetHeight ( ) const
pure virtual

Get the height of a line (ascent + descent + linegap). {Property}.

virtual tU32 GetFirstChar ( ) const
pure virtual

Get the value of the first character defined in the font. {Property}.

virtual tU32 GetLastChar ( ) const
pure virtual

Get the value of the last character defined in the font. {Property}.

virtual tF32 GetAdvance ( tU32  anChar) const
pure virtual

Get the advance for the specified character.

virtual tF32 GetKerning ( tU32  anPrevChar,
tU32  anChar 
) const
pure virtual

Get the kerning for the specified character.

virtual tBool UpdateMaterial ( tBool  abUpdateMaterialStates)
pure virtual

Update the font's material.

Parameters
abUpdateMaterialStatesif true the states will set otherwise only the material's base channel texture is set to the current glyph cache's texture.
Returns
eFalse on failure, else eTrue.
virtual tBool CacheText ( const achar aaszText)
pure virtual

Cache the caracters contained in the passed string.

virtual tBool CacheRange ( tU32  anFirst,
tU32  anLast 
)
pure virtual

Cache a range of character.

Remarks
First and Last will be included in the cache.
virtual tBool ClearCache ( )
pure virtual

Clear the glyph and texture caches.

virtual tIntPtr GetCacheID ( ) const
pure virtual

Get the ID of the current cache. {Property}.

Remarks
The cache ID changes every time the cache is cleared.
The ID can be used to detect changes in the font cache. For example to relayout geometries that depend on the font's internal texture cache.
virtual iMaterial* GetMaterial ( ) const
pure virtual

Get the material used for the font's rendering. {Property}.

virtual sRectf GetCharTexCoo ( tU32  c)
pure virtual

Get the texture coordinate of a character. {Property}.

Remarks
This will automatically cache the caracters.
virtual iTexture* GetCharTexture ( tU32  anChar) const
pure virtual

Get the texture in which the specified glyph is cached. {Property}.

virtual iBitmap2D* GetCharBitmap ( tU32  anChar) const
pure virtual

Get the bitmaps in which the specified glyph is cached. {Property}.

virtual sVec2i BlitChar ( iBitmap2D apBmp,
tI32  anX,
tI32  anY,
tU32  anChar 
)
pure virtual

Blit a character to the specified bitmap using the pixel size.

virtual sVec2i BlitCharStretch ( iBitmap2D apBmp,
tI32  anX,
tI32  anY,
tU32  anChar 
)
pure virtual

Blit a character to the specified bitmap to the current font size.

virtual sVec2i BlitCharEx ( iBitmap2D apBmp,
tI32  anX,
tI32  anY,
tI32  anW,
tI32  anH,
tU32  anChar,
eBlendMode  aBlendMode 
)
pure virtual

Blit a character to the specified bitmap with the specified size and blend mode.

virtual sRectf ComputeTextSize ( const sRectf aRect,
const achar aaszText,
tFontFormatFlags  aFormat 
)
pure virtual

Compute text size in pixels.

Parameters
aRectIf not Null the rectangle will be used as 'target' box where the text should be drawn, the compted text will take into account word wrapping, etc. in that box.
aaszTextis the text to compute the size of.
aFormatif 0 the format flags set is used, else the specified format is used.
virtual sRectf DrawText ( ni::iCanvas apCanvas,
const sRectf aposRect,
tF32  afZ,
const achar aaszText,
tFontFormatFlags  aFormat 
)
pure virtual

Draw text layed out in the specified rectangle.