Chinese formatting

@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.

@aaronlee29 it seems default document formatter for windows printer does that wrapping. I’ve changed your sample template as follows for better formatting.

[LAYOUT]
-- General layout
<div style="font-family:NSimSun;text-align:left">
<L00>Date:{TICKET DATE}
<L00>Time:{TIME}
{ENTITIES}
<F>-
{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!
</div>

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

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

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

{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>-

However that does not solve aligning wrapped prices to right issue. I’ll also try to find a solution for that… Until that using smaller fonts for order lines might work.

Thanks for that emre!!!

<xct>28,112,1,48

[LAYOUT]
-- General layout
<div style="font-family:NSimsun;text-align:left">
<C10>1st Floor,No:29,Salim,Sibu
<J00>Tel: 0165795829 |  Email: foodtimecafe@gmail.com
<J00>Date:{TICKET DATE}|Time:{TIME} 
<J00>Table:{ENTITY NAME:Table}| Ticket No:{TICKET NO}
<F>-
{ORDERS}
<F>=
<EB>
{DISCOUNTS}
[<J10>Total Gift:|{ORDER STATE TOTAL:Gift}]
{SERVICES}
<J10>Total:|{TICKET TOTAL}
{PAYMENTS}
<DB>
<F>=
<C10>T H A N K   Y O U
</div>

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

[SERVICES]
<J00>{CALCULATION NAME}|{CALCULATION TOTAL}

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

[ORDERS]
-- Default format for orders
<span>
<J00:2>{QUANTITY}Nos {NAME}|{TOTAL PRICE}
</span>
{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}

first item been cut off, eg taiwainese pork rice, it printed taiwanese only, the second item above works ok

i printed in english format only

it still the same, the word of first item is incomplete, otherwise fine.
if i remove the span, all line show incomplete word.

help pls,

Dear aaronlee29,

I need same solution for Lao Language. My bill printout is still shown as attached below:

How to adjust column of price to be perfectly position.

My parameters:
SambaPOS: 4.1.8
Printer Type: HTML
Character Set: 857
Line Character Set: 29

Best Regards,
Phoxaysy

You need to use fixed width (monospace) fonts to format lines properly.

Fixed width fonts uses fixed character width for all letters so line formats works fine.
For example…

Lines with 10 i characters are shorter than 10 0 characters so prices does not align.

iiiiiiiiii $10
0000000000 $10

When fixed width fonts used line lengths becomes same and prices aligns fine.

iiiiiiiiii $10
0000000000 $10

2 Likes

Hi Emre,

Thank you for your reply. If i understand correctly i’ve try to download front “Cousine” and “BPmono” also try with Tahoma which is monospace font but nothing affect for good result. And then i changed to “Phetsarath_OT” result looks fixed width font but result still same. Here is my template code:

[LAYOUT]
-- General layout

<div style="font-size:14px; font-family:'Phetsarath_OT';text-align:center">
ໃບແຈ້ງລາຄາ
</div>

<div style="font-size:12px; font-family:'Phetsarath_OT'">
<L00>DEV Restaurant    ເບີໂທ:11111  
<L00>ວັນທີ:{TICKET DATE}     ເວລາ:{TIME}
<J10>|{TICKET TAG:Guest Count}
{ENTITIES}
<L00>Ticket No:{TICKET NO}
</div>
<F>-
<div style="font-size:12px; font-family:'Phetsarath_OT'">
{ORDERS}
</div>
<F>=
<EB>
{DISCOUNTS}
{TAXES}
[<J10>Total Gift:|{ORDER STATE TOTAL:Gift}]
{SERVICES}
<J10>Sub Total:|[=F(TN('{TICKET TOTAL}')-TN('{TAX TOTAL}'))]
<J10>Tax:|{TAX TOTAL}
<J10>Total:|{TICKET TOTAL}
<J00>Total in USD:                     [=F(TN('{TICKET TOTAL}')/TN('{EXCHANGE RATE:USD}'),'#,##0.## $')]
<J00>Total in THB:                     [=F(TN('{TICKET TOTAL}')/TN('{EXCHANGE RATE:BATH}'),'#,##0.## THB')]

{PAYMENTS}
<F> 

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

[SERVICES]
<J00>{CALCULATION NAME}|{CALCULATION TOTAL}

[PAYMENTS]
<J00>{PAYMENT NAME}|{PAYMENT AMOUNT}
[ORDERS]
-- Default format for orders
<J00>- {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 : {TAX NAME}
<F>-

I count number of character it might cause for spacing adjustment but i think it is not problem

Please help to do Lao language display properly on bill.
Best regards,