Bump version to 6.4-15
[LibreOffice.git] / include / vcl / font / Feature.hxx
blobb56ce19ba194533120e436fbce4bc9fb02692629
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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/.
8 */
10 #ifndef INCLUDED_VCL_FONT_FEATURE_HXX
11 #define INCLUDED_VCL_FONT_FEATURE_HXX
13 #include <vcl/dllapi.h>
14 #include <rtl/ustring.hxx>
15 #include <vector>
17 namespace vcl
19 namespace font
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
31 BOOL,
32 ENUM
35 enum class FeatureType
37 OpenType,
38 Graphite
41 struct VCL_DLLPUBLIC FeatureParameter
43 private:
44 uint32_t m_nCode;
45 OUString m_sDescription;
46 const char* m_pDescriptionID;
48 public:
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
58 private:
59 OUString m_sDescription;
60 const char* m_pDescriptionID;
61 OUString m_sNumericPart;
62 uint32_t m_nCode;
63 uint32_t m_nDefault;
64 FeatureParameterType m_eType;
65 // the index of the parameter defines the enum value, string is the description
66 std::vector<FeatureParameter> m_aEnumParameters;
68 public:
69 FeatureDefinition();
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
98 Feature();
99 Feature(FeatureID const& rID, FeatureType eType);
101 FeatureID m_aID;
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);
112 uint32_t m_nTag;
113 uint32_t m_nValue;
114 unsigned int m_nStart;
115 unsigned int m_nEnd;
118 } // end font namespace
120 } // end vcl namespace
122 #endif // INCLUDED_VCL_FONT_FEATURE_HXX
124 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */