From 8c70513a248fb9c22ff37d14e9a06b983099ab71 Mon Sep 17 00:00:00 2001 From: nullobsi Date: Sun, 31 Jan 2021 13:58:41 -0800 Subject: [PATCH] add common `align` config property to set text alignment add fixed-length property to set the fixed width of the label --- src/ALabel.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/ALabel.cpp b/src/ALabel.cpp index 9371a0e7..4d15cc17 100644 --- a/src/ALabel.cpp +++ b/src/ALabel.cpp @@ -28,6 +28,15 @@ ALabel::ALabel(const Json::Value& config, const std::string& name, const std::st label_.set_single_line_mode(true); } + if (config_["fixed-length"].isUInt()) { + label_.set_width_chars(config_["fixed-length"].asUInt()); + } + + if (config_["align"].isDouble()) { + auto align = config_["align"].asFloat(); + label_.set_xalign(align); + } + if (config_["rotate"].isUInt()) { label_.set_angle(config["rotate"].asUInt()); }