const std::string XHTML_GLOW_TAG("glow");
const std::string XHTML_OUTLINE_TAG("outline");
-const char LESS_THAN = '<';
-const char GREATER_THAN = '>';
-const char EQUAL = '=';
-const char QUOTATION_MARK = '\'';
-const char LINE_SEPARATOR_CR = 0x0D; // Carriage return character CR
-const char LINE_SEPARATOR_LF = 0x0A; // New line character LF
-const char SLASH = '/';
-const char BACK_SLASH = '\\';
+const char LESS_THAN = '<';
+const char GREATER_THAN = '>';
+const char EQUAL = '=';
+const char QUOTATION_MARK = '\'';
+const char SLASH = '/';
+const char BACK_SLASH = '\\';
-const char WHITE_SPACE = 0x20; // ASCII value of the white space.
+const char WHITE_SPACE = 0x20; // ASCII value of the white space.
const unsigned int MAX_NUM_OF_ATTRIBUTES = 5u; ///< The font tag has the 'family', 'size' 'weight', 'width' and 'slant' attrubutes.
const unsigned int DEFAULT_VECTOR_SIZE = 16u; ///< Default size of run vectors.
};
/**
+ * @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;
+}
+
+/**
* @brief Splits the tag string into the tag name and its attributes.
*
* The attributes are stored in a vector in the tag.
{
// Create a new font run.
FontDescriptionRun fontRun;
- fontRun.characterRun.numberOfCharacters = 0u;
+ Initialize( fontRun );
// Fill the run with the parameters.
fontRun.characterRun.characterIndex = characterIndex;
fontRun.slant = TextAbstraction::FontSlant::ITALIC;
-
- fontRun.familyName = NULL;
- fontRun.familyDefined = false;
- fontRun.weightDefined = false;
- fontRun.widthDefined = false;
fontRun.slantDefined = true;
- fontRun.sizeDefined = false;
// Push the font run in the logical model.
markupProcessData.fontRuns.PushBack( fontRun );
{
// Create a new font run.
FontDescriptionRun fontRun;
- fontRun.characterRun.numberOfCharacters = 0u;
+ Initialize( fontRun );
// Fill the run with the parameters.
fontRun.characterRun.characterIndex = characterIndex;
-
fontRun.weight = TextAbstraction::FontWeight::BOLD;
-
- fontRun.familyName = NULL;
- fontRun.familyDefined = false;
fontRun.weightDefined = true;
- fontRun.widthDefined = false;
- fontRun.slantDefined = false;
- fontRun.sizeDefined = false;
// Push the font run in the logical model.
markupProcessData.fontRuns.PushBack( fontRun );
{
// Create a new font run.
FontDescriptionRun fontRun;
- fontRun.characterRun.numberOfCharacters = 0u;
+ Initialize( fontRun );
// Fill the run with the parameters.
fontRun.characterRun.characterIndex = characterIndex;
- fontRun.familyName = NULL;
- fontRun.familyDefined = false;
- fontRun.weightDefined = false;
- fontRun.widthDefined = false;
- fontRun.slantDefined = false;
- fontRun.sizeDefined = false;
-
ProcessFontTag( tag, fontRun );
// Push the font run in the logical model.
++markupStringBuffer;
}
}
- else if( ( LINE_SEPARATOR_CR == character ) && ( markupStringBuffer + 1u < markupStringEndBuffer ) )
- {
- // Replacing CR+LF end line by LF.
- if( LINE_SEPARATOR_LF == *( markupStringBuffer + 1u ) )
- {
- character = LINE_SEPARATOR_LF;
- ++markupStringBuffer;
- }
- }
const unsigned char numberOfBytes = GetUtf8Length( character );