[dali_2.3.21] Merge branch 'devel/master'
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / font-description-run.h
index ada640c..77b8db8 100644 (file)
@@ -1,8 +1,8 @@
-#ifndef __DALI_TOOLKIT_TEXT_FONT_DESCRIPTION_RUN_H__
-#define __DALI_TOOLKIT_TEXT_FONT_DESCRIPTION_RUN_H__
+#ifndef DALI_TOOLKIT_TEXT_FONT_DESCRIPTION_RUN_H
+#define DALI_TOOLKIT_TEXT_FONT_DESCRIPTION_RUN_H
 
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include <dali/devel-api/text-abstraction/font-list.h>
 
 // INTERNAL INCLUDES
-#include <dali-toolkit/internal/text/character-run.h>
+#include <dali-toolkit/internal/text/abstract-style-character-run.h>
 #include <dali-toolkit/internal/text/text-definitions.h>
 
 namespace Dali
 {
-
 namespace Toolkit
 {
-
 namespace Text
 {
-
 /**
  * @brief Run of characters with the same font.
  */
-struct FontDescriptionRun
+struct FontDescriptionRun : public AbstractStyleCharacterRun
 {
-  CharacterRun    characterRun; ///< The initial character index and the number of characters of the run.
+  /**
+   * Default constructor to set the default values of bitfields
+   */
+  FontDescriptionRun()
+  : AbstractStyleCharacterRun(),
+    familyName{nullptr},
+    familyLength{0u},
+    weight{FontWeight::NONE},
+    width{FontWidth::NONE},
+    slant{FontSlant::NONE},
+    size{0u},
+    familyDefined{false},
+    weightDefined{false},
+    widthDefined{false},
+    slantDefined{false},
+    sizeDefined{false}
+  {
+  }
+
+  FontDescriptionRun(const CharacterRun& characterRun,
+                     char*               familyName,
+                     Length              familyLength,
+                     FontWeight          weight,
+                     FontWidth           width,
+                     FontSlant           slant,
+                     PointSize26Dot6     size,
+                     bool                familyDefined,
+                     bool                weightDefined,
+                     bool                widthDefined,
+                     bool                slantDefined,
+                     bool                sizeDefined)
+  : AbstractStyleCharacterRun(characterRun),
+    familyName{familyName},
+    familyLength{familyLength},
+    weight{weight},
+    width{width},
+    slant{slant},
+    size{size},
+    familyDefined{familyDefined},
+    weightDefined{weightDefined},
+    widthDefined{widthDefined},
+    slantDefined{slantDefined},
+    sizeDefined{sizeDefined}
+  {
+  }
+
   char*           familyName;   ///< The font's family name.
   Length          familyLength; ///< The length of the font's family name.
   FontWeight      weight;       ///< The font's weight.
@@ -49,15 +91,25 @@ struct FontDescriptionRun
 
   bool familyDefined : 1; ///< Whether the font's family is defined.
   bool weightDefined : 1; ///< Whether the font's weight is defined.
-  bool widthDefined  : 1; ///< Whether the font's width is defined.
-  bool slantDefined  : 1; ///< Whether the font's slant is defined.
-  bool sizeDefined   : 1; ///< Whether the font's size is defined.
+  bool widthDefined : 1;  ///< Whether the font's width is defined.
+  bool slantDefined : 1;  ///< Whether the font's slant is defined.
+  bool sizeDefined : 1;   ///< Whether the font's size is defined.
 };
 
 } // namespace Text
 
 } // namespace Toolkit
 
+// Allow FontDescriptionRun to be treated as a POD type
+template<>
+struct TypeTraits<Dali::Toolkit::Text::FontDescriptionRun> : public Dali::BasicTypes<Dali::Toolkit::Text::FontDescriptionRun>
+{
+  enum
+  {
+    IS_TRIVIAL_TYPE = true
+  };
+};
+
 } // namespace Dali
 
-#endif // __DALI_TOOLKIT_TEXT_FONT_DESCRIPTION_RUN_H__
+#endif // DALI_TOOLKIT_TEXT_FONT_DESCRIPTION_RUN_H