@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2022 Robin Lindén <dev@robinlinden.eu>
// SPDX-FileCopyrightText: 2022-2023 Robin Lindén <dev@robinlinden.eu>
//
// SPDX-License-Identifier: BSD-2-Clause
@@ -6,6 +6,7 @@
#define GFX_FONT_H_
#include <string_view>
#include <utility>
namespace gfx {
@@ -18,10 +19,41 @@ struct FontSize {
};
enum class FontStyle {
Normal,
Italic,
Normal = 0,
Italic = 1 << 0,
};
constexpr FontStyle operator|(FontStyle lhs, FontStyle rhs) {
return static_cast<FontStyle>(std::to_underlying(lhs) | std::to_underlying(rhs));
}
constexpr FontStyle &operator|=(FontStyle &lhs, FontStyle rhs) {
lhs = lhs | rhs;
return lhs;
}
constexpr FontStyle operator&(FontStyle lhs, FontStyle rhs) {
return static_cast<FontStyle>(std::to_underlying(lhs) & std::to_underlying(rhs));
}
constexpr FontStyle &operator&=(FontStyle &lhs, FontStyle rhs) {
lhs = lhs & rhs;
return lhs;
}
constexpr FontStyle operator^(FontStyle lhs, FontStyle rhs) {
return static_cast<FontStyle>(std::to_underlying(lhs) ^ std::to_underlying(rhs));
}
constexpr FontStyle &operator^=(FontStyle &lhs, FontStyle rhs) {
lhs = lhs ^ rhs;
return lhs;
}
constexpr FontStyle operator~(FontStyle v) {
return static_cast<FontStyle>(~std::to_underlying(v));
}
} // namespace gfx
#endif