24 static constexpr std::string_view
PRINT_DIR =
"prints";
28 Paper(
unsigned x,
unsigned y,
double dotSizeX,
double dotSizeY);
30 [[nodiscard]] std::string
save()
const;
32 void plot(
double x,
double y);
35 uint8_t& dot(
unsigned x,
unsigned y);
38 std::vector<uint8_t> buf;
39 std::vector<int> table;
57 if (!strobe && prevStrobe) {
83 : motherBoard(motherBoard_)
86 motherBoard.getCommandController(),
"print-resolution",
87 "resolution of the output image of emulated dot matrix printer in DPI",
89 , graphicsHiLo(graphicsHiLo_)
149 for (
auto i :
xrange(9)) {
150 if (pattern & (1 << i)) {
194 int dpi = dpiSetting->getInt();
195 auto paperSizeX = unsigned((210 / 25.4) * dpi);
196 auto paperSizeY = unsigned((297 / 25.4) * dpi);
202 paper = std::make_unique<Paper>(paperSizeX, paperSizeY,
212 auto filename = paper->save();
214 "Printed to ", filename);
217 "Failed to print: ", e.getMessage());
228static constexpr unsigned compress9(
unsigned a)
231 for (
auto i :
xrange(9)) {
233 result |= 1 << (i / 2);
245 uint8_t attribute = charBitmap[0];
246 unsigned start = (attribute >> 4) & 0x07;
247 unsigned end = attribute & 0x0f;
248 unsigned topBits = attribute >> 7;
273 unsigned charBits = unsigned(charBitmap[i + 1]) << topBits;
279 charBits = compress9(charBits);
286 plot9Dots(destX, destY + y * dblStrikeOffset, charBits);
290 hPos += headRelative;
299static constexpr std::array<uint8_t, 256 * 8> MSXFontRaw = {
300 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
301 0x3C, 0x42, 0xA5, 0x81, 0xA5, 0x99, 0x42, 0x3C,
302 0x3C, 0x7E, 0xDB, 0xFF, 0xFF, 0xDB, 0x66, 0x3C,
303 0x6C, 0xFE, 0xFE, 0xFE, 0x7C, 0x38, 0x10, 0x00,
304 0x10, 0x38, 0x7C, 0xFE, 0x7C, 0x38, 0x10, 0x00,
305 0x10, 0x38, 0x54, 0xFE, 0x54, 0x10, 0x38, 0x00,
306 0x10, 0x38, 0x7C, 0xFE, 0xFE, 0x10, 0x38, 0x00,
307 0x00, 0x00, 0x00, 0x30, 0x30, 0x00, 0x00, 0x00,
308 0xFF, 0xFF, 0xFF, 0xE7, 0xE7, 0xFF, 0xFF, 0xFF,
309 0x38, 0x44, 0x82, 0x82, 0x82, 0x44, 0x38, 0x00,
310 0xC7, 0xBB, 0x7D, 0x7D, 0x7D, 0xBB, 0xC7, 0xFF,
311 0x0F, 0x03, 0x05, 0x79, 0x88, 0x88, 0x88, 0x70,
312 0x38, 0x44, 0x44, 0x44, 0x38, 0x10, 0x7C, 0x10,
313 0x30, 0x28, 0x24, 0x24, 0x28, 0x20, 0xE0, 0xC0,
314 0x3C, 0x24, 0x3C, 0x24, 0x24, 0xE4, 0xDC, 0x18,
315 0x10, 0x54, 0x38, 0xEE, 0x38, 0x54, 0x10, 0x00,
316 0x10, 0x10, 0x10, 0x7C, 0x10, 0x10, 0x10, 0x10,
317 0x10, 0x10, 0x10, 0xFF, 0x00, 0x00, 0x00, 0x00,
318 0x00, 0x00, 0x00, 0xFF, 0x10, 0x10, 0x10, 0x10,
319 0x10, 0x10, 0x10, 0xF0, 0x10, 0x10, 0x10, 0x10,
320 0x10, 0x10, 0x10, 0x1F, 0x10, 0x10, 0x10, 0x10,
321 0x10, 0x10, 0x10, 0xFF, 0x10, 0x10, 0x10, 0x10,
322 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,
323 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00,
324 0x00, 0x00, 0x00, 0x1F, 0x10, 0x10, 0x10, 0x10,
325 0x00, 0x00, 0x00, 0xF0, 0x10, 0x10, 0x10, 0x10,
326 0x10, 0x10, 0x10, 0x1F, 0x00, 0x00, 0x00, 0x00,
327 0x10, 0x10, 0x10, 0xF0, 0x00, 0x00, 0x00, 0x00,
328 0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81,
329 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80,
330 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01,
331 0x00, 0x10, 0x10, 0xFF, 0x10, 0x10, 0x00, 0x00,
332 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
333 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x20, 0x00,
334 0x50, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00, 0x00,
335 0x50, 0x50, 0xF8, 0x50, 0xF8, 0x50, 0x50, 0x00,
336 0x20, 0x78, 0xA0, 0x70, 0x28, 0xF0, 0x20, 0x00,
337 0xC0, 0xC8, 0x10, 0x20, 0x40, 0x98, 0x18, 0x00,
338 0x40, 0xA0, 0x40, 0xA8, 0x90, 0x98, 0x60, 0x00,
339 0x10, 0x20, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
340 0x10, 0x20, 0x40, 0x40, 0x40, 0x20, 0x10, 0x00,
341 0x40, 0x20, 0x10, 0x10, 0x10, 0x20, 0x40, 0x00,
342 0x20, 0xA8, 0x70, 0x20, 0x70, 0xA8, 0x20, 0x00,
343 0x00, 0x20, 0x20, 0xF8, 0x20, 0x20, 0x00, 0x00,
344 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x40,
345 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00,
346 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x60, 0x00,
347 0x00, 0x00, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00,
348 0x70, 0x88, 0x98, 0xA8, 0xC8, 0x88, 0x70, 0x00,
349 0x20, 0x60, 0xA0, 0x20, 0x20, 0x20, 0xF8, 0x00,
350 0x70, 0x88, 0x08, 0x10, 0x60, 0x80, 0xF8, 0x00,
351 0x70, 0x88, 0x08, 0x30, 0x08, 0x88, 0x70, 0x00,
352 0x10, 0x30, 0x50, 0x90, 0xF8, 0x10, 0x10, 0x00,
353 0xF8, 0x80, 0xE0, 0x10, 0x08, 0x10, 0xE0, 0x00,
354 0x30, 0x40, 0x80, 0xF0, 0x88, 0x88, 0x70, 0x00,
355 0xF8, 0x88, 0x10, 0x20, 0x20, 0x20, 0x20, 0x00,
356 0x70, 0x88, 0x88, 0x70, 0x88, 0x88, 0x70, 0x00,
357 0x70, 0x88, 0x88, 0x78, 0x08, 0x10, 0x60, 0x00,
358 0x00, 0x00, 0x20, 0x00, 0x00, 0x20, 0x00, 0x00,
359 0x00, 0x00, 0x20, 0x00, 0x00, 0x20, 0x20, 0x40,
360 0x18, 0x30, 0x60, 0xC0, 0x60, 0x30, 0x18, 0x00,
361 0x00, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0x00, 0x00,
362 0xC0, 0x60, 0x30, 0x18, 0x30, 0x60, 0xC0, 0x00,
363 0x70, 0x88, 0x08, 0x10, 0x20, 0x00, 0x20, 0x00,
364 0x70, 0x88, 0x08, 0x68, 0xA8, 0xA8, 0x70, 0x00,
365 0x20, 0x50, 0x88, 0x88, 0xF8, 0x88, 0x88, 0x00,
366 0xF0, 0x48, 0x48, 0x70, 0x48, 0x48, 0xF0, 0x00,
367 0x30, 0x48, 0x80, 0x80, 0x80, 0x48, 0x30, 0x00,
368 0xE0, 0x50, 0x48, 0x48, 0x48, 0x50, 0xE0, 0x00,
369 0xF8, 0x80, 0x80, 0xF0, 0x80, 0x80, 0xF8, 0x00,
370 0xF8, 0x80, 0x80, 0xF0, 0x80, 0x80, 0x80, 0x00,
371 0x70, 0x88, 0x80, 0xB8, 0x88, 0x88, 0x70, 0x00,
372 0x88, 0x88, 0x88, 0xF8, 0x88, 0x88, 0x88, 0x00,
373 0x70, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00,
374 0x38, 0x10, 0x10, 0x10, 0x90, 0x90, 0x60, 0x00,
375 0x88, 0x90, 0xA0, 0xC0, 0xA0, 0x90, 0x88, 0x00,
376 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0xF8, 0x00,
377 0x88, 0xD8, 0xA8, 0xA8, 0x88, 0x88, 0x88, 0x00,
378 0x88, 0xC8, 0xC8, 0xA8, 0x98, 0x98, 0x88, 0x00,
379 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, 0x00,
380 0xF0, 0x88, 0x88, 0xF0, 0x80, 0x80, 0x80, 0x00,
381 0x70, 0x88, 0x88, 0x88, 0xA8, 0x90, 0x68, 0x00,
382 0xF0, 0x88, 0x88, 0xF0, 0xA0, 0x90, 0x88, 0x00,
383 0x70, 0x88, 0x80, 0x70, 0x08, 0x88, 0x70, 0x00,
384 0xF8, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
385 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x70, 0x00,
386 0x88, 0x88, 0x88, 0x88, 0x50, 0x50, 0x20, 0x00,
387 0x88, 0x88, 0x88, 0xA8, 0xA8, 0xD8, 0x88, 0x00,
388 0x88, 0x88, 0x50, 0x20, 0x50, 0x88, 0x88, 0x00,
389 0x88, 0x88, 0x88, 0x70, 0x20, 0x20, 0x20, 0x00,
390 0xF8, 0x08, 0x10, 0x20, 0x40, 0x80, 0xF8, 0x00,
391 0x70, 0x40, 0x40, 0x40, 0x40, 0x40, 0x70, 0x00,
392 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x00,
393 0x70, 0x10, 0x10, 0x10, 0x10, 0x10, 0x70, 0x00,
394 0x20, 0x50, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00,
395 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0x00,
396 0x40, 0x20, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
397 0x00, 0x00, 0x70, 0x08, 0x78, 0x88, 0x78, 0x00,
398 0x80, 0x80, 0xB0, 0xC8, 0x88, 0xC8, 0xB0, 0x00,
399 0x00, 0x00, 0x70, 0x88, 0x80, 0x88, 0x70, 0x00,
400 0x08, 0x08, 0x68, 0x98, 0x88, 0x98, 0x68, 0x00,
401 0x00, 0x00, 0x70, 0x88, 0xF8, 0x80, 0x70, 0x00,
402 0x10, 0x28, 0x20, 0xF8, 0x20, 0x20, 0x20, 0x00,
403 0x00, 0x00, 0x68, 0x98, 0x98, 0x68, 0x08, 0x70,
404 0x80, 0x80, 0xF0, 0x88, 0x88, 0x88, 0x88, 0x00,
405 0x20, 0x00, 0x60, 0x20, 0x20, 0x20, 0x70, 0x00,
406 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x90, 0x60,
407 0x40, 0x40, 0x48, 0x50, 0x60, 0x50, 0x48, 0x00,
408 0x60, 0x20, 0x20, 0x20, 0x20, 0x20, 0x70, 0x00,
409 0x00, 0x00, 0xD0, 0xA8, 0xA8, 0xA8, 0xA8, 0x00,
410 0x00, 0x00, 0xB0, 0xC8, 0x88, 0x88, 0x88, 0x00,
411 0x00, 0x00, 0x70, 0x88, 0x88, 0x88, 0x70, 0x00,
412 0x00, 0x00, 0xB0, 0xC8, 0xC8, 0xB0, 0x80, 0x80,
413 0x00, 0x00, 0x68, 0x98, 0x98, 0x68, 0x08, 0x08,
414 0x00, 0x00, 0xB0, 0xC8, 0x80, 0x80, 0x80, 0x00,
415 0x00, 0x00, 0x78, 0x80, 0xF0, 0x08, 0xF0, 0x00,
416 0x40, 0x40, 0xF0, 0x40, 0x40, 0x48, 0x30, 0x00,
417 0x00, 0x00, 0x90, 0x90, 0x90, 0x90, 0x68, 0x00,
418 0x00, 0x00, 0x88, 0x88, 0x88, 0x50, 0x20, 0x00,
419 0x00, 0x00, 0x88, 0xA8, 0xA8, 0xA8, 0x50, 0x00,
420 0x00, 0x00, 0x88, 0x50, 0x20, 0x50, 0x88, 0x00,
421 0x00, 0x00, 0x88, 0x88, 0x98, 0x68, 0x08, 0x70,
422 0x00, 0x00, 0xF8, 0x10, 0x20, 0x40, 0xF8, 0x00,
423 0x18, 0x20, 0x20, 0x40, 0x20, 0x20, 0x18, 0x00,
424 0x20, 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, 0x00,
425 0xC0, 0x20, 0x20, 0x10, 0x20, 0x20, 0xC0, 0x00,
426 0x40, 0xA8, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
427 0x00, 0x00, 0x20, 0x50, 0xF8, 0x00, 0x00, 0x00,
428 0x70, 0x88, 0x80, 0x80, 0x88, 0x70, 0x20, 0x60,
429 0x90, 0x00, 0x00, 0x90, 0x90, 0x90, 0x68, 0x00,
430 0x10, 0x20, 0x70, 0x88, 0xF8, 0x80, 0x70, 0x00,
431 0x20, 0x50, 0x70, 0x08, 0x78, 0x88, 0x78, 0x00,
432 0x48, 0x00, 0x70, 0x08, 0x78, 0x88, 0x78, 0x00,
433 0x20, 0x10, 0x70, 0x08, 0x78, 0x88, 0x78, 0x00,
434 0x20, 0x00, 0x70, 0x08, 0x78, 0x88, 0x78, 0x00,
435 0x00, 0x70, 0x80, 0x80, 0x80, 0x70, 0x10, 0x60,
436 0x20, 0x50, 0x70, 0x88, 0xF8, 0x80, 0x70, 0x00,
437 0x50, 0x00, 0x70, 0x88, 0xF8, 0x80, 0x70, 0x00,
438 0x20, 0x10, 0x70, 0x88, 0xF8, 0x80, 0x70, 0x00,
439 0x50, 0x00, 0x00, 0x60, 0x20, 0x20, 0x70, 0x00,
440 0x20, 0x50, 0x00, 0x60, 0x20, 0x20, 0x70, 0x00,
441 0x40, 0x20, 0x00, 0x60, 0x20, 0x20, 0x70, 0x00,
442 0x50, 0x00, 0x20, 0x50, 0x88, 0xF8, 0x88, 0x00,
443 0x20, 0x00, 0x20, 0x50, 0x88, 0xF8, 0x88, 0x00,
444 0x10, 0x20, 0xF8, 0x80, 0xF0, 0x80, 0xF8, 0x00,
445 0x00, 0x00, 0x6C, 0x12, 0x7E, 0x90, 0x6E, 0x00,
446 0x3E, 0x50, 0x90, 0x9C, 0xF0, 0x90, 0x9E, 0x00,
447 0x60, 0x90, 0x00, 0x60, 0x90, 0x90, 0x60, 0x00,
448 0x90, 0x00, 0x00, 0x60, 0x90, 0x90, 0x60, 0x00,
449 0x40, 0x20, 0x00, 0x60, 0x90, 0x90, 0x60, 0x00,
450 0x40, 0xA0, 0x00, 0xA0, 0xA0, 0xA0, 0x50, 0x00,
451 0x40, 0x20, 0x00, 0xA0, 0xA0, 0xA0, 0x50, 0x00,
452 0x90, 0x00, 0x90, 0x90, 0xB0, 0x50, 0x10, 0xE0,
453 0x50, 0x00, 0x70, 0x88, 0x88, 0x88, 0x70, 0x00,
454 0x50, 0x00, 0x88, 0x88, 0x88, 0x88, 0x70, 0x00,
455 0x20, 0x20, 0x78, 0x80, 0x80, 0x78, 0x20, 0x20,
456 0x18, 0x24, 0x20, 0xF8, 0x20, 0xE2, 0x5C, 0x00,
457 0x88, 0x50, 0x20, 0xF8, 0x20, 0xF8, 0x20, 0x00,
458 0xC0, 0xA0, 0xA0, 0xC8, 0x9C, 0x88, 0x88, 0x8C,
459 0x18, 0x20, 0x20, 0xF8, 0x20, 0x20, 0x20, 0x40,
460 0x10, 0x20, 0x70, 0x08, 0x78, 0x88, 0x78, 0x00,
461 0x10, 0x20, 0x00, 0x60, 0x20, 0x20, 0x70, 0x00,
462 0x20, 0x40, 0x00, 0x60, 0x90, 0x90, 0x60, 0x00,
463 0x20, 0x40, 0x00, 0x90, 0x90, 0x90, 0x68, 0x00,
464 0x50, 0xA0, 0x00, 0xA0, 0xD0, 0x90, 0x90, 0x00,
465 0x28, 0x50, 0x00, 0xC8, 0xA8, 0x98, 0x88, 0x00,
466 0x00, 0x70, 0x08, 0x78, 0x88, 0x78, 0x00, 0xF8,
467 0x00, 0x60, 0x90, 0x90, 0x90, 0x60, 0x00, 0xF0,
468 0x20, 0x00, 0x20, 0x40, 0x80, 0x88, 0x70, 0x00,
469 0x00, 0x00, 0x00, 0xF8, 0x80, 0x80, 0x00, 0x00,
470 0x00, 0x00, 0x00, 0xF8, 0x08, 0x08, 0x00, 0x00,
471 0x84, 0x88, 0x90, 0xA8, 0x54, 0x84, 0x08, 0x1C,
472 0x84, 0x88, 0x90, 0xA8, 0x58, 0xA8, 0x3C, 0x08,
473 0x20, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x00,
474 0x00, 0x00, 0x24, 0x48, 0x90, 0x48, 0x24, 0x00,
475 0x00, 0x00, 0x90, 0x48, 0x24, 0x48, 0x90, 0x00,
476 0x28, 0x50, 0x20, 0x50, 0x88, 0xF8, 0x88, 0x00,
477 0x28, 0x50, 0x70, 0x08, 0x78, 0x88, 0x78, 0x00,
478 0x28, 0x50, 0x00, 0x70, 0x20, 0x20, 0x70, 0x00,
479 0x28, 0x50, 0x00, 0x20, 0x20, 0x20, 0x70, 0x00,
480 0x28, 0x50, 0x00, 0x70, 0x88, 0x88, 0x70, 0x00,
481 0x50, 0xA0, 0x00, 0x60, 0x90, 0x90, 0x60, 0x00,
482 0x28, 0x50, 0x00, 0x88, 0x88, 0x88, 0x70, 0x00,
483 0x50, 0xA0, 0x00, 0xA0, 0xA0, 0xA0, 0x50, 0x00,
484 0xFC, 0x48, 0x48, 0x48, 0xE8, 0x08, 0x50, 0x20,
485 0x00, 0x50, 0x00, 0x50, 0x50, 0x50, 0x10, 0x20,
486 0xC0, 0x44, 0xC8, 0x54, 0xEC, 0x54, 0x9E, 0x04,
487 0x10, 0xA8, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
488 0x00, 0x20, 0x50, 0x88, 0x50, 0x20, 0x00, 0x00,
489 0x88, 0x10, 0x20, 0x40, 0x80, 0x28, 0x00, 0x00,
490 0x7C, 0xA8, 0xA8, 0x68, 0x28, 0x28, 0x28, 0x00,
491 0x38, 0x40, 0x30, 0x48, 0x48, 0x30, 0x08, 0x70,
492 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF,
493 0xF0, 0xF0, 0xF0, 0xF0, 0x0F, 0x0F, 0x0F, 0x0F,
494 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
495 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
496 0x00, 0x00, 0x00, 0x3C, 0x3C, 0x00, 0x00, 0x00,
497 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00,
498 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0,
499 0x0F, 0x0F, 0x0F, 0x0F, 0xF0, 0xF0, 0xF0, 0xF0,
500 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC, 0xFC,
501 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
502 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F, 0x3F,
503 0x11, 0x22, 0x44, 0x88, 0x11, 0x22, 0x44, 0x88,
504 0x88, 0x44, 0x22, 0x11, 0x88, 0x44, 0x22, 0x11,
505 0xFE, 0x7C, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00,
506 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x7C, 0xFE,
507 0x80, 0xC0, 0xE0, 0xF0, 0xE0, 0xC0, 0x80, 0x00,
508 0x01, 0x03, 0x07, 0x0F, 0x07, 0x03, 0x01, 0x00,
509 0xFF, 0x7E, 0x3C, 0x18, 0x18, 0x3C, 0x7E, 0xFF,
510 0x81, 0xC3, 0xE7, 0xFF, 0xFF, 0xE7, 0xC3, 0x81,
511 0xF0, 0xF0, 0xF0, 0xF0, 0x00, 0x00, 0x00, 0x00,
512 0x00, 0x00, 0x00, 0x00, 0x0F, 0x0F, 0x0F, 0x0F,
513 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,
514 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0xF0, 0xF0,
515 0x33, 0x33, 0xCC, 0xCC, 0x33, 0x33, 0xCC, 0xCC,
516 0x00, 0x20, 0x20, 0x50, 0x50, 0x88, 0xF8, 0x00,
517 0x20, 0x20, 0x70, 0x20, 0x70, 0x20, 0x20, 0x00,
518 0x00, 0x00, 0x00, 0x50, 0x88, 0xA8, 0x50, 0x00,
519 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
520 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF,
521 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 0xF0,
522 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F,
523 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00,
524 0x00, 0x00, 0x68, 0x90, 0x90, 0x90, 0x68, 0x00,
525 0x30, 0x48, 0x48, 0x70, 0x48, 0x48, 0x70, 0xC0,
526 0xF8, 0x88, 0x80, 0x80, 0x80, 0x80, 0x80, 0x00,
527 0xF8, 0x50, 0x50, 0x50, 0x50, 0x50, 0x98, 0x00,
528 0xF8, 0x88, 0x40, 0x20, 0x40, 0x88, 0xF8, 0x00,
529 0x00, 0x00, 0x78, 0x90, 0x90, 0x90, 0x60, 0x00,
530 0x00, 0x50, 0x50, 0x50, 0x50, 0x68, 0x80, 0x80,
531 0x00, 0x50, 0xA0, 0x20, 0x20, 0x20, 0x20, 0x00,
532 0xF8, 0x20, 0x70, 0xA8, 0xA8, 0x70, 0x20, 0xF8,
533 0x20, 0x50, 0x88, 0xF8, 0x88, 0x50, 0x20, 0x00,
534 0x70, 0x88, 0x88, 0x88, 0x50, 0x50, 0xD8, 0x00,
535 0x30, 0x40, 0x40, 0x20, 0x50, 0x50, 0x50, 0x20,
536 0x00, 0x00, 0x00, 0x50, 0xA8, 0xA8, 0x50, 0x00,
537 0x08, 0x70, 0xA8, 0xA8, 0xA8, 0x70, 0x80, 0x00,
538 0x38, 0x40, 0x80, 0xF8, 0x80, 0x40, 0x38, 0x00,
539 0x70, 0x88, 0x88, 0x88, 0x88, 0x88, 0x88, 0x00,
540 0x00, 0xF8, 0x00, 0xF8, 0x00, 0xF8, 0x00, 0x00,
541 0x20, 0x20, 0xF8, 0x20, 0x20, 0x00, 0xF8, 0x00,
542 0xC0, 0x30, 0x08, 0x30, 0xC0, 0x00, 0xF8, 0x00,
543 0x18, 0x60, 0x80, 0x60, 0x18, 0x00, 0xF8, 0x00,
544 0x10, 0x28, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
545 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xA0, 0x40,
546 0x00, 0x20, 0x00, 0xF8, 0x00, 0x20, 0x00, 0x00,
547 0x00, 0x50, 0xA0, 0x00, 0x50, 0xA0, 0x00, 0x00,
548 0x00, 0x18, 0x24, 0x24, 0x18, 0x00, 0x00, 0x00,
549 0x00, 0x30, 0x78, 0x78, 0x30, 0x00, 0x00, 0x00,
550 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00,
551 0x3E, 0x20, 0x20, 0x20, 0xA0, 0x60, 0x20, 0x00,
552 0xA0, 0x50, 0x50, 0x50, 0x00, 0x00, 0x00, 0x00,
553 0x40, 0xA0, 0x20, 0x40, 0xE0, 0x00, 0x00, 0x00,
554 0x00, 0x38, 0x38, 0x38, 0x38, 0x38, 0x38, 0x00,
555 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
559static constexpr auto MSXFont = []{
560 std::array<uint8_t, 256 * 9> result = {};
561 for (
auto i :
xrange(256)) {
567 for (
auto j :
xrange(8)) {
568 uint8_t charBits = 0;
569 for (
auto k :
xrange(8)) {
570 charBits |= uint8_t(((MSXFontRaw[8 * i + 7 - k] >> (7 - j)) & 1) << k);
574 if (oneBits != 0 && start < 0) start = j;
575 if (charBits != 0)
end = j;
576 result[9 * i + j + 1] = charBits;
580 if (start < 0 || start >= 7) start = 0;
583 result[9 * i] = uint8_t((start << 4) |
end);
597 return "msx-printer";
603 return "Emulate MSX printer, prints to image.";
606std::pair<unsigned, unsigned> ImagePrinterMSX::getNumberOfDots()
611void ImagePrinterMSX::resetSettings()
631unsigned ImagePrinterMSX::calcEscSequenceLength(uint8_t character)
638 case 'O':
case '\\':
case 'L':
case '/':
649unsigned ImagePrinterMSX::parseNumber(
unsigned sizeStart,
unsigned sizeChars)
652 while (sizeChars--) {
654 uint8_t data =
abEscSeq[sizeStart++];
655 if (data >=
'0' && data <=
'9') {
656 Value += unsigned(data -
'0');
662void ImagePrinterMSX::processEscSequence()
750 lineFeed = parseNumber(1, 2) * (1.0 / 2.0);
753 lineFeed = parseNumber(1, 2) * (1.0 / 3.0);
800void ImagePrinterMSX::processCharacter(uint8_t data)
863template<
typename Archive>
874static constexpr std::array<uint8_t, 12 * 256> EpsonFontRom = {
875 0x8b, 0x04, 0x0a, 0x20, 0x8a, 0x60, 0x0a, 0x20, 0x1c, 0x02, 0x00, 0x00,
876 0x8b, 0x1c, 0x22, 0x08, 0xa2, 0x48, 0x22, 0x08, 0x22, 0x18, 0x00, 0x00,
877 0x9b, 0x00, 0x3c, 0x00, 0x82, 0x40, 0x02, 0x00, 0x3c, 0x02, 0x00, 0x00,
878 0x9a, 0x00, 0x1c, 0x22, 0x80, 0x62, 0x00, 0x22, 0x1c, 0x00, 0x00, 0x00,
879 0x96, 0x00, 0x12, 0x80, 0x5e, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
880 0xa7, 0x00, 0x00, 0x40, 0xa0, 0x00, 0xa0, 0x40, 0x00, 0x00, 0x00, 0x00,
881 0x8b, 0x12, 0x00, 0x7e, 0x80, 0x12, 0x80, 0x02, 0x80, 0x42, 0x00, 0x00,
882 0xc8, 0x00, 0x00, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
883 0x8b, 0x06, 0x00, 0x09, 0x00, 0x51, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00,
884 0x8b, 0x5e, 0x80, 0x10, 0x80, 0x08, 0x40, 0x04, 0x40, 0x9e, 0x00, 0x00,
885 0x8a, 0x40, 0x9e, 0x00, 0x90, 0x40, 0x10, 0x4e, 0x80, 0x00, 0x00, 0x00,
886 0x8b, 0x92, 0x28, 0x44, 0x00, 0x44, 0x00, 0x44, 0x28, 0x92, 0x00, 0x00,
887 0x8b, 0xfe, 0x00, 0xa0, 0x00, 0x48, 0x00, 0x1e, 0x00, 0x0a, 0x00, 0x00,
888 0x8b, 0x06, 0x08, 0x54, 0xa0, 0x04, 0xa0, 0x54, 0x08, 0x06, 0x00, 0x00,
889 0x8b, 0x04, 0x0a, 0x20, 0x0a, 0xa0, 0x0a, 0x20, 0x1c, 0x02, 0x00, 0x00,
890 0x0a, 0x38, 0x44, 0x01, 0x44, 0x01, 0x46, 0x00, 0x44, 0x00, 0x00, 0x00,
891 0x9a, 0x00, 0x50, 0xaa, 0x00, 0xaa, 0x00, 0xaa, 0x14, 0x00, 0x00, 0x00,
892 0x8a, 0x7e, 0x80, 0x00, 0x80, 0x12, 0x80, 0x12, 0x6c, 0x00, 0x00, 0x00,
893 0x8b, 0x3e, 0x40, 0x90, 0x00, 0xfe, 0x00, 0x92, 0x00, 0x92, 0x00, 0x00,
894 0x8b, 0x2c, 0x02, 0x28, 0x02, 0x1c, 0x20, 0x0a, 0x20, 0x1a, 0x00, 0x00,
895 0x8b, 0x3a, 0x44, 0x00, 0x8a, 0x10, 0xa2, 0x00, 0x44, 0xb8, 0x00, 0x00,
896 0x8b, 0x02, 0x08, 0x14, 0x22, 0x08, 0x22, 0x14, 0x08, 0x20, 0x00, 0x00,
897 0xa9, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00,
898 0x8b, 0x06, 0x88, 0x14, 0x20, 0x44, 0x20, 0x14, 0x88, 0x06, 0x00, 0x00,
899 0x8b, 0x1c, 0xa2, 0x00, 0x22, 0x00, 0x22, 0x00, 0xa2, 0x1c, 0x00, 0x00,
900 0x8b, 0x3c, 0x82, 0x00, 0x02, 0x00, 0x02, 0x00, 0x82, 0x3c, 0x00, 0x00,
901 0x8b, 0x04, 0x0a, 0xa0, 0x0a, 0x20, 0x0a, 0xa0, 0x1c, 0x02, 0x00, 0x00,
902 0x9a, 0x00, 0x1c, 0xa2, 0x00, 0x22, 0x00, 0xa2, 0x1c, 0x00, 0x00, 0x00,
903 0x8a, 0x3c, 0x80, 0x02, 0x00, 0x02, 0x80, 0x3c, 0x02, 0x00, 0x00, 0x00,
904 0x8b, 0x3e, 0x00, 0x2a, 0x00, 0x6a, 0x80, 0x2a, 0x00, 0x22, 0x00, 0x00,
905 0x8b, 0x1c, 0x22, 0x08, 0x22, 0x48, 0xa2, 0x08, 0x22, 0x18, 0x00, 0x00,
906 0x8b, 0xa8, 0x00, 0x68, 0x00, 0x3e, 0x00, 0x68, 0x00, 0xa8, 0x00, 0x00,
907 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
908 0xc8, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
909 0xa9, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00,
910 0x8b, 0x28, 0x00, 0xfe, 0x00, 0x28, 0x00, 0xfe, 0x00, 0x28, 0x00, 0x00,
911 0x8b, 0x24, 0x00, 0x54, 0x00, 0xfe, 0x00, 0x54, 0x00, 0x48, 0x00, 0x00,
912 0x8b, 0xc0, 0x02, 0xc4, 0x08, 0x10, 0x20, 0x46, 0x80, 0x06, 0x00, 0x00,
913 0x8b, 0x4c, 0xa0, 0x12, 0xa0, 0x4a, 0x00, 0x04, 0x08, 0x12, 0x00, 0x00,
914 0xc8, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
915 0xc9, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x82, 0x00, 0x00, 0x00, 0x00,
916 0xa7, 0x00, 0x00, 0x82, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
917 0x8b, 0x10, 0x00, 0x44, 0x28, 0x10, 0x28, 0x44, 0x00, 0x10, 0x00, 0x00,
918 0x8b, 0x10, 0x00, 0x10, 0x00, 0x7c, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00,
919 0x39, 0x00, 0x00, 0x00, 0x0c, 0x01, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00,
920 0x8b, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00,
921 0xa8, 0x00, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
922 0x9a, 0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00,
923 0x8b, 0x38, 0x44, 0x00, 0x82, 0x00, 0x82, 0x00, 0x44, 0x38, 0x00, 0x00,
924 0xa9, 0x00, 0x00, 0x42, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00,
925 0x8b, 0x42, 0x80, 0x06, 0x80, 0x0a, 0x80, 0x12, 0x80, 0x62, 0x00, 0x00,
926 0x8b, 0x84, 0x00, 0x82, 0x00, 0xa2, 0x00, 0xd2, 0x00, 0x8c, 0x00, 0x00,
927 0x8b, 0x08, 0x10, 0x28, 0x40, 0x88, 0x00, 0xfe, 0x00, 0x08, 0x00, 0x00,
928 0x8b, 0xe4, 0x02, 0xa0, 0x02, 0xa0, 0x02, 0xa0, 0x02, 0x9c, 0x00, 0x00,
929 0x8b, 0x0c, 0x12, 0x20, 0x52, 0x80, 0x12, 0x00, 0x12, 0x0c, 0x00, 0x00,
930 0x8b, 0x80, 0x00, 0x82, 0x04, 0x88, 0x10, 0xa0, 0x40, 0x80, 0x00, 0x00,
931 0x8b, 0x6c, 0x92, 0x00, 0x92, 0x00, 0x92, 0x00, 0x92, 0x6c, 0x00, 0x00,
932 0x8b, 0x60, 0x90, 0x00, 0x90, 0x02, 0x94, 0x08, 0x90, 0x60, 0x00, 0x00,
933 0xa7, 0x00, 0x00, 0x36, 0x00, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
934 0x27, 0x00, 0x00, 0x6d, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
935 0x89, 0x10, 0x00, 0x28, 0x00, 0x44, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00,
936 0x8b, 0x28, 0x00, 0x28, 0x00, 0x28, 0x00, 0x28, 0x00, 0x28, 0x00, 0x00,
937 0xab, 0x00, 0x00, 0x82, 0x00, 0x44, 0x00, 0x28, 0x00, 0x10, 0x00, 0x00,
938 0x8b, 0x40, 0x80, 0x00, 0x80, 0x0a, 0x80, 0x10, 0x80, 0x60, 0x00, 0x00,
939 0x8b, 0x38, 0x44, 0x82, 0x10, 0xaa, 0x00, 0xaa, 0x00, 0x7a, 0x00, 0x00,
940 0x8b, 0x1e, 0x20, 0x48, 0x80, 0x08, 0x80, 0x48, 0x20, 0x1e, 0x00, 0x00,
941 0x8b, 0x82, 0x7c, 0x82, 0x10, 0x82, 0x10, 0x82, 0x10, 0x6c, 0x00, 0x00,
942 0x8b, 0x7c, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x44, 0x00, 0x00,
943 0x8b, 0x82, 0x7c, 0x82, 0x00, 0x82, 0x00, 0x82, 0x44, 0x38, 0x00, 0x00,
944 0x8b, 0xfe, 0x00, 0x92, 0x00, 0x92, 0x00, 0x92, 0x00, 0x82, 0x00, 0x00,
945 0x8b, 0xfe, 0x00, 0x90, 0x00, 0x90, 0x00, 0x90, 0x00, 0x80, 0x00, 0x00,
946 0x8b, 0x7c, 0x82, 0x00, 0x82, 0x10, 0x82, 0x10, 0x82, 0x5c, 0x00, 0x00,
947 0x8b, 0xfe, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0xfe, 0x00, 0x00,
948 0xa9, 0x00, 0x00, 0x82, 0x00, 0xfe, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00,
949 0x8a, 0x0c, 0x02, 0x00, 0x82, 0x00, 0x82, 0x7c, 0x80, 0x00, 0x00, 0x00,
950 0x8b, 0xfe, 0x00, 0x10, 0x00, 0x28, 0x00, 0x44, 0x00, 0x82, 0x00, 0x00,
951 0x8b, 0xfe, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00,
952 0x8b, 0xfe, 0x00, 0x40, 0x20, 0x10, 0x20, 0x40, 0x00, 0xfe, 0x00, 0x00,
953 0x8b, 0xfe, 0x00, 0x40, 0x20, 0x10, 0x08, 0x04, 0x00, 0xfe, 0x00, 0x00,
954 0x8b, 0x7c, 0x82, 0x00, 0x82, 0x00, 0x82, 0x00, 0x82, 0x7c, 0x00, 0x00,
955 0x8b, 0xfe, 0x00, 0x90, 0x00, 0x90, 0x00, 0x90, 0x00, 0x60, 0x00, 0x00,
956 0x8b, 0x7c, 0x82, 0x00, 0x82, 0x08, 0x82, 0x04, 0x80, 0x7a, 0x00, 0x00,
957 0x8b, 0xfe, 0x00, 0x90, 0x00, 0x90, 0x00, 0x98, 0x04, 0x62, 0x00, 0x00,
958 0x8b, 0x64, 0x92, 0x00, 0x92, 0x00, 0x92, 0x00, 0x92, 0x4c, 0x00, 0x00,
959 0x8b, 0x80, 0x00, 0x80, 0x00, 0xfe, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00,
960 0x8b, 0xfc, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x02, 0xfc, 0x00, 0x00,
961 0x8b, 0xe0, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0xe0, 0x00, 0x00,
962 0x8b, 0xfc, 0x02, 0x04, 0x08, 0x30, 0x08, 0x04, 0x02, 0xfc, 0x00, 0x00,
963 0x9a, 0x00, 0x82, 0x44, 0x28, 0x10, 0x28, 0x44, 0x82, 0x00, 0x00, 0x00,
964 0x8b, 0x80, 0x40, 0x20, 0x10, 0x0e, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00,
965 0x9a, 0x00, 0x82, 0x04, 0x8a, 0x10, 0xa2, 0x40, 0x82, 0x00, 0x00, 0x00,
966 0xa9, 0x00, 0x00, 0xfe, 0x00, 0x82, 0x00, 0x82, 0x00, 0x00, 0x00, 0x00,
967 0x9a, 0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, 0x00, 0x00,
968 0xa9, 0x00, 0x00, 0x82, 0x00, 0x82, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00,
969 0x8b, 0x20, 0x00, 0x40, 0x00, 0x80, 0x00, 0x40, 0x00, 0x20, 0x00, 0x00,
970 0x0b, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00,
971 0xb7, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
972 0x8b, 0x04, 0x0a, 0x20, 0x0a, 0x20, 0x0a, 0x20, 0x1c, 0x02, 0x00, 0x00,
973 0x8a, 0xfe, 0x00, 0x22, 0x00, 0x22, 0x00, 0x22, 0x1c, 0x00, 0x00, 0x00,
974 0x8a, 0x1c, 0x22, 0x00, 0x22, 0x00, 0x22, 0x00, 0x22, 0x00, 0x00, 0x00,
975 0x8a, 0x1c, 0x22, 0x00, 0x22, 0x00, 0x22, 0x00, 0xfe, 0x00, 0x00, 0x00,
976 0x8b, 0x1c, 0x22, 0x08, 0x22, 0x08, 0x22, 0x08, 0x22, 0x18, 0x00, 0x00,
977 0x89, 0x10, 0x00, 0x10, 0x7e, 0x90, 0x00, 0x90, 0x00, 0x00, 0x00, 0x00,
978 0x0a, 0x38, 0x44, 0x01, 0x44, 0x01, 0x44, 0x01, 0x7e, 0x00, 0x00, 0x00,
979 0x8a, 0xfe, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x1e, 0x00, 0x00, 0x00,
980 0x98, 0x00, 0x22, 0x00, 0xbe, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
981 0x99, 0x00, 0x01, 0x00, 0x01, 0x20, 0x01, 0xbe, 0x00, 0x00, 0x00, 0x00,
982 0x9a, 0x00, 0xfe, 0x00, 0x08, 0x00, 0x14, 0x00, 0x22, 0x00, 0x00, 0x00,
983 0x98, 0x00, 0x82, 0x00, 0xfe, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
984 0x8b, 0x1e, 0x20, 0x00, 0x20, 0x1e, 0x20, 0x00, 0x20, 0x1e, 0x00, 0x00,
985 0x8a, 0x3e, 0x00, 0x20, 0x00, 0x20, 0x00, 0x20, 0x1e, 0x00, 0x00, 0x00,
986 0x8b, 0x1c, 0x22, 0x00, 0x22, 0x00, 0x22, 0x00, 0x22, 0x1c, 0x00, 0x00,
987 0x0a, 0x7f, 0x00, 0x44, 0x00, 0x44, 0x00, 0x44, 0x38, 0x00, 0x00, 0x00,
988 0x1b, 0x00, 0x38, 0x44, 0x00, 0x44, 0x00, 0x44, 0x00, 0x7e, 0x00, 0x00,
989 0x8a, 0x3e, 0x00, 0x10, 0x20, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00,
990 0x8b, 0x10, 0x2a, 0x00, 0x2a, 0x00, 0x2a, 0x00, 0x2a, 0x04, 0x00, 0x00,
991 0x8a, 0x20, 0x00, 0x7c, 0x02, 0x20, 0x02, 0x20, 0x02, 0x00, 0x00, 0x00,
992 0x8b, 0x3c, 0x02, 0x00, 0x02, 0x00, 0x02, 0x00, 0x3c, 0x02, 0x00, 0x00,
993 0x8b, 0x20, 0x10, 0x08, 0x04, 0x02, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00,
994 0x8b, 0x3c, 0x02, 0x04, 0x08, 0x10, 0x08, 0x04, 0x02, 0x3c, 0x00, 0x00,
995 0x89, 0x22, 0x14, 0x00, 0x08, 0x00, 0x14, 0x22, 0x00, 0x00, 0x00, 0x00,
996 0x0b, 0x40, 0x20, 0x11, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00,
997 0x89, 0x22, 0x04, 0x22, 0x08, 0x22, 0x10, 0x22, 0x00, 0x00, 0x00, 0x00,
998 0xaa, 0x00, 0x00, 0x10, 0x00, 0x6c, 0x82, 0x00, 0x82, 0x00, 0x00, 0x00,
999 0xc7, 0x00, 0x00, 0x00, 0x00, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1000 0xaa, 0x00, 0x82, 0x00, 0x82, 0x6c, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,
1001 0x8b, 0x40, 0x80, 0x00, 0x80, 0x40, 0x20, 0x00, 0x20, 0x40, 0x00, 0x00,
1002 0x8b, 0x7c, 0x82, 0x04, 0x8a, 0x10, 0xa2, 0x40, 0x82, 0x7c, 0x00, 0x00,
1003 0x8a, 0x04, 0x0a, 0x80, 0x2a, 0x60, 0x0a, 0x24, 0x1a, 0x00, 0x00, 0x00,
1004 0x8a, 0x0c, 0x12, 0x28, 0x82, 0x68, 0x02, 0x28, 0x10, 0x00, 0x00, 0x00,
1005 0x8a, 0x0c, 0x32, 0x00, 0x82, 0x40, 0x02, 0x0c, 0x32, 0x00, 0x00, 0x00,
1006 0x8a, 0x0c, 0x12, 0x00, 0xa0, 0x42, 0x00, 0x24, 0x18, 0x00, 0x00, 0x00,
1007 0x98, 0x00, 0x02, 0x00, 0x16, 0x88, 0x52, 0x00, 0x00, 0x00, 0x00, 0x00,
1008 0xa9, 0x00, 0x00, 0x40, 0xa0, 0x00, 0xa0, 0x40, 0x00, 0x00, 0x00, 0x00,
1009 0x8b, 0x12, 0x00, 0x1e, 0x60, 0x12, 0x80, 0x12, 0x80, 0x40, 0x00, 0x00,
1010 0x9a, 0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x00, 0x80, 0x00, 0x00, 0x00,
1011 0x8a, 0x06, 0x01, 0x08, 0x01, 0x10, 0x21, 0x80, 0x02, 0x00, 0x00, 0x00,
1012 0x8b, 0x06, 0x58, 0x80, 0x08, 0x84, 0x40, 0x06, 0x58, 0x80, 0x00, 0x00,
1013 0x8b, 0x12, 0x4c, 0x80, 0x10, 0x80, 0x50, 0x02, 0x4c, 0x80, 0x00, 0x00,
1014 0x8b, 0x02, 0x18, 0x24, 0x80, 0x44, 0x02, 0x48, 0x30, 0x80, 0x00, 0x00,
1015 0x8b, 0x06, 0x38, 0xc0, 0x20, 0x88, 0x26, 0xd8, 0x02, 0x08, 0x00, 0x00,
1016 0x8b, 0x02, 0x04, 0x08, 0x14, 0x40, 0xa4, 0x00, 0xbe, 0x40, 0x00, 0x00,
1017 0x8a, 0x04, 0x0a, 0x20, 0x0a, 0x20, 0x8a, 0x24, 0x1a, 0x00, 0x00, 0x00,
1018 0x1b, 0x00, 0x18, 0x21, 0x04, 0x41, 0x06, 0x40, 0x04, 0x40, 0x00, 0x00,
1019 0x8b, 0x02, 0x10, 0x6a, 0x00, 0xaa, 0x00, 0xac, 0x10, 0x80, 0x00, 0x00,
1020 0x8a, 0x06, 0x18, 0x60, 0x00, 0x82, 0x10, 0x82, 0x6c, 0x00, 0x00, 0x00,
1021 0x8b, 0x0e, 0x30, 0x40, 0x90, 0x0e, 0x70, 0x82, 0x10, 0x82, 0x00, 0x00,
1022 0x8b, 0x04, 0x22, 0x08, 0x22, 0x1c, 0x22, 0x08, 0x22, 0x10, 0x00, 0x00,
1023 0x8b, 0x1a, 0x24, 0x42, 0x08, 0x92, 0x20, 0x84, 0x48, 0xb0, 0x00, 0x00,
1024 0x8a, 0x0c, 0x11, 0x02, 0x2c, 0x12, 0x20, 0x44, 0x18, 0x00, 0x00, 0x00,
1025 0xa9, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00,
1026 0x8b, 0x02, 0x04, 0x08, 0x14, 0x80, 0x24, 0x00, 0x3e, 0x80, 0x00, 0x00,
1027 0x8b, 0x0c, 0x12, 0x00, 0xa2, 0x00, 0x22, 0x00, 0xa4, 0x18, 0x00, 0x00,
1028 0x8b, 0x0c, 0x32, 0x00, 0x82, 0x00, 0x02, 0x00, 0x8c, 0x30, 0x00, 0x00,
1029 0x8a, 0x04, 0x0a, 0x20, 0x8a, 0x20, 0x0a, 0x24, 0x9a, 0x00, 0x00, 0x00,
1030 0x8a, 0x0c, 0x12, 0x00, 0xa0, 0x02, 0x00, 0x24, 0x98, 0x00, 0x00, 0x00,
1031 0x8b, 0x0c, 0x32, 0x80, 0x02, 0x00, 0x02, 0x0c, 0xb2, 0x00, 0x00, 0x00,
1032 0x8b, 0x06, 0x18, 0x22, 0x08, 0x22, 0x48, 0x22, 0x80, 0x20, 0x00, 0x00,
1033 0x8a, 0x0c, 0x12, 0x28, 0x02, 0x68, 0x02, 0xa8, 0x10, 0x00, 0x00, 0x00,
1034 0x8b, 0x08, 0x20, 0x88, 0x66, 0x18, 0x20, 0x48, 0x20, 0x80, 0x00, 0x00,
1035 0x8b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1036 0x9a, 0x00, 0x02, 0x00, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00,
1037 0x9a, 0x00, 0x20, 0x40, 0x80, 0x00, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00,
1038 0x8b, 0x28, 0x06, 0x38, 0xc0, 0x28, 0x06, 0x38, 0xc0, 0x28, 0x00, 0x00,
1039 0x8a, 0x00, 0x24, 0x10, 0x46, 0x38, 0xc4, 0x10, 0x48, 0x00, 0x00, 0x00,
1040 0x8b, 0x40, 0x82, 0x44, 0x88, 0x10, 0x22, 0x44, 0x82, 0x04, 0x00, 0x00,
1041 0x8b, 0x0c, 0x10, 0x42, 0xa0, 0x12, 0xa8, 0x44, 0x0a, 0x10, 0x00, 0x00,
1042 0xc8, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
1043 0xba, 0x00, 0x00, 0x00, 0x1c, 0x22, 0x40, 0x00, 0x80, 0x00, 0x00, 0x00,
1044 0x98, 0x00, 0x02, 0x00, 0x04, 0x88, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00,
1045 0x8b, 0x10, 0x04, 0x50, 0x28, 0x10, 0x28, 0x14, 0x40, 0x10, 0x00, 0x00,
1046 0x8b, 0x10, 0x00, 0x14, 0x08, 0x10, 0x20, 0x50, 0x00, 0x10, 0x00, 0x00,
1047 0x29, 0x00, 0x00, 0x01, 0x04, 0x0a, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00,
1048 0x8b, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x10, 0x00, 0x00,
1049 0xa8, 0x00, 0x00, 0x02, 0x04, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
1050 0x9a, 0x00, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00,
1051 0x8b, 0x1c, 0x20, 0x42, 0x00, 0x82, 0x00, 0x84, 0x08, 0x70, 0x00, 0x00,
1052 0x99, 0x00, 0x02, 0x00, 0x46, 0x18, 0x62, 0x80, 0x00, 0x00, 0x00, 0x00,
1053 0x8b, 0x02, 0x40, 0x06, 0x80, 0x0a, 0x80, 0x12, 0x80, 0x60, 0x00, 0x00,
1054 0x8b, 0x04, 0x00, 0x82, 0x00, 0x92, 0x00, 0xb2, 0x4c, 0x80, 0x00, 0x00,
1055 0x8b, 0x08, 0x10, 0x08, 0x20, 0x08, 0x46, 0x38, 0xc0, 0x08, 0x00, 0x00,
1056 0x8b, 0x04, 0x60, 0x82, 0x20, 0x82, 0x20, 0x84, 0x18, 0x80, 0x00, 0x00,
1057 0x8a, 0x0c, 0x10, 0x22, 0x10, 0x42, 0x10, 0x82, 0x0c, 0x00, 0x00, 0x00,
1058 0x8b, 0x80, 0x02, 0x84, 0x08, 0x90, 0x20, 0x80, 0x40, 0x80, 0x00, 0x00,
1059 0x8b, 0x0c, 0x62, 0x10, 0x82, 0x10, 0x82, 0x10, 0x8c, 0x60, 0x00, 0x00,
1060 0x8a, 0x60, 0x02, 0x90, 0x04, 0x90, 0x08, 0x90, 0x60, 0x00, 0x00, 0x00,
1061 0xa9, 0x00, 0x00, 0x02, 0x14, 0x22, 0x14, 0x20, 0x00, 0x00, 0x00, 0x00,
1062 0x2a, 0x00, 0x00, 0x01, 0x04, 0x2a, 0x44, 0x28, 0x40, 0x00, 0x00, 0x00,
1063 0x9a, 0x00, 0x10, 0x08, 0x24, 0x02, 0x40, 0x00, 0x80, 0x00, 0x00, 0x00,
1064 0x8a, 0x08, 0x20, 0x08, 0x20, 0x08, 0x20, 0x08, 0x20, 0x00, 0x00, 0x00,
1065 0x9a, 0x00, 0x02, 0x00, 0x04, 0x80, 0x48, 0x20, 0x10, 0x00, 0x00, 0x00,
1066 0x8a, 0x48, 0x02, 0x80, 0x08, 0x80, 0x10, 0x80, 0x60, 0x00, 0x00, 0x00,
1067 0x8b, 0x1c, 0x20, 0x42, 0x80, 0x12, 0x88, 0x22, 0x88, 0x70, 0x00, 0x00,
1068 0x8b, 0x02, 0x04, 0x08, 0x10, 0x28, 0x40, 0x88, 0x00, 0xfe, 0x00, 0x00,
1069 0x8b, 0x06, 0x98, 0x62, 0x80, 0x12, 0x80, 0x12, 0x8c, 0x60, 0x00, 0x00,
1070 0x8b, 0x1c, 0x22, 0x40, 0x82, 0x00, 0x82, 0x00, 0x84, 0x40, 0x00, 0x00,
1071 0x8b, 0x06, 0x98, 0x62, 0x80, 0x02, 0x80, 0x04, 0x88, 0x70, 0x00, 0x00,
1072 0x8b, 0x06, 0x38, 0xc2, 0x10, 0x82, 0x10, 0x82, 0x00, 0x80, 0x00, 0x00,
1073 0x8b, 0x06, 0x38, 0xc0, 0x10, 0x80, 0x10, 0x80, 0x00, 0x80, 0x00, 0x00,
1074 0x8b, 0x1c, 0x22, 0x40, 0x82, 0x00, 0x92, 0x04, 0x98, 0x40, 0x00, 0x00,
1075 0x8b, 0x06, 0x38, 0xc0, 0x10, 0x00, 0x10, 0x06, 0x38, 0xc0, 0x00, 0x00,
1076 0x92, 0x00, 0x02, 0x00, 0x86, 0x18, 0xe2, 0x00, 0x80, 0x00, 0x00, 0x00,
1077 0x8b, 0x0c, 0x02, 0x00, 0x02, 0x80, 0x04, 0x98, 0x60, 0x80, 0x00, 0x00,
1078 0x8b, 0x06, 0x38, 0xc0, 0x10, 0x20, 0x08, 0x44, 0x02, 0x80, 0x00, 0x00,
1079 0x9a, 0x00, 0x06, 0x18, 0x62, 0x80, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00,
1080 0x8b, 0x06, 0x38, 0xc0, 0x00, 0x30, 0x00, 0x46, 0x38, 0xc0, 0x00, 0x00,
1081 0x8b, 0x06, 0x38, 0xc0, 0x20, 0x10, 0x08, 0x06, 0x38, 0xc0, 0x00, 0x00,
1082 0x8b, 0x0c, 0x32, 0x40, 0x82, 0x00, 0x82, 0x04, 0x98, 0x60, 0x00, 0x00,
1083 0x8b, 0x06, 0x18, 0x60, 0x90, 0x00, 0x90, 0x00, 0x90, 0x60, 0x00, 0x00,
1084 0x8b, 0x1c, 0x20, 0x42, 0x00, 0x8a, 0x00, 0x84, 0x0a, 0x70, 0x00, 0x00,
1085 0x8b, 0x06, 0x18, 0x60, 0x80, 0x10, 0x88, 0x14, 0x82, 0x60, 0x00, 0x00,
1086 0x8b, 0x04, 0x62, 0x00, 0x92, 0x00, 0x92, 0x00, 0x8c, 0x40, 0x00, 0x00,
1087 0x8b, 0x80, 0x00, 0x86, 0x18, 0xe0, 0x00, 0x80, 0x00, 0x80, 0x00, 0x00,
1088 0x8b, 0x0c, 0x32, 0xc0, 0x02, 0x00, 0x02, 0x0c, 0x30, 0xc0, 0x00, 0x00,
1089 0x9b, 0x00, 0xfe, 0x00, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00,
1090 0x8b, 0x06, 0x38, 0xc4, 0x08, 0x10, 0x08, 0x06, 0x38, 0xc0, 0x00, 0x00,
1091 0x8b, 0x02, 0x84, 0x48, 0x20, 0x18, 0x24, 0x02, 0x40, 0x80, 0x00, 0x00,
1092 0x8b, 0x80, 0x40, 0x26, 0x18, 0x00, 0x20, 0x00, 0x40, 0x80, 0x00, 0x00,
1093 0x8b, 0x02, 0x04, 0x8a, 0x00, 0x92, 0x00, 0xa2, 0x40, 0x80, 0x00, 0x00,
1094 0x9b, 0x00, 0x06, 0x18, 0x62, 0x80, 0x02, 0x80, 0x00, 0x80, 0x00, 0x00,
1095 0xa8, 0x00, 0x00, 0xc0, 0x30, 0x0c, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
1096 0x8a, 0x02, 0x00, 0x02, 0x80, 0x06, 0x98, 0x60, 0x80, 0x00, 0x00, 0x00,
1097 0x9a, 0x00, 0x20, 0x00, 0x40, 0x00, 0x80, 0x40, 0x20, 0x00, 0x00, 0x00,
1098 0x0b, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00,
1099 0xb7, 0x00, 0x00, 0x00, 0x80, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
1100 0x8a, 0x04, 0x0a, 0x20, 0x0a, 0x20, 0x0a, 0x24, 0x1a, 0x00, 0x00, 0x00,
1101 0x8a, 0x06, 0x18, 0xe2, 0x00, 0x22, 0x00, 0x24, 0x18, 0x00, 0x00, 0x00,
1102 0x8a, 0x0c, 0x10, 0x02, 0x20, 0x02, 0x20, 0x02, 0x20, 0x00, 0x00, 0x00,
1103 0x8b, 0x0c, 0x10, 0x02, 0x20, 0x02, 0x20, 0x06, 0x38, 0xc0, 0x00, 0x00,
1104 0x8a, 0x0c, 0x12, 0x28, 0x02, 0x28, 0x02, 0x28, 0x10, 0x00, 0x00, 0x00,
1105 0x8b, 0x20, 0x00, 0x26, 0x18, 0x60, 0x00, 0xa0, 0x00, 0x80, 0x00, 0x00,
1106 0x1b, 0x00, 0x18, 0x25, 0x00, 0x45, 0x00, 0x46, 0x18, 0x60, 0x00, 0x00,
1107 0x8a, 0x06, 0x18, 0xe0, 0x00, 0x20, 0x00, 0x26, 0x18, 0x00, 0x00, 0x00,
1108 0x99, 0x00, 0x02, 0x00, 0x26, 0x18, 0x22, 0x80, 0x00, 0x00, 0x00, 0x00,
1109 0x89, 0x01, 0x00, 0x01, 0x00, 0x26, 0x18, 0xa0, 0x00, 0x00, 0x00, 0x00,
1110 0x8a, 0x06, 0x18, 0x60, 0x88, 0x04, 0x12, 0x00, 0x20, 0x00, 0x00, 0x00,
1111 0x99, 0x00, 0x02, 0x00, 0x06, 0x98, 0x62, 0x80, 0x00, 0x00, 0x00, 0x00,
1112 0x8a, 0x26, 0x18, 0x20, 0x06, 0x38, 0x00, 0x26, 0x18, 0x00, 0x00, 0x00,
1113 0x89, 0x26, 0x18, 0x20, 0x00, 0x20, 0x06, 0x18, 0x00, 0x00, 0x00, 0x00,
1114 0x8a, 0x0c, 0x12, 0x00, 0x20, 0x02, 0x00, 0x24, 0x18, 0x00, 0x00, 0x00,
1115 0x0a, 0x03, 0x1c, 0x60, 0x04, 0x40, 0x04, 0x48, 0x30, 0x00, 0x00, 0x00,
1116 0x1b, 0x00, 0x18, 0x24, 0x00, 0x44, 0x00, 0x47, 0x18, 0x60, 0x00, 0x00,
1117 0x89, 0x06, 0x38, 0x00, 0x10, 0x20, 0x00, 0x20, 0x00, 0x00, 0x00, 0x00,
1118 0x8a, 0x02, 0x10, 0x02, 0x28, 0x02, 0x28, 0x04, 0x20, 0x00, 0x00, 0x00,
1119 0x9a, 0x00, 0x20, 0x0c, 0x32, 0xc0, 0x22, 0x00, 0x20, 0x00, 0x00, 0x00,
1120 0x8a, 0x0c, 0x32, 0x00, 0x02, 0x00, 0x02, 0x0c, 0x32, 0x00, 0x00, 0x00,
1121 0x9a, 0x00, 0x3e, 0x00, 0x04, 0x00, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00,
1122 0x8b, 0x0e, 0x30, 0x04, 0x00, 0x18, 0x04, 0x00, 0x06, 0x38, 0x00, 0x00,
1123 0x8b, 0x02, 0x00, 0x24, 0x10, 0x08, 0x04, 0x12, 0x00, 0x20, 0x00, 0x00,
1124 0x1b, 0x00, 0x40, 0x21, 0x12, 0x04, 0x08, 0x10, 0x20, 0x40, 0x00, 0x00,
1125 0x8b, 0x02, 0x00, 0x26, 0x00, 0x2a, 0x00, 0x32, 0x00, 0x20, 0x00, 0x00,
1126 0x9a, 0x00, 0x10, 0x04, 0x1a, 0x60, 0x82, 0x00, 0x80, 0x00, 0x00, 0x00,
1127 0x99, 0x00, 0x02, 0x04, 0x08, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00,
1128 0x9a, 0x00, 0x02, 0x00, 0x82, 0x0c, 0xb0, 0x40, 0x10, 0x00, 0x00, 0x00,
1129 0x8b, 0x40, 0x80, 0x00, 0x80, 0x40, 0x20, 0x00, 0x20, 0x40, 0x00, 0x00,
1130 0x8b, 0x1a, 0x24, 0x42, 0x08, 0x92, 0x20, 0x84, 0x48, 0xb0, 0x00, 0x00
1141 return "epson-printer";
1146 return "Emulate Epson FX80 printer, prints to image.";
1149std::pair<unsigned, unsigned> ImagePrinterEpson::getNumberOfDots()
1154void ImagePrinterEpson::resetSettings()
1172unsigned ImagePrinterEpson::calcEscSequenceLength(uint8_t character)
1174 switch (character & 127) {
1175 case '!':
case '-':
case '/':
case '3':
case 'A':
case 'J':
1176 case 'N':
case 'Q':
case 'R':
case 'S':
case 'U':
case 'W':
1177 case 'b':
case 'i':
case 'j':
case 'l':
case 'p':
case 's':
1179 case '%':
case '?':
case 'K':
case 'L':
case 'Z':
case '^':
1181 case '*':
case ':':
case '&':
1194unsigned ImagePrinterEpson::parseNumber(
unsigned sizeStart,
unsigned sizeChars)
1197 sizeStart += sizeChars;
1198 while (sizeChars--) {
1199 Value = Value * 256 +
abEscSeq[--sizeStart];
1204void ImagePrinterEpson::processEscSequence()
1206 uint8_t character =
abEscSeq[0] & 127;
1208 switch (character) {
1210 unsigned masterSelect = parseNumber(1, 1);
1211 elite = (masterSelect & 1) != 0;
1213 bold = (masterSelect & 8) != 0;
1240 switch (parseNumber(1, 1)) {
1278 lineFeed = (parseNumber(1, 1) & 127) * (1.0 / 3.0);
1337 lineFeed = parseNumber(1, 1) & 127;
1361 vpos += (parseNumber(1, 1) & 127) * (1.0 / 3.0);
1389 auto width = parseNumber(1, 2);
1390 if (width > 78) width = 78;
1401 auto script = parseNumber(1, 1) & 1;
1434 vpos -= (parseNumber(1, 1) & 127) * (1.0 / 3.0);
1453static constexpr std::array<uint8_t, 9> intlChar35 = { 35, 35, 35, 6, 35, 35, 35, 12, 35};
1454static constexpr std::array<uint8_t, 9> intlChar36 = { 36, 36, 36, 36, 36, 11, 36, 36, 36};
1455static constexpr std::array<uint8_t, 9> intlChar64 = { 64, 0, 16, 64, 64, 29, 64, 64, 64};
1456static constexpr std::array<uint8_t, 9> intlChar91 = { 91, 5, 23, 91, 18, 23, 5, 7, 91};
1457static constexpr std::array<uint8_t, 9> intlChar92 = { 92, 15, 24, 92, 20, 24, 92, 9, 31};
1458static constexpr std::array<uint8_t, 9> intlChar93 = { 93, 16, 25, 93, 13, 13, 30, 8, 93};
1459static constexpr std::array<uint8_t, 9> intlChar94 = { 94, 94, 94, 94, 94, 25, 94, 94, 94};
1460static constexpr std::array<uint8_t, 9> intlChar96 = { 96, 96, 96, 96, 96, 30, 2, 96, 96};
1461static constexpr std::array<uint8_t, 9> intlChar123 = {123, 30, 26, 123, 19, 26, 0, 22, 123};
1462static constexpr std::array<uint8_t, 9> intlChar124 = {124, 2, 27, 124, 21, 27, 3, 10, 124};
1463static constexpr std::array<uint8_t, 9> intlChar125 = {125, 1, 28, 125, 14, 14, 1, 125, 125};
1464static constexpr std::array<uint8_t, 9> intlChar126 = {126, 22, 17, 126, 126, 28, 4, 126, 126};
1466void ImagePrinterEpson::processCharacter(uint8_t data)
1481 switch (data & 0x7f) {
1482 case 35: data = (data & 0x80) | intlChar35 [
countryCode];
break;
1483 case 36: data = (data & 0x80) | intlChar36 [
countryCode];
break;
1484 case 64: data = (data & 0x80) | intlChar64 [
countryCode];
break;
1485 case 91: data = (data & 0x80) | intlChar91 [
countryCode];
break;
1486 case 92: data = (data & 0x80) | intlChar92 [
countryCode];
break;
1487 case 93: data = (data & 0x80) | intlChar93 [
countryCode];
break;
1488 case 94: data = (data & 0x80) | intlChar94 [
countryCode];
break;
1489 case 96: data = (data & 0x80) | intlChar96 [
countryCode];
break;
1490 case 123: data = (data & 0x80) | intlChar123[
countryCode];
break;
1491 case 124: data = (data & 0x80) | intlChar124[
countryCode];
break;
1492 case 125: data = (data & 0x80) | intlChar125[
countryCode];
break;
1493 case 126: data = (data & 0x80) | intlChar126[
countryCode];
break;
1570template<
typename Archive>
1582 : buf(size_t(x) * size_t(y))
1583 , sizeX(x), sizeY(y)
1593 VLA(
const uint8_t*, rowPointers, sizeY);
1594 for (
size_t y :
xrange(sizeY)) {
1595 rowPointers[y] = &buf[sizeX * y];
1603 radiusX = dotSizeX * 0.5;
1604 radiusY = dotSizeY * 0.5;
1606 auto rx = int(16 * radiusX);
1607 auto ry = int(16 * radiusY);
1611 table.resize(2 * (radius16 + 16), -(1 << 30));
1613 int offset = ry + 16;
1614 int rx2 = 2 * rx * rx;
1615 int ry2 = 2 * ry * ry;
1620 int de_y = (1 - 2 * ry) * rx * rx;
1625 table[offset - y - 1] = x;
1626 table[offset + y ] = x;
1631 if ((2 * e + de_y) > 0) {
1641 de_x = (1 - 2 * rx) * ry * ry;
1647 table[offset - y - 1] = x;
1648 table[offset + y ] = x;
1653 if ((2 * e + de_x) > 0) {
1664 int xx1 = std::max(
int(floor(xPos - radiusX)), 0);
1665 int xx2 = std::min(
int(ceil (xPos + radiusX)),
int(sizeX));
1666 int yy1 = std::max(
int(floor(yPos - radiusY)), 0);
1667 int yy2 = std::min(
int(ceil (yPos + radiusY)),
int(sizeY));
1669 int y = 16 * yy1 - int(16 * yPos) + 16 + radius16;
1670 for (
auto yy :
xrange(yy1, yy2)) {
1671 int x = 16 * xx1 - int(16 * xPos);
1672 for (
auto xx :
xrange(xx1, xx2)) {
1674 for (
auto i :
xrange(16)) {
1675 int a = table[y + i];
1679 sum += std::min(
t, 2 * a);
1684 sum += std::min(16,
t);
1688 dot(xx, yy) = narrow<uint8_t>(std::max(0, dot(xx, yy) -
sum));
1695uint8_t& Paper::dot(
unsigned x,
unsigned y)
1699 return buf[y * sizeX + x];
Dot Matrix Printer Emulation code mostly copied from blueMSX but changed to: OO-style save to png ima...
void printInfo(std::string_view message)
void printWarning(std::string_view message)
Represents something you can plug devices into.
std::string_view getName() const override
Name used to identify this pluggable.
void serialize(Archive &ar, unsigned version)
ImagePrinterEpson(MSXMotherBoard &motherBoard)
std::string_view getDescription() const override
Description for this pluggable.
std::string_view getDescription() const override
Description for this pluggable.
void serialize(Archive &ar, unsigned version)
std::string_view getName() const override
Name used to identify this pluggable.
ImagePrinterMSX(MSXMotherBoard &motherBoard)
virtual unsigned calcEscSequenceLength(uint8_t character)=0
void seekPrinterHeadRelative(double offset)
void resetEmulatedPrinter()
virtual std::pair< unsigned, unsigned > getNumberOfDots()=0
unsigned remainingCommandBytes
std::array< uint8_t, MAX_ESC_CMDSIZE > abEscSeq
virtual void processCharacter(uint8_t data)=0
void plot9Dots(double x, double y, unsigned pattern)
unsigned sizeRemainingDataBytes
ImagePrinter(MSXMotherBoard &motherBoard, bool graphicsHiLo)
virtual void resetSettings()=0
void printVisibleCharacter(uint8_t data)
void forceFormFeed() override
struct openmsx::ImagePrinter::FontInfo fontInfo
virtual void processEscSequence()=0
void flushEmulatedPrinter()
void write(uint8_t data) override
void printGraphicByte(uint8_t data)
A Setting with an integer value.
MSXCliComm & getMSXCliComm()
Paper(unsigned x, unsigned y, double dotSizeX, double dotSizeY)
void plot(double x, double y)
static constexpr std::string_view PRINT_DIR
static constexpr std::string_view PRINT_EXTENSION
void setDotSize(double sizeX, double sizeY)
void writeData(uint8_t data, EmuTime::param time) override
Sets the data signals.
void setStrobe(bool strobe, EmuTime::param time) override
Sets the strobe signal: false = low, true = high.
virtual void forceFormFeed()=0
void plugHelper(Connector &connector, EmuTime::param time) override
virtual void write(uint8_t data)=0
void unplugHelper(EmuTime::param time) override
bool getStatus(EmuTime::param time) override
Returns the STATUS signal: false = low = ready, true = high = not ready.
constexpr uint8_t reverseByte(uint8_t a)
Reverse the bits in a byte.
string getNextNumberedFileName(string_view directory, string_view prefix, string_view extension, bool addSeparator)
Gets the next numbered file name with the specified prefix in the specified directory,...
void saveGrayscale(size_t width, std::span< const uint8_t * > rowPointers_, const std::string &filename)
This file implemented 3 utility functions:
constexpr void fill(ForwardRange &&range, const T &value)
constexpr auto copy(InputRange &&range, OutputIter out)
constexpr auto subspan(Range &&range, size_t offset, size_t count=std::dynamic_extent)
#define INSTANTIATE_SERIALIZE_METHODS(CLASS)
constexpr auto sum(InputRange &&range, Proj proj={})
std::array< uint8_t, 256 *MAX_FONT_WIDTH > rom
std::array< uint8_t, 256 *MAX_FONT_WIDTH > ram
#define VLA(TYPE, NAME, LENGTH)
constexpr auto xrange(T e)
constexpr auto end(const zstring_view &x)