So I have gotten comfortable with the google docs API, but I am still having one problem. When I try to mix styles like bold and italic into a single paragraph, the styles are not displaying correctly.
Instead when I set to bold and italic, the span of text is reverting to Areal font type (which is different than what I have set) and then continuing for the rest of the paragraph: 
The strange thing is, if I add a simple line break before and after the request it will work just fine. I can have one paragraph regular text, followed by bold, followed by regular, followed by italic:
But when I don't add the line break, it doesn't work correctly. I think it may be an index issue (although I'm taking the suggested approach of building the document backward with request so indexing really shouldn't be the problem, I'm not dealing with it directly. )
It could also be that I'm including paragraph styles with each textstyle update request, maybe its conflicting with something?
Or maybe what I am trying to do is actually not yet supported? It is v.1 of the api after all.
The fn I'm using to make the requests:
function textRequest(text: string, fontSize: number, alignment = 'CENTER', lineSpacing = 100, color = 0.3, style = ' '){
const requests:Array<object> = [
{
insertText: {
text: text,
location: {
index: 1,
},
},
},
{
updateParagraphStyle: {
paragraphStyle: {
lineSpacing: lineSpacing,
namedStyleType: 'NORMAL_TEXT',
alignment: alignment,
direction: 'LEFT_TO_RIGHT'
},
fields: 'namedStyleType, alignment, direction, lineSpacing',
range: {
startIndex: 1,
endIndex: text.length + 1,
},
}
},
{
updateTextStyle: {
textStyle: {
bold: style === 'BOLD',
italic: style === 'ITALIC',
foregroundColor: {
color: {
rgbColor: {
red: color,
green: color,
blue: color
}
}
},
fontSize: {
magnitude: fontSize,
unit: 'PT'
},
weightedFontFamily: {
fontFamily: 'PT',
weight: 400
}
},
fields: 'bold, italic, foregroundColor, fontSize, weightedFontFamily',
range: {
startIndex: 1,
endIndex: text.length + 1,
},
},
}
];
return requests;
}
then I'm building the full request by pushing calls like this:
request.push(textRequest(text.trim(), 12, 'START', 200, 0.3, 'BOLD')
Anyway, all thoughts or suggestings are welcome. Thanks!

