1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #ifndef INCLUDED_VCL_FONT_FEATURE_HXX
11 #define INCLUDED_VCL_FONT_FEATURE_HXX
13 #include <vcl/dllapi.h>
14 #include <rtl/ustring.hxx>
21 constexpr uint32_t featureCode(const char sFeature
[4])
23 return static_cast<uint32_t>(sFeature
[0]) << 24U | static_cast<uint32_t>(sFeature
[1]) << 16U
24 | static_cast<uint32_t>(sFeature
[2]) << 8U | static_cast<uint32_t>(sFeature
[3]);
27 VCL_DLLPUBLIC OUString
featureCodeAsString(uint32_t nFeature
);
29 enum class FeatureParameterType
35 enum class FeatureType
41 struct VCL_DLLPUBLIC FeatureParameter
45 OUString m_sDescription
;
46 const char* m_pDescriptionID
;
49 FeatureParameter(uint32_t nCode
, OUString aDescription
);
50 FeatureParameter(uint32_t nCode
, const char* pDescriptionID
);
52 uint32_t getCode() const;
53 OUString
getDescription() const;
56 class VCL_DLLPUBLIC FeatureDefinition
59 OUString m_sDescription
;
60 const char* m_pDescriptionID
;
61 OUString m_sNumericPart
;
64 FeatureParameterType m_eType
;
65 // the index of the parameter defines the enum value, string is the description
66 std::vector
<FeatureParameter
> m_aEnumParameters
;
70 FeatureDefinition(uint32_t nCode
, OUString
const& rDescription
,
71 FeatureParameterType eType
= FeatureParameterType::BOOL
,
72 std::vector
<FeatureParameter
> const& rEnumParameters
73 = std::vector
<FeatureParameter
>{},
74 uint32_t nDefault
= 0);
75 FeatureDefinition(uint32_t nCode
, const char* pDescriptionID
,
76 OUString
const& rNumericPart
= OUString());
77 FeatureDefinition(uint32_t nCode
, const char* pDescriptionID
,
78 std::vector
<FeatureParameter
> aEnumParameters
);
80 const std::vector
<FeatureParameter
>& getEnumParameters() const;
81 uint32_t getCode() const;
82 OUString
getDescription() const;
83 FeatureParameterType
getType() const;
84 uint32_t getDefault() const;
86 operator bool() const;
89 struct VCL_DLLPUBLIC FeatureID
91 uint32_t m_aFeatureCode
;
92 uint32_t m_aScriptCode
;
93 uint32_t m_aLanguageCode
;
96 struct VCL_DLLPUBLIC Feature
99 Feature(FeatureID
const& rID
, FeatureType eType
);
102 FeatureType
const m_eType
;
103 FeatureDefinition m_aDefinition
;
106 // This is basically duplicates hb_feature_t to avoid including HarfBuzz
107 // headers here, so the member types should remain compatible.
108 struct VCL_DLLPUBLIC FeatureSetting
110 FeatureSetting(OString feature
);
114 unsigned int m_nStart
;
118 } // end font namespace
120 } // end vcl namespace
122 #endif // INCLUDED_VCL_FONT_FEATURE_HXX
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */