@@ -323,6 +323,23 @@ define(function (require, exports, module) {
323323 _scrollLine ( 1 ) ;
324324 }
325325
326+ /**
327+ * @private
328+ * Convert the old "fontSizeAdjustment" preference to the new view states.
329+ *
330+ * @param {string } key The key of the preference to be examined for migration
331+ * of old preferences. Not used since we only have one in this module.
332+ * @param {string } value The value of "fontSizeAdjustment" preference
333+ * @return {Object } - JSON object for the new view states equivalent to
334+ * the old "fontSizeAdjustment" preference.
335+ */
336+ function _convertToNewViewStates ( key , value ) {
337+ var fontSize = 12 + value ,
338+ newRule = { "fontSizeStyle" : fontSize + "px" ,
339+ "lineHeightStyle" : Math . ceil ( fontSize * LINE_HEIGHT ) + "px" } ;
340+
341+ return newRule ;
342+ }
326343
327344 // Register command handlers
328345 CommandManager . register ( Strings . CMD_INCREASE_FONT_SIZE , Commands . VIEW_INCREASE_FONT_SIZE , _handleIncreaseFontSize ) ;
@@ -331,9 +348,7 @@ define(function (require, exports, module) {
331348 CommandManager . register ( Strings . CMD_SCROLL_LINE_UP , Commands . VIEW_SCROLL_LINE_UP , _handleScrollLineUp ) ;
332349 CommandManager . register ( Strings . CMD_SCROLL_LINE_DOWN , Commands . VIEW_SCROLL_LINE_DOWN , _handleScrollLineDown ) ;
333350
334- // Initialize the default font size
335- PreferencesManager . stateManager . definePreference ( "fontSizeAdjustment" , "number" , 0 ) ;
336- PreferencesManager . convertPreferences ( module , { "fontSizeAdjustment" : "user" } , true ) ;
351+ PreferencesManager . convertPreferences ( module , { "fontSizeAdjustment" : "user" } , true , _convertToNewViewStates ) ;
337352
338353 // Update UI when opening or closing a document
339354 $ ( DocumentManager ) . on ( "currentDocumentChange" , _updateUI ) ;
0 commit comments