From 91319563dca3795978f5ee85ffae6d461a81ab8e Mon Sep 17 00:00:00 2001 From: ttyniwa Date: Thu, 7 Oct 2021 20:43:13 +0900 Subject: [PATCH] Fix CJK(Chinese, Japanese and Korean) String overlap when using Generator.row() method. --- lib/src/generator.dart | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lib/src/generator.dart b/lib/src/generator.dart index 6b464a6..dde1dc4 100644 --- a/lib/src/generator.dart +++ b/lib/src/generator.dart @@ -390,7 +390,7 @@ class Generator { /// Cut the paper /// - /// [mode] is used to define the full or partial cut (if supported by the priner) + /// [mode] is used to define the full or partial cut (if supported by the printer) List cut({PosCutMode mode = PosCutMode.full}) { List bytes = []; bytes += emptyLines(5); @@ -446,7 +446,7 @@ class Generator { return bytes; } - /// Reverse feed for [n] lines (if supported by the priner) + /// Reverse feed for [n] lines (if supported by the printer) List reverseFeed(int n) { List bytes = []; bytes += Uint8List.fromList( @@ -542,16 +542,17 @@ class Generator { final List isLexemeChinese = list[1]; // Print each lexeme using codetable OR kanji + int? colIndex = colInd; for (var j = 0; j < lexemes.length; ++j) { bytes += _text( _encode(lexemes[j], isKanji: isLexemeChinese[j]), styles: cols[i].styles, - colInd: colInd, + colInd: colIndex, colWidth: cols[i].width, isKanji: isLexemeChinese[j], ); // Define the absolute position only once (we print one line only) - // colInd = null; + colIndex = null; } } } @@ -566,7 +567,7 @@ class Generator { /// Print an image using (ESC *) command /// - /// [image] is an instanse of class from [Image library](https://pub.dev/packages/image) + /// [image] is an instance of class from [Image library](https://pub.dev/packages/image) List image(Image imgSrc, {PosAlign align = PosAlign.center}) { List bytes = []; // Image alignment @@ -613,7 +614,7 @@ class Generator { /// Print an image using (GS v 0) obsolete command /// - /// [image] is an instanse of class from [Image library](https://pub.dev/packages/image) + /// [image] is an instance of class from [Image library](https://pub.dev/packages/image) List imageRaster( Image image, { PosAlign align = PosAlign.center, @@ -628,7 +629,7 @@ class Generator { final int widthPx = image.width; final int heightPx = image.height; final int widthBytes = (widthPx + 7) ~/ 8; - final List resterizedData = _toRasterFormat(image); + final List rasterizedData = _toRasterFormat(image); if (imageFn == PosImageFn.bitImageRaster) { // GS v 0 @@ -639,7 +640,7 @@ class Generator { header.add(densityByte); // m header.addAll(_intLowHigh(widthBytes, 2)); // xL xH header.addAll(_intLowHigh(heightPx, 2)); // yL yH - bytes += List.from(header)..addAll(resterizedData); + bytes += List.from(header)..addAll(rasterizedData); } else if (imageFn == PosImageFn.graphics) { // 'GS ( L' - FN_112 (Image data) final List header1 = List.from(cRasterImg.codeUnits); @@ -649,7 +650,7 @@ class Generator { header1.addAll([49]); // c=49 header1.addAll(_intLowHigh(widthBytes, 2)); // xL xH header1.addAll(_intLowHigh(heightPx, 2)); // yL yH - bytes += List.from(header1)..addAll(resterizedData); + bytes += List.from(header1)..addAll(rasterizedData); // 'GS ( L' - FN_50 (Run print) final List header2 = List.from(cRasterImg.codeUnits);