Chinese formatting

hi, emre, sorry for my poor english.
It looks a bit out of alignment in Chinese, how to fix it?
thanks

What printer type is that?

Just Demo Printer(notepad).
os: win8.1 chinese

Can you try <J00:2> tag instead of <J00> ?

:2 part indicates Chinese letters are 2 characters wide.

It worked.
thanks emre

Hi emre,
I tested “J00:2” with the notepad demo printer and it works fine. But when I use the HTML printer, the same type of misalignment remains unresolved (that is, for every 1 Chinese character present, the price is shifted by 1 to the right).

Do you know of a fix for HTML printers? Thanks.

It should work fine with HTML printer too but you need to use a fixed size font and configure line character count properly for that font. For example if you use a bigger font only 20 characters can fit to a single line but for smaller fonts that will be higher. If you send us some screen shots we can better investigate the issue.

Hi emre,
I’m using 20 chars per line, which should be OK (there’s still some room left).

The output for the demo printer and HTML printer (using Epson TM-T88V) are as follows:


The price shifts more when the item contains more chinese characters, but none when only english chars are present.

The template is the standard “Ticket” template with a few slight changes:

[LAYOUT]
-- General layout
<span style="font-family:NSimSun">
<L00>Date:{TICKET DATE}
<L00>Time:{TIME}
{ENTITIES}
-- <L00>Ticket No:{TICKET NO}
<F>-
<J00>Sample Text|1.11
{ORDERS}
<F>=
<EB>
{DISCOUNTS}
{TAXES}
[<J10>Total Gift:|{ORDER STATE TOTAL:Gift}]
<J00>Total:|{TICKET TOTAL}
{PAYMENTS}
<DB>
<F>=
-- <C10>多謝! Thank you, please come again!
</span>

[DISCOUNTS]
<J00>{CALCULATION NAME} %{CALCULATION AMOUNT}|{CALCULATION TOTAL}

[PAYMENTS]
<J00>{PAYMENT NAME}|{PAYMENT AMOUNT}

[ORDERS]
-- Default format for orders
-- <J00:2>{QUANTITY} {NAME}|{TOTAL PRICE}
<J00:2>{QUANTITY} {NAME}|{TOTAL PRICE}
{ORDER TAGS}

[ORDERS:Gift]
-- Format for gifted orders
<J00>- {QUANTITY} {NAME}|**GIFT**
{ORDER TAGS}

[ORDERS:Void]
-- Nothing will print for void lines

[ORDER TAGS]
-- Format for order tags
<J00> * {ORDER TAG NAME} | {ORDER TAG PRICE}

[ENTITIES:Table]
-- Table entity format
<L00>Table: {ENTITY NAME}

[ENTITIES:Customer]
-- Customer entity format
<J00>Customer: {ENTITY NAME} | {ENTITY DATA:Phone}

[TAXES]
-- <L00>{TAX NAME}
-- <L00> Taxable Amount: {TAXABLE AMOUNT}
<J00>HST (13%)| {TAX AMOUNT}

<F>-

Current Diagnosis:
<J00> tags seem to be partially ignored: setting a different font size here has no effect (J00 and J22 print the same size chars). My current guess is that the “:2” part is also thus ignored.

@aaronlee29 thank you very much for the screen shots. I’ve investigated code a little more and it seems you are right. We’re using same printing code to automatically convert reports to Ticket Printer format behind the scenes, so it handles <J> tag differently. I’ll check if we can implement a solution for this.

I think I’ve implemented a solution for Chinese. I’ll be happy if you can test it with next release and let me know your results.

PS: Just added random Chinese characters to test. Sorry if it means something weird :slight_smile:

Hi Emre, I’ll be happy to try it out when it is released. Thanks!
Aaron

Update: Chinese character spacing works fine with in HTML Printer mode.
Thanks emre for the fix.

1 Like

This works great, but how would I change the format to make the total larger.

I’ve seen as on one of the sample templates (which I notice doesn’t work in the latest version) here:

http://doc.sambapos.org/doku.php/en/tips/sample_ticket_printer_template#sample_ticket_printer_template

The R21 code doesn’t work.

Trying to get this to work for the customer’s bill and also for the kitchen to see because the normal font size is too small for the older chefs.

Thanks in advance!

Read [New 4.1.18] HTML Printer Improvements for font sizin with HTML printers.

Hi emre, I played around with Chinese formatting and have some feedback:

1) Suggestion: To have graceful overflow onto next line for long-name items.


Currently, the spacing becomes off and the price becomes left-aligned.
*I believe that the software is trying to right-align the last word on the line (normally it is the price), but because the price is now on line 2, it is now (incorrectly) right-aligning the dish name. Just a guess, though.

I think it would be more readable if: (1) spacing is preserved and (2) price is always right-aligned. See (photoshopped) image below:

2) Issue: Item overflows a bit too soon:


The last item contains 11 Chinese characters (including the “Chinese” parentheses) and 8 regular characters (including 1 whitespace, quantity info and price). I read in your other posts that Chinese characters count as 2 chars, so 2x11 + 8 = 30 characters only (*not 31 as drawn on receipt). The printer is set to 38 characters, and as is shown above, one line has enough room display the last item fully, but for some reason it prematurely overflows to the second line.

1 Like

@aaronlee29 thank you very much for testing it and sharing your feedback. I think you’ve guessed the reasons of these glitches right. I’ll test them soon.

Thanks emre!

I’ve managed to get the font sizes correct. But now I get big spaces between the sections.

How can i get rid of these spaces?

My code is as follows:

    [LAYOUT]
-- General layout
<div style="font-weight:bold;font-size:30px">{ENTITIES}</div>
<L00>{TICKET DATE} {TIME}
<L00>------------------------------------
<div style="font-size:25px">{ORDERS}
</div>
<L00>====================================
<L00>(kitchen HTML printer ENGCHI)

[ORDERS]
-- Default format for orders
<L00>- {QUANTITY} {BARCODE}
{ORDER TAGS}

[ORDERS:Gift]
-- Format for gifted orders
<J00>- {QUANTITY} {NAME}|**GIFT**
{ORDER TAGS}

[ORDERS:Void]
-- Nothing will print for void lines

[ORDER TAGS]
-- Format for order tags
<J00> * {ORDER TAG NAME} | {ORDER TAG PRICE}

[ENTITIES:Table]
-- Table entity format
<C00>Table: {ENTITY NAME}

[ENTITIES:Customer]
-- Customer entity format
<J00>Customer: {ENTITY NAME} | {ENTITY DATA:Phone}

Try using <span> instead of <div>

Perfect!! That works great! Thanks emre!!

On a different note, how can I add the person count on the kitchen and bill tickets too? I can’t figure which identifiers I need to use.

{PERSON COUNT} doesn’t seem to work.

Thanks again!

… so it should be {TICKET TAG:Person Count} not {PERSON COUNT}

PS: Please post your comments under related topic. Thanks.