3#include "sdl_painter/export.h"
4#include "sdl_painter/texture.h"
9#include <unordered_map>
11namespace sdl_painter {
40 [[nodiscard]]
bool IsValid() const noexcept {
41 return texture != kInvalidTexture;
46enum class Alignment : uint8_t {
53enum class TextWrap : uint8_t {
82 Font(
const std::string& file_path, int32_t point_size);
88 Font& operator=(
const Font&) =
delete;
90 Font& operator=(
Font&& other)
noexcept;
93 [[nodiscard]]
bool IsValid() const noexcept {
return mHandle !=
nullptr; }
96 [[nodiscard]] int32_t
PointSize() const noexcept {
return mPointSize; }
99 [[nodiscard]] int32_t
Ascent()
const;
109 [[nodiscard]]
void*
Handle() const noexcept {
return mHandle; }
117 int32_t& out_height)
const;
126 void* mHandle{
nullptr};
127 int32_t mPointSize{0};
130 mutable std::unordered_map<char32_t, Glyph> mGlyphCache;
134 mutable std::unique_ptr<GlyphAtlas> mAtlas;
Font sarmalayıcı — SDL_ttf üzerinden.
Definition font.h:72
std::size_t AtlasPageCount() const
Glyph atlasının açtığı sayfa sayısı (teşhis/test).
Font(const std::string &file_path, int32_t point_size)
TTF dosyasından font yükle.
int32_t PointSize() const noexcept
Punto boyutunu döndür.
Definition font.h:96
const Glyph * GetGlyph(IRenderer &renderer, char32_t codepoint) const
Karakter için Glyph al; yoksa oluşturur.
int32_t Ascent() const
Font ascent (baseline'dan yukariya olan maksimum piksel) degerini dondur.
bool IsValid() const noexcept
Font başarıyla yüklendi mi?
Definition font.h:93
int32_t LineHeight() const
İki satır arasındaki önerilen dikey mesafe (piksel).
void * Handle() const noexcept
SDL_ttf font handle'ı döndür (opak pointer).
Definition font.h:109
bool MeasureText(const std::string &text, int32_t &out_width, int32_t &out_height) const
Verilen metnin piksel boyutunu ölç.
Backend-agnostik soyut renderer arayüzü.
Definition renderer.h:75
Tek bir karakterin metrikleri ve atlas içindeki konumu.
Definition font.h:23
bool IsValid() const noexcept
Glyph çizilebilir bir görüntüye sahip mi?
Definition font.h:40
TextureHandle texture
Glyph'i içeren atlas sayfasının texture'ı (sahiplik atlasta).
Definition font.h:25