Make some values scriptable

color radius
color left width
color right width
color top width
color bottom width
font shadow displacement x
font shadow displacement y
font shadow blur
This commit is contained in:
GenevensiS
2025-07-14 00:23:45 +02:00
committed by GitHub
parent dafd1a4f19
commit 58ab8f3636
7 changed files with 51 additions and 24 deletions
+15 -7
View File
@@ -21,7 +21,8 @@ Font::Font()
, scale_down_to(100000)
, max_stretch(1.0)
, color(Color(0,0,0))
, shadow_displacement(0,0)
, shadow_displacement_x(0)
, shadow_displacement_y(0)
, shadow_blur(0)
, separator_color(Color(0,0,0,128))
, flags(FONT_NORMAL)
@@ -89,7 +90,10 @@ bool Font::update(Context& ctx) {
changes |= style .update(ctx);
changes |= underline .update(ctx);
changes |= color .update(ctx);
changes |= shadow_color.update(ctx);
changes |= shadow_color .update(ctx);
changes |= shadow_displacement_x.update(ctx);
changes |= shadow_displacement_y.update(ctx);
changes |= shadow_blur .update(ctx);
flags = (flags & ~FONT_BOLD & ~FONT_ITALIC)
| (weight() == _("bold") ? FONT_BOLD : FONT_NORMAL)
| (style() == _("italic") ? FONT_ITALIC : FONT_NORMAL);
@@ -103,7 +107,10 @@ void Font::initDependencies(Context& ctx, const Dependency& dep) const {
style .initDependencies(ctx, dep);
underline .initDependencies(ctx, dep);
color .initDependencies(ctx, dep);
shadow_color.initDependencies(ctx, dep);
shadow_color .initDependencies(ctx, dep);
shadow_displacement_x.initDependencies(ctx, dep);
shadow_displacement_y.initDependencies(ctx, dep);
shadow_blur .initDependencies(ctx, dep);
}
FontP Font::make(int add_flags, bool add_underline, String const* other_family, Color const* other_color, double const* other_size) const {
@@ -121,8 +128,9 @@ FontP Font::make(int add_flags, bool add_underline, String const* other_family,
}
if (add_flags & FONT_SOFT) {
f->color = f->separator_color;
f->shadow_displacement = RealSize(0,0); // no shadow
}
f->shadow_displacement_x = 0; // no shadow
f->shadow_displacement_y = 0; // no shadow
}
if (add_underline) {
f->underline = true;
}
@@ -185,8 +193,8 @@ IMPLEMENT_REFLECTION_NO_SCRIPT(Font) {
REFLECT(color);
REFLECT(scale_down_to);
REFLECT(max_stretch);
REFLECT_N("shadow_displacement_x", shadow_displacement.width);
REFLECT_N("shadow_displacement_y", shadow_displacement.height);
REFLECT(shadow_displacement_x);
REFLECT(shadow_displacement_y);
REFLECT(shadow_color);
REFLECT(shadow_blur);
REFLECT(separator_color);