add common align config property to set text alignment

add fixed-length property to set the fixed width of the label
This commit is contained in:
nullobsi 2021-01-31 13:58:41 -08:00
parent be777b8525
commit 8c70513a24
No known key found for this signature in database
GPG Key ID: 4698F7ECCC7E2005

View File

@ -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());
}