*/
private TResizeEvent windowResize = null;
+ /**
+ * If true, emit wide-char (CJK/Emoji) characters as sixel images.
+ */
+ private boolean wideCharImages = true;
+
/**
* Window width in pixels. Used for sixel support.
*/
doRgbColor = false;
}
+ // Default to using sixel for full-width characters.
+ if (System.getProperty("jexer.ECMA48.wideCharImages",
+ "true").equals("true")) {
+ wideCharImages = true;
+ } else {
+ wideCharImages = false;
+ }
+
// Pull the system properties for sixel output.
if (System.getProperty("jexer.ECMA48.sixel", "true").equals("true")) {
sixel = true;
// Image cell: bypass the rest of the loop, it is not
// rendered here.
- if (lCell.isImage()) {
+ if ((wideCharImages && lCell.isImage())
+ || (!wideCharImages
+ && lCell.isImage()
+ && (lCell.getWidth() == Cell.Width.SINGLE))
+ ) {
hasImage = true;
// Save the last rendered cell
continue;
}
- assert (!lCell.isImage());
+ assert ((wideCharImages && !lCell.isImage())
+ || (!wideCharImages
+ && (!lCell.isImage()
+ || (lCell.isImage()
+ && (lCell.getWidth() != Cell.Width.SINGLE)))));
+
+ if (!wideCharImages && (lCell.getWidth() == Cell.Width.RIGHT)) {
+ continue;
+ }
+
if (hasImage) {
hasImage = false;
sb.append(gotoXY(x, y));
}
// Emit the character
- sb.append(Character.toChars(lCell.getChar()));
+ if (wideCharImages
+ // Don't emit the right-half of full-width chars.
+ || (!wideCharImages
+ && (lCell.getWidth() != Cell.Width.RIGHT))
+ ) {
+ sb.append(Character.toChars(lCell.getChar()));
+ }
// Save the last rendered cell
lastX = x;
Cell lCell = logical[x][y];
Cell pCell = physical[x][y];
- if (!lCell.isImage()) {
+ if (!lCell.isImage()
+ || (!wideCharImages
+ && (lCell.getWidth() != Cell.Width.SINGLE))
+ ) {
continue;
}