0

I am trying to write on image with multiple language. I am using npm package 'gm' .

gm(inputFilePath)
.font(fontFilePath) // .ttf format
.writeText(x,y,TextToBeWritten)
.write(outputFile , callBackFunction())

Here I want to write in Multiple languages. And there is no single font which includes all of them. How can I pass multiple fonts to writeText function ?

Let's say I want to write in Chinese , English , Russian , Japanese and Hindi . How can Pass something like

.font(font1.ttf , font2.ttf , font3.ttf)
.writeText(x , y , TextToBeWritten)

If I can't do this, then I will no other choice, but to merge multiple fonts. and generate single .ttf file.

I would like to do it if it's possible. If it's not possible with current version of 'gm', then I would like to contribute to 'gm'. If anyone can guide me, I might be able to pull it off.

drexdelta
  • 87
  • 3
  • 9
  • I don't use this calling interface, but I guess you can do `.font("Helvetica")` then `.writeText()` in Helvetica, then `.font("Arial")` and then `.writeText()` in Arial. – Mark Setchell May 23 '18 at 11:57
  • ... the reason is that the font is a *setting* and it remains set and active for subsequent actions until changed. So, if you set it and then write text a couple of times it will apply to both and in fact all subsequent writes until you explicitly change it. – Mark Setchell May 23 '18 at 12:01
  • @MarkSetchell , I got your point, but problem is that I don't have any information about that 'writeText' is in which language. Otherwise I could handle it easily :) . I guess, I need to merge all font files. – drexdelta May 23 '18 at 12:11

0 Answers0