45 lines
860 B
C++
45 lines
860 B
C++
#pragma once
|
|
#include <cstdint>
|
|
#include <memory>
|
|
#include "Bitmask.h"
|
|
|
|
namespace renderive {
|
|
|
|
enum class Text_Align : std::uint16_t {
|
|
None = 0,
|
|
Left = 1 << 0,
|
|
Right = 1 << 1,
|
|
HCenter = 1 << 2,
|
|
Top = 1 << 3,
|
|
Bottom = 1 << 4,
|
|
VCenter = 1 << 5,
|
|
Center = HCenter | VCenter
|
|
};
|
|
|
|
struct Font_Face;
|
|
|
|
struct Font {
|
|
std::shared_ptr<Font_Face> face;
|
|
double size = 12.0;
|
|
int weight = 400;
|
|
bool italic = false;
|
|
[[nodiscard]] bool valid() const {
|
|
return face != nullptr && size > 0.0;
|
|
}
|
|
};
|
|
|
|
struct Text_Metrics {
|
|
double width{};
|
|
double height{};
|
|
double ascent{};
|
|
double descent{};
|
|
double line_gap{};
|
|
[[nodiscard]] double line_height() const {
|
|
return ascent + descent + line_gap;
|
|
}
|
|
};
|
|
|
|
} // namespace renderive
|
|
|
|
RENDERIVE_ENABLE_BITMASK(renderive::Text_Align)
|