这不起作用:
body.insertParagraph(2,"Hello");
title_style = {};
title_style[DocumentApp.Attribute.FONT_FAMILY] = 'Roboto Condensed Light';
body.getChild(2).setAttributes(title_style);
而normal
版本的字体确实如此:
body.insertParagraph(2,"Hello");
title_style = {};
title_style[DocumentApp.Attribute.FONT_FAMILY] = 'Roboto Condensed';
body.getChild(2).setAttributes(title_style);
如果存在,我如何定义Light
font-family
版本的使用?
答案 0 :(得分:1)
在阅读并播放了更多内容后,我的猜测是Google正在区分字体的系列(Roboto Condensed)和字体的重量(Light,Normal) , 胆大)。目前,没有办法通过文档中的GAS设置字体的重量。
答案 1 :(得分:0)
只需要自己弄清楚这一点,因为其他任何地方都没有答案。您必须在样式属性对象的字体系列声明中添加“; 300”。因此,例如:
let subtitleStyle = {};
subtitleStyle [DocumentApp.Attribute.FONT_FAMILY] = data.styleFontFamily +“; 300”;