     clientWidth -= paddingLeft
     editor.setWidth(clientWidth) if clientWidth > 0
 
+  sampleFontStyling: ->
+    oldFontSize = @fontSize
+    oldFontFamily = @fontFamily
+    oldLineHeight = @lineHeight
+
+    {@fontSize, @fontFamily, @lineHeight} = getComputedStyle(@getTopmostDOMNode())
+
+    if @fontSize isnt oldFontSize or @fontFamily isnt oldFontFamily or @lineHeight isnt oldLineHeight
+      @measureLineHeightAndDefaultCharWidth()
+
+    if (@fontSize isnt oldFontSize or @fontFamily isnt oldFontFamily) and @performedInitialMeasurement
+      @remeasureCharacterWidths()
+
   sampleBackgroundColors: (suppressUpdate) ->
     {parentView} = @props
     {showLineNumbers} = @state

        @gutterBackgroundColor = gutterBackgroundColor
        @requestUpdate() unless suppressUpdate

  measureLineHeightAndDefaultCharWidthIfNeeded: (prevState) ->
    if not isEqualForProperties(prevState, @state, 'lineHeight', 'fontSize', 'fontFamily')
      if @visible
        @measureLineHeightAndDefaultCharWidth()
      else
        @measureLineHeightAndDefaultCharWidthWhenShown = true
    else if @measureLineHeightAndDefaultCharWidthWhenShown and @visible
      @measureLineHeightAndDefaultCharWidthWhenShown = false
      @measureLineHeightAndDefaultCharWidth()

  measureLineHeightAndDefaultCharWidth: ->
    @refs.lines.measureLineHeightAndDefaultCharWidth()

  remeasureCharacterWidthsIfNeeded: (prevState) ->
    if not isEqualForProperties(prevState, @state, 'fontSize', 'fontFamily')
      if @visible
        @remeasureCharacterWidths()
      else
        @remeasureCharacterWidthsIfVisibleAfterNextUpdate = true
    else if @remeasureCharacterWidthsIfVisibleAfterNextUpdate and @visible
      @remeasureCharacterWidthsIfVisibleAfterNextUpdate = false
      @remeasureCharacterWidths()

  remeasureCharacterWidths: ->
    @refs.lines.remeasureCharacterWidths()

  measureScrollbars: ->
    return unless @visible


  onStylesheetsChanged: (stylesheet) ->
    @refreshScrollbars() if @containsScrollbarSelector(stylesheet)
    @sampleFontStyling()
    @sampleBackgroundColors()
    @remeasureCharacterWidths()

  onScreenLinesChanged: (change) ->
    {editor} = @props
