1//************************************ bs::framework - Copyright 2018 Marko Pintera **************************************//
2//*********** Licensed under the MIT license. See LICENSE.md for full terms. This notice is not to be removed. ***********//
3#pragma once
4
5#include "BsCorePrerequisites.h"
6#include "Reflection/BsRTTIType.h"
7#include "Text/BsFontImportOptions.h"
8
9namespace bs
10{
11 /** @cond RTTI */
12 /** @addtogroup RTTI-Impl-Core
13 * @{
14 */
15
16 BS_ALLOW_MEMCPY_SERIALIZATION(CharRange)
17
18 class BS_CORE_EXPORT FontImportOptionsRTTI : public RTTIType<FontImportOptions, ImportOptions, FontImportOptionsRTTI>
19 {
20 private:
21 BS_BEGIN_RTTI_MEMBERS
22 BS_RTTI_MEMBER_PLAIN(fontSizes, 0)
23 BS_RTTI_MEMBER_PLAIN(dpi, 2)
24 BS_RTTI_MEMBER_PLAIN(renderMode, 3)
25 BS_RTTI_MEMBER_PLAIN(bold, 4)
26 BS_RTTI_MEMBER_PLAIN(italic, 5)
27 BS_RTTI_MEMBER_PLAIN(charIndexRanges, 6)
28 BS_END_RTTI_MEMBERS
29
30 // For compability with old version
31 Vector<std::pair<UINT32, UINT32>>& getCharIndexRangesOld(FontImportOptions* obj)
32 {
33 static Vector<std::pair<UINT32, UINT32>> dummy;
34 return dummy;
35 }
36
37 void setCharIndexRangesOld(FontImportOptions* obj, Vector<std::pair<UINT32, UINT32>>& value)
38 {
39 // If already set it's assumed the new version already populated it
40 if(!obj->charIndexRanges.empty())
41 return;
42
43 for(auto& entry : value)
44 obj->charIndexRanges.push_back(CharRange(entry.first, entry.second));
45 }
46
47 public:
48 FontImportOptionsRTTI()
49 {
50 addPlainField("mCharIndexRangesOld", 1, &FontImportOptionsRTTI::getCharIndexRangesOld,
51 &FontImportOptionsRTTI::setCharIndexRangesOld);
52 }
53
54 const String& getRTTIName() override
55 {
56 static String name = "FontImportOptions";
57 return name;
58 }
59
60 UINT32 getRTTIId() override
61 {
62 return TID_FontImportOptions;
63 }
64
65 SPtr<IReflectable> newRTTIObject() override
66 {
67 return bs_shared_ptr_new<FontImportOptions>();
68 }
69 };
70
71 /** @} */
72 /** @endcond */
73}