From 0fa65313337279d7627ae31ebdd1b7e82c28b0fd Mon Sep 17 00:00:00 2001 From: brahima Date: Fri, 15 Jul 2022 19:00:11 +0200 Subject: [PATCH] Comments resolve for libvips text api --- src/common.cc | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/common.cc b/src/common.cc index 34bbb67b2..c31de4e26 100644 --- a/src/common.cc +++ b/src/common.cc @@ -142,9 +142,6 @@ namespace sharp { if (HasAttr(input, "textFontfile")) { descriptor->textFontfile = AttrAsStr(input, "textFontfile"); } - if (HasAttr(input, "textFontfile")) { - descriptor->textFontfile = AttrAsStr(input, "textFontfile"); - } if (HasAttr(input, "textWidth")) { descriptor->textWidth = AttrAsUint32(input, "textWidth"); } @@ -453,8 +450,10 @@ namespace sharp { if (descriptor->textFontfile.length() > 0) { textOptions->set("fontfile", const_cast(descriptor->textFontfile.data())); } - image = VImage::new_memory().text(const_cast(descriptor->textValue.data()), textOptions); - image.get_image()->Type = image.guess_interpretation(); + image = VImage::text(const_cast(descriptor->textValue.data()), textOptions); + if (!descriptor->textRgba) { + image = image.copy(VImage::option()->set("interpretation", VIPS_INTERPRETATION_B_W)); + } imageType = ImageType::RAW; } else { // From filesystem