Take the 2-minute tour ×
Web Applications Stack Exchange is a question and answer site for power users of web applications. It's 100% free, no registration required.

How can I use other font weights (such as Book 300 for Open Sans) in my documents?

Adding Open Sans only allows me to use Normal 400, for example.

share|improve this question
add comment

2 Answers 2

It appears that Google docs has very limited functionality for google web fonts right now. For each font you use, you only have the option of the bold weight or normal weight that was set for the web font you selected.

share|improve this answer
add comment

Now that Google Apps Script is implemented in Google Documents, it is possible to create font weights:

Code

// global
var app = DocumentApp.getUi();

function onOpen() {
   app.createMenu('Font').addItem('Set font size', 'fontSize')
     .addToUi();
 }

function fontSize() {
  // selected text
  var selection = DocumentApp.getActiveDocument().getSelection();  

  // create input box
  var fontSize = app.prompt('Add Font Size','Input Integer (> 0)'
    ,app.ButtonSet.OK).getResponseText();

  // check if value exists
  if(!fontSize || fontSize == 0) { 
    app.alert("Error","No input present", app.ButtonSet.OK);
    return;
  }

  // https://developers.google.com/apps-script/reference/document/selection
  var elements = selection.getSelectedElements();
  for (var i=0, iLen=elements.length; i<iLen; i++) {
    var element = elements[i];

    // Only modify elements that can be edited as text; 
    // skip images and other non-text elements.
    if (element.getElement().editAsText) {
      var text = element.getElement().editAsText();

      // Bold the selected part of the element, 
      // or the full element if it's completely selected.
      if (element.isPartial()) {
        text.setFontSize(element.getStartOffset(), 
          element.getEndOffsetInclusive(), parseInt(fontSize));
      } else {
        text.setFontSize(parseInt(fontSize));
      }
    }
  }  
}

Screenshot

enter image description here

Example

I've created an example file for you to play around with: Font Size

Reference

See the following answer for instructions on how to implement the script (works the same as in a Google Spreadsheet): Font Size in Google Spreadsheets

share|improve this answer
1  
I believe he is asking for font weight, not font size. –  bafromca Sep 5 '13 at 17:27
    
@bafromca I think you're right. –  Jacob Jan Tuinstra Sep 5 '13 at 20:28
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.