KerningData Class Reference

#include <customgui_kerning.h>

Inheritance diagram for KerningData:

Detailed Description

The CustomDataType that contains an array of Kerning objects.

Note
Has to be created with Alloc() and destroyed with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Alloc/Free

static KerningDataAlloc ()
 
static void Free (KerningData *&pData)
 

Constructor/Destructor

 KerningData ()
 
 ~KerningData ()
 

Kerning

Kerning GetKerning (Int32 index) const
 
Kerning CalculateKerning (Int32 index, const maxon::String &s) const
 
Bool SetKerning (Int32 index, const Kerning &kerning, Bool combine=false)
 
Bool SetKerning (Int32 index_start, Int32 index_end, const Kerning &kerning, Bool combine=false)
 
Bool SetKerning (Int32 index_start, Int32 index_end, const KerningTriState &tristate)
 
void ResetKerning (Int32 index)
 
void ResetKerning ()
 

Array

Bool Init (const maxon::String &s, Bool preserve)
 
Bool Init (Int32 count, Bool preserve=false)
 
Int32 GetCount () const
 
void Clear ()
 

CopyTo

Bool CopyTo (KerningData *pDest) const
 

String

String GetString () const
 

Selection

void SetSelectionStart (Int32 start)
 
Int32 GetSelectionStart () const
 
void SetSelectionEnd (Int32 end)
 
Int32 GetSelectionEnd () const
 
void SetSelection (Int32 start, Int32 end)
 
Int32 GetSelectionLength () const
 

Edit Mode

Bool GetEditmode () const
 
void SetEditmode (Bool editmode)
 

Additional Inherited Members

- Static Public Attributes inherited from CustomDataTypeT< 1028639 >
static constexpr Int32 DATATYPEID
 

Constructor & Destructor Documentation

◆ KerningData()

Constructor.

◆ ~KerningData()

Destructor.

Member Function Documentation

◆ Alloc()

static KerningData* Alloc ( )
static

Allocates a KerningData object. Destroy the allocated KerningData object with Free(). Use AutoAlloc to automate the allocation and destruction based on scope.

Returns
The allocated KerningData object, or nullptr if the allocation failed.

◆ Free()

static void Free ( KerningData *&  pData)
static

Destructs KerningData objects allocated with Alloc(). Use AutoAlloc to automate the allocation and destruction based on scope.

Parameters
[in,out]pDataThe KerningData object to destruct. If the pointer is nullptr nothing happens. The pointer is assigned nullptr afterwards.

◆ GetKerning()

Kerning GetKerning ( Int32  index) const

Retrieves the Kerning object with the settings at index.

Parameters
[in]indexThe index of the Kerning object.
Returns
The Kerning object for index.

◆ CalculateKerning()

Kerning CalculateKerning ( Int32  index,
const maxon::String s 
) const

Calculates the actual Kerning for index.

Note
All offsets and scale of the previous array elements will be taken into account.
Parameters
[in]indexThe index of the Kerning object.
[in]sPass a string to consider line breaks.
Returns
The Kerning object for index.

◆ SetKerning() [1/3]

Bool SetKerning ( Int32  index,
const Kerning kerning,
Bool  combine = false 
)

Sets the Kerning data for index.

Parameters
[in]indexThe index of the Kerning object.
[in]kerningThe Kerning data to set.
[in]combineIf false, existing Kerning data will be overwritten with new one. If true, both will be combined.
Returns
True if successful.

◆ SetKerning() [2/3]

Bool SetKerning ( Int32  index_start,
Int32  index_end,
const Kerning kerning,
Bool  combine = false 
)

Sets Kerning values for a range of indices.

Parameters
[in]index_startThe range start index.
[in]index_endThe range end index.
[in]kerningThe Kerning data to set.
[in]combineIf false, existing Kerning datasets will be overwritten with new one. If true, they will be combined.
Returns
true if successful, otherwise false.

◆ SetKerning() [3/3]

Bool SetKerning ( Int32  index_start,
Int32  index_end,
const KerningTriState tristate 
)

Sets KerningTriState values for a range of indices.

Parameters
[in]index_startThe range start index.
[in]index_endThe range end index.
[in]tristateThe Kerning TriState.
Returns
true if successful, otherwise false.

◆ ResetKerning() [1/2]

void ResetKerning ( Int32  index)

Resets Kerning data for index to default values.

Parameters
[in]indexThe index of the Kerning data to reset.

◆ ResetKerning() [2/2]

void ResetKerning ( )

Resets all Kerning data objects in array to default values (count is preserved).

◆ Init() [1/2]

Bool Init ( const maxon::String s,
Bool  preserve 
)

Initializes Kerning data array with length of string s.

Parameters
[in]sThe length of the Kerning data array will be set to length of s.
[in]preservetrue to keep existing Kerning data. false for default values in all elements.
Returns
true if successful, otherwise false.

◆ Init() [2/2]

Bool Init ( Int32  count,
Bool  preserve = false 
)

Initializes Kerning data array with length count.

Parameters
[in]countThe length of the Kerning data array.
[in]preservetrue to keep existing Kerning data. false for default values in all elements.
Returns
true if successful, otherwise false.

◆ GetCount()

Int32 GetCount ( ) const

Gets the length of Kerning data array.

Returns
The Kerning data array's length.

◆ Clear()

void Clear ( )

Clears all Kerning data. Length is reset to 0.

◆ CopyTo()

Bool CopyTo ( KerningData pDest) const

Copies the KerningData object to another one.

Parameters
[in]pDestThe pointer to the destination KerningData object.
Returns
true if successful, otherwise false.

◆ GetString()

String GetString ( ) const

Retrieves the string that the KerningData has been initialized with.

Returns
The string.

◆ SetSelectionStart()

void SetSelectionStart ( Int32  start)

Sets the index of the selection start.

Parameters
[in]startThe index of the selection start: 0 <= start < GetString().GetLength()

◆ GetSelectionStart()

Int32 GetSelectionStart ( ) const

Gets the index of the selection start.

Returns
The index of the selection start.

◆ SetSelectionEnd()

void SetSelectionEnd ( Int32  end)

Sets the index of the selection end.

Parameters
[in]endThe index of the selection end: 0 <= end < GetString().GetLength()

◆ GetSelectionEnd()

Int32 GetSelectionEnd ( ) const

Gets the index of the selection end.

Returns
The index of the selection end.

◆ SetSelection()

void SetSelection ( Int32  start,
Int32  end 
)

Sets the indexes of the selection start and end.

Parameters
[in]startThe index of the selection start.
[in]endThe index of the selection end.

◆ GetSelectionLength()

Int32 GetSelectionLength ( ) const

Gets the length of the selection (GetSelectionEnd() - GetSelectionStart()).

Returns
The selection's length.

◆ GetEditmode()

Bool GetEditmode ( ) const

Gets the edit mode state.

Returns
true if edit mode is enabled, otherwise false.

◆ SetEditmode()

void SetEditmode ( Bool  editmode)

Sets the edit mode state.

Parameters
[in]editmodetrue to enable edit mode, otherwise false.