ESC/P: Add handling for a separate italic dot matrix font

This commit is contained in:
Alexander Babikov
2023-12-25 17:33:43 +05:00
parent a9d96371dc
commit 7ff4fd355f
2 changed files with 9 additions and 5 deletions

View File

@@ -46,7 +46,8 @@
#ifndef PRINTER_H
#define PRINTER_H
#define FONT_FILE_DOTMATRIX "dotmatrix.otf"
#define FONT_FILE_DOTMATRIX "dotmatrix.otf"
#define FONT_FILE_DOTMATRIX_ITALIC "dotmatrix_italic.otf"
#define FONT_FILE_ROMAN "roman.ttf"
#define FONT_FILE_SANSSERIF "sansserif.ttf"

View File

@@ -508,9 +508,12 @@ update_font(escp_t *dev)
if (dev->fontface)
FT_Done_Face(dev->fontface);
if (dev->print_quality == QUALITY_DRAFT)
fn = FONT_FILE_DOTMATRIX;
else
if (dev->print_quality == QUALITY_DRAFT) {
if (dev->font_style & STYLE_ITALICS)
fn = FONT_FILE_DOTMATRIX_ITALIC;
else
fn = FONT_FILE_DOTMATRIX;
} else
switch (dev->lq_typeface) {
case TYPEFACE_ROMAN:
fn = FONT_FILE_ROMAN;
@@ -592,7 +595,7 @@ update_font(escp_t *dev)
(uint16_t) (hpoints * 64), (uint16_t) (vpoints * 64),
dev->dpi, dev->dpi);
if ((dev->font_style & STYLE_ITALICS) || (dev->char_tables[dev->curr_char_table] == 0)) {
if ((dev->print_quality != QUALITY_DRAFT) && ((dev->font_style & STYLE_ITALICS) || (dev->char_tables[dev->curr_char_table] == 0))) {
/* Italics transformation. */
matrix.xx = 0x10000L;
matrix.xy = (FT_Fixed) (0.20 * 0x10000L);