hand-dot/labelmake

About using Korean.

eg2data opened this issue · 9 comments

Hi, I am so glad to say thank you for your efforts.
This is amazingly comfortable when I produce PDF file with prepared-PDF template.

However, I have had a trouble with input data in Korean.
I mean, whenever I have tried to set data written by Korean to the field, the error occured,
"(node:69032) UnhandledPromiseRejectionWarning: Error: WinAnsi cannot encode "왜" (0xc65c)"

I really want to discuss this issue with you.
I will share the code I have tried through github.

Hi @eg2data

I have checked the code and it seems to be fine.

I also had a problem with Japanese fonts before.

At that time it was a problem with the font file itself.
Could you please try with other fonts as well?

and you should this issue.

#17

you can use subset: false option.
like this.

const pdf = await labelmake({
  inputs,
  template,
  font: {
    SauceHanSansJP: {
      data: fs.readFileSync(__dirname + `/fonts/SauceHanSansJP.ttf`),
      subset: false,
    },
    SauceHanSerifJP: {
      data: fs.readFileSync(__dirname + `/fonts/SauceHanSerifJP.ttf`),
      subset: false,
    },
  },
});

this option is not written in documents yet.

sorry....

please try.

@eg2data have you fixed your issue? I tried the fix, but the issue still remains.

Thank you for your favour.

Actually, I have tried more than 3 types of font file (.ttf) and all denied.

And.. It seems that I can't understand your comments on "subset" option.
Could you explain where I apply to that option on my code?

스크린샷 2021-12-16 15 35 13

Hi, drizzt00s.
Thank you for your consideration.

Actually, I cannot find the exact part to apply hand-dot's comment on my code, so that I do not check yet..!

@eg2data sorry my ambiguous explain.
Could you try below code?

const MaruBuri = fs.readFileSync("./MaruBuri-Regular.ttf")
const font = { 
    MaruBuri: {
        data: MaruBuri,
        subset: false
    } 
};

at: https://github.com/eg2data/chart_pdf_labelmake_2/blob/02c83a89d5f1d4701efd8ca14de549285f0a12b5/generatePdf.js#L14

Hey, hand-dot..!

I am really happy to say that your code works! perfectly works!
Thank you for your help.
I was really surprised with your immediate response and efforts.

Thanks again!

@eg2data
Yea! I'm happy too to hear that!