Fix motivate font, fixed server command check error

This commit is contained in:
Essem 2021-12-23 16:09:50 -06:00
parent b2e6dd01fe
commit 952f2e5237
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C
3 changed files with 6 additions and 5 deletions

View file

@ -131,4 +131,4 @@ class ImageCommand extends Command {
static command = "";
}
export default ImageCommand;
export default ImageCommand;

View file

@ -43,7 +43,6 @@ Napi::Value Motivate(const Napi::CallbackInfo &info) {
top.fontPointsize(56);
top.read("pango:<span font_family=\"" +
(font == "roboto" ? "Roboto Condensed" : font) +
"\" weight=\"" + (font != "impact" ? "bold" : "normal") +
"\" foreground='white'>" + top_text + "</span>");
top.extent(Geometry(bottom_text != "" ? to_string(top.columns()) + "x" +
to_string(top.rows())
@ -57,7 +56,9 @@ Napi::Value Motivate(const Napi::CallbackInfo &info) {
bottom.font("Times");
bottom.textGravity(Magick::CenterGravity);
bottom.fontPointsize(28);
bottom.read("pango:<span foreground='white'>" + bottom_text + "</span>");
bottom.read("pango:<span font_family=\"" +
(font == "roboto" ? "Roboto Condensed" : font) +
"\" foreground='white'>" + top_text + "</span>");
bottom.extent(Geometry(to_string(bottom.columns()) + "x" +
to_string(bottom.rows() + 20)),
"black", Magick::NorthGravity);
@ -105,4 +106,4 @@ Napi::Value Motivate(const Napi::CallbackInfo &info) {
} catch (...) {
throw Napi::Error::New(env, "Unknown error");
}
}
}

View file

@ -71,7 +71,7 @@ class ImageWorker extends BaseServiceWorker {
if (connection.conn.readyState !== 0 && connection.conn.readyState !== 1) {
continue;
}
if (object.params.type && !connection.formats[object.cmd].includes(object.params.type)) continue;
if (object.params.type && connection.formats[object.cmd] && !connection.formats[object.cmd].includes(object.params.type)) continue;
idealServers.push({
addr: address,
load: connection.njobs / connection.max