+const unsigned int DEFAULT_VECTOR_SIZE = 16u; ///< Default size of run vectors.
+
+/**
+ * @brief Struct used to retrieve the style runs from the mark-up string.
+ */
+struct StyleStack
+{
+ typedef VectorBase::SizeType RunIndex;
+
+ Vector<RunIndex> stack; ///< Use a vector as a style stack. Stores the indices pointing where the run is stored inside the logical model.
+ unsigned int topIndex; ///< Points the top of the stack.
+
+ StyleStack()
+ : stack(),
+ topIndex( 0u )
+ {
+ stack.Resize( DEFAULT_VECTOR_SIZE );
+ }
+
+ void Push( RunIndex index )
+ {
+ // Check if there is space inside the style stack.
+ const VectorBase::SizeType size = stack.Count();
+ if( topIndex >= size )
+ {
+ // Resize the style stack.
+ stack.Resize( 2u * size );
+ }
+
+ // Set the run index in the top of the stack.
+ *( stack.Begin() + topIndex ) = index;
+
+ // Reposition the pointer to the top of the stack.
+ ++topIndex;
+ }
+
+ RunIndex Pop()
+ {
+ // Pop the top of the stack.
+ --topIndex;
+ return *( stack.Begin() + topIndex );
+ }
+};
+
+/**
+ * @brief Initializes a font run description to its defaults.
+ *
+ * @param[in,out] fontRun The font description run to initialize.
+ */
+void Initialize( FontDescriptionRun& fontRun )
+{
+ fontRun.characterRun.characterIndex = 0u;
+ fontRun.characterRun.numberOfCharacters = 0u;
+ fontRun.familyName = NULL;
+ fontRun.familyLength = 0u;
+ fontRun.weight = TextAbstraction::FontWeight::NORMAL;
+ fontRun.width = TextAbstraction::FontWidth::NORMAL;
+ fontRun.slant = TextAbstraction::FontSlant::NORMAL;
+ fontRun.size = 0u;
+ fontRun.familyDefined = false;
+ fontRun.weightDefined = false;
+ fontRun.widthDefined = false;
+ fontRun.slantDefined = false;
+ fontRun.sizeDefined = false;
+}