Skip to content

setTextSize(2,2); too big #388

Description

@Cynically

I find the default font size on a Epson TM-T88V a little bit small for older people to read but if I set the font size to 2x then it is a way too big. What would be the best way to have a size inbetween?

Activity

Stenerson commented on Jul 8, 2017

@Stenerson
Collaborator

Have you tried setTextSize(1, 2) or setTextSize(2, 1)? I find that the double height OR double width alone is some times enough.

Cynically commented on Jul 8, 2017

@Cynically
Author

I have tried. Double height of way too tall to list all of the items. The perfect would really be half point.

mike42 commented on Jul 16, 2017

@mike42
Owner

Unfortunately, nothing like this is possible in native ESC/POS. The best you could do is render system fonts as small pictures, and print those instead.

There is one trick that I'll suggest though: you can double FONT B instead, which is slightly smaller (Exact specs depend on your printer, check the manual)

require __DIR__ . '/../autoload.php';
use Mike42\Escpos\Printer;
use Mike42\Escpos\PrintConnectors\FilePrintConnector;

$connector = new FilePrintConnector("php://stdout");
$printer = new Printer($connector);

/* Initialize */
$printer -> initialize();

title($printer, "Font A sizes\n");
$printer -> setFont(Printer::FONT_A);
$printer -> setTextSize(1, 1);
$printer -> text("The quick brown fox jumps over the lazy dog.\n");
$printer -> setTextSize(2, 2);
$printer -> text("The quick brown fox jumps over the lazy dog.\n");

title($printer, "Font B sizes\n");
$printer -> setFont(Printer::FONT_B);
$printer -> setTextSize(1, 1);
$printer -> text("The quick brown fox jumps over the lazy dog.\n");
$printer -> setTextSize(2, 2);
$printer -> text("The quick brown fox jumps over the lazy dog.\n");

$printer -> cut();
$printer -> close();

function title(Printer $printer, $text)
{
    $printer -> selectPrintMode(Printer::MODE_EMPHASIZED);
    $printer -> text("\n" . $text);
    $printer -> selectPrintMode(); // Reset
}

As printed on an Epson TM-T20:

2017-07-font-demo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @Stenerson@mike42@Cynically

        Issue actions