问题描述
我正在使用gm在图像上添加文本。现在,我想使其变粗,但我没有选择更改字体粗细的选项。任何帮助表示赞赏。
As of Android 5.0 (API 21) you can also assign the android:theme for a view
解决方法
您可以使用如下所示的gm.in()自定义参数
const gm = require('gm').subClass({imageMagick: true});
const imageUrl = 'image_url'
const text = 'Some_text';
const image = gm(`${imageUrl}`)
.resize(518,500)
.fill('#f2f2f2')
.font('Arial',14)
.in('-weight','Bold')
.drawText(115,470,`${text}`);
image.write(`result.png`,err => {
if(err) return console.error(err);
console.log('done');
});