@@ -421,6 +421,8 @@ Barcode CreateBarcode(const void* data, int size, int mode, const CreatorOptions
421421 if (mode == UNICODE_MODE && static_cast <const char *>(data)[0 ] != ' [' )
422422 zint->input_mode |= GS1PARENS_MODE;
423423 zint->output_options |= OUT_BUFFER_INTERMEDIATE | BARCODE_NO_QUIET_ZONES | BARCODE_CONTENT_SEGS;
424+ if (opts.readerInit ())
425+ zint->output_options |= READER_INIT;
424426
425427 if (mode == DATA_MODE && ZBarcode_Cap (zint->symbology , ZINT_CAP_ECI))
426428 zint->eci = static_cast <int >(ECI::Binary);
@@ -469,15 +471,16 @@ Barcode CreateBarcode(const void* data, int size, int mode, const CreatorOptions
469471
470472 DecoderResult decRes (std::move (content));
471473 decRes.setEcLevel (ECLevelZint2ZXing (zint));
472- DetectorResult detRes;
473-
474- auto res = Barcode (std::move (decRes), std::move (detRes), opts.format ());
475- #endif
476-
474+ decRes.setReaderInit (zint->output_options & READER_INIT);
477475 auto bits = BitMatrix (zint->bitmap_width , zint->bitmap_height );
478476 std::transform (zint->bitmap , zint->bitmap + zint->bitmap_width * zint->bitmap_height , bits.row (0 ).begin (),
479477 [](unsigned char v) { return (v == ' 1' ) * BitMatrix::SET_V; });
480- res.symbol (std::move (bits));
478+ int left, top, width, height;
479+ bits.findBoundingBox (left, top, width, height);
480+
481+ auto res = Barcode (std::move (decRes), {std::move (bits), Rectangle<PointI>(left, top, width, height)}, opts.format ());
482+ #endif
483+
481484 res.zint (std::move (opts.d ->zint ));
482485
483486 return res;
0 commit comments