infoxicator / react-native-star-prnt

React-Native bridge to communicate with Star Micronics Bluetooth/LAN Printers
MIT License
67 stars 65 forks source link

Is there any way to adjust text size for append? #62

Closed stephengladney closed 3 years ago

stephengladney commented 3 years ago

This is probably not an issue with the library, but has anyone found a way to adjust the text size when using the append method? The text is way too small for the use case. I've spent hours googling and cannot find a clear explanation of how to adjust text size.

appendMultiple allows a height and width but the moment you go from 1 to 2, it's too large. I need something like 1.5 but this method doesn't recognize non-integers.

Curious if anyone has any advice on how to accomplish a text size and style similar to this (specifically the items and prices): uereceipt

Lozrus commented 3 years ago

When using append, you are using the fonts built-in to the printer. These are bitmap fonts which only support integer magnification. The built in fonts are 'A' (the default) as 12x24 dots, and 'B' at 9x24 dots (at 8 dots/mm resolution). You might find that switching to font 'B' (using appendFontStyle) and magnifying that gives the size you want.

If you want much more control over the font size and design, then you will need to use scalable fonts, printed graphically, using appendBitmapText. My best guess is that the Uber Eats receipt is rendered entirely using a canvas drawing API (maybe generated server side) and then printed with appendBitmap.