Added font flag to caption
This commit is contained in:
parent
f7923c19cb
commit
e44f5ba59d
3 changed files with 11 additions and 4 deletions
|
@ -13,6 +13,7 @@ Napi::Value Caption(const Napi::CallbackInfo &info) {
|
|||
Napi::Object obj = info[0].As<Napi::Object>();
|
||||
Napi::Buffer<char> data = obj.Get("data").As<Napi::Buffer<char>>();
|
||||
string caption = obj.Get("caption").As<Napi::String>().Utf8Value();
|
||||
string font = obj.Get("font").As<Napi::String>().Utf8Value();
|
||||
string type = obj.Get("type").As<Napi::String>().Utf8Value();
|
||||
int delay =
|
||||
obj.Has("delay") ? obj.Get("delay").As<Napi::Number>().Int32Value() : 0;
|
||||
|
@ -29,10 +30,9 @@ Napi::Value Caption(const Napi::CallbackInfo &info) {
|
|||
Image caption_image(Geometry(query), Color("white"));
|
||||
caption_image.fillColor("black");
|
||||
caption_image.alpha(true);
|
||||
caption_image.font("Futura");
|
||||
caption_image.fontPointsize(width / 13);
|
||||
caption_image.textGravity(Magick::CenterGravity);
|
||||
caption_image.read("pango:" + caption);
|
||||
caption_image.read("pango:<span font_family=\"" + (font == "roboto" ? "Roboto Condensed" : font) + "\" weight=\"" + (font != "impact" ? "bold" : "normal") + "\">" + caption + "</span>");
|
||||
caption_image.extent(Geometry(width, caption_image.rows() + (width / 13)),
|
||||
Magick::CenterGravity);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue