mirror of
https://github.com/hyprwm/hyprgraphics.git
synced 2025-12-26 19:50:04 +01:00
text: add aa and hint to text
Some checks are pending
Some checks are pending
This commit is contained in:
parent
c44e749dd6
commit
758678a614
3 changed files with 13 additions and 8 deletions
|
|
@ -3,6 +3,8 @@
|
|||
#include "AsyncResource.hpp"
|
||||
#include "../../color/Color.hpp"
|
||||
|
||||
#include <cairo/cairo.h>
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include <hyprutils/math/Vector2D.hpp>
|
||||
|
|
@ -17,12 +19,14 @@ namespace Hyprgraphics {
|
|||
};
|
||||
|
||||
struct STextResourceData {
|
||||
std::string text = "Sample Text";
|
||||
std::string font = "Sans Serif";
|
||||
size_t fontSize = 16;
|
||||
CColor color = CColor{CColor::SSRGB{.r = 1.F, .g = 1.F, .b = 1.F}};
|
||||
eTextAlignmentMode align = TEXT_ALIGN_LEFT;
|
||||
std::optional<Hyprutils::Math::Vector2D> maxSize = std::nullopt;
|
||||
std::string text = "Sample Text";
|
||||
std::string font = "Sans Serif";
|
||||
size_t fontSize = 16;
|
||||
CColor color = CColor{CColor::SSRGB{.r = 1.F, .g = 1.F, .b = 1.F}};
|
||||
eTextAlignmentMode align = TEXT_ALIGN_LEFT;
|
||||
std::optional<Hyprutils::Math::Vector2D> maxSize = std::nullopt;
|
||||
cairo_antialias_t antialias = CAIRO_ANTIALIAS_GOOD;
|
||||
cairo_hint_style_t hintStyle = CAIRO_HINT_STYLE_SLIGHT;
|
||||
};
|
||||
|
||||
CTextResource(STextResourceData&& data);
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ Hyprgraphics::CImage::CImage(const std::span<uint8_t>& data, eImageFormat format
|
|||
#ifndef HEIF_FOUND
|
||||
lastError = "hyprgraphics compiled without HEIF support";
|
||||
return;
|
||||
#else
|
||||
#else
|
||||
CAIROSURFACE = AVIF::createSurfaceFromAvif(data);
|
||||
mime = "image/avif";
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -24,7 +24,8 @@ void CTextResource::render() {
|
|||
pango_font_description_free(fontDesc);
|
||||
|
||||
cairo_font_options_t* options = cairo_font_options_create();
|
||||
cairo_font_options_set_antialias(options, CAIRO_ANTIALIAS_GOOD);
|
||||
cairo_font_options_set_antialias(options, m_data.antialias);
|
||||
cairo_font_options_set_hint_style(options, m_data.hintStyle);
|
||||
pango_cairo_context_set_font_options(pango_layout_get_context(layout), options);
|
||||
cairo_font_options_destroy(options);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue