Finished adding customization of fonts.
diff --git a/com.google.eclipse.terminal.local/src/com/google/eclipse/terminal/local/ui/preferences/AbstractColorsAndFontsPreferencesChangeListener.java b/com.google.eclipse.terminal.local/src/com/google/eclipse/terminal/local/ui/preferences/AbstractColorsAndFontsPreferencesChangeListener.java
index 3fa7b48..185ad1b 100644
--- a/com.google.eclipse.terminal.local/src/com/google/eclipse/terminal/local/ui/preferences/AbstractColorsAndFontsPreferencesChangeListener.java
+++ b/com.google.eclipse.terminal.local/src/com/google/eclipse/terminal/local/ui/preferences/AbstractColorsAndFontsPreferencesChangeListener.java
@@ -21,7 +21,12 @@
     if (BACKGROUND_COLOR.equals(property) || FOREGROUND_COLOR.equals(property)) {
       onColorChanged();
     }
+    if (CUSTOM_FONT_DATA.equals(property)) {
+      onFontChanged();
+    }
   }
 
   protected abstract void onColorChanged();
+
+  protected abstract void onFontChanged();
 }
diff --git a/com.google.eclipse.terminal.local/src/com/google/eclipse/terminal/local/ui/preferences/ColorsAndFontsPreferencePage.java b/com.google.eclipse.terminal.local/src/com/google/eclipse/terminal/local/ui/preferences/ColorsAndFontsPreferencePage.java
index 9643fbe..8645ccb 100644
--- a/com.google.eclipse.terminal.local/src/com/google/eclipse/terminal/local/ui/preferences/ColorsAndFontsPreferencePage.java
+++ b/com.google.eclipse.terminal.local/src/com/google/eclipse/terminal/local/ui/preferences/ColorsAndFontsPreferencePage.java
@@ -11,19 +11,25 @@
 import static com.google.eclipse.terminal.local.Activator.*;
 import static com.google.eclipse.terminal.local.ui.preferences.Messages.*;
 import static com.google.eclipse.terminal.local.ui.preferences.PreferenceNames.*;
+import static org.eclipse.jface.layout.GridDataFactory.fillDefaults;
 import static org.eclipse.jface.preference.ColorSelector.PROP_COLORCHANGE;
+import static org.eclipse.jface.preference.PreferenceConverter.*;
+import static org.eclipse.jface.resource.JFaceResources.TEXT_FONT;
 
 import java.io.InputStream;
 import java.util.Scanner;
 
+import org.eclipse.jface.layout.GridDataFactory;
 import org.eclipse.jface.preference.*;
+import org.eclipse.jface.resource.*;
 import org.eclipse.jface.text.Document;
 import org.eclipse.jface.text.source.projection.ProjectionViewer;
 import org.eclipse.jface.util.*;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.*;
 import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
+import org.eclipse.swt.layout.GridLayout;
 import org.eclipse.swt.widgets.*;
 import org.eclipse.ui.*;
 
@@ -34,6 +40,14 @@
   private ProjectionViewer previewer;
   private ColorSelector foregroundColorSelector;
   private ColorSelector backgroundColorSelector;
+  private Button btnUseTextFont;
+  private Button btnUseCustomFont;
+  private Label lblFontData;
+  private Button btnChangeFont;
+
+  private FontData fontData;
+
+  private IPropertyChangeListener textFontChangeListener;
 
   @Override public void init(IWorkbench workbench) {
     setPreferenceStore(preferenceStore());
@@ -42,27 +56,84 @@
   @Override protected Control createContents(Composite parent) {
     Composite contents = new Composite(parent, SWT.NONE);
     contents.setLayout(new GridLayout(1, false));
+
     Label lblDescription = new Label(contents, SWT.NONE);
     lblDescription.setText(colorsAndFontsTitle);
-    new Label(contents, SWT.NONE);
+
+    GridDataFactory gridDataFactory = fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(1, 1);
+
     Composite controls = new Composite(contents, SWT.NONE);
-    controls.setLayout(new GridLayout(2, false));
-    Label lblBackground = new Label(controls, SWT.NONE);
+    gridDataFactory.applyTo(controls);
+    controls.setLayout(new GridLayout(1, false));
+
+    Group grpColors = new Group(controls, SWT.NONE);
+    gridDataFactory.applyTo(grpColors);
+    grpColors.setLayout(new GridLayout(2, false));
+
+    Label lblBackground = new Label(grpColors, SWT.NONE);
     lblBackground.setText(backgroundPrompt);
-    backgroundColorSelector = new ColorSelector(controls);
-    Label lblForeground = new Label(controls, SWT.NONE);
+
+    backgroundColorSelector = new ColorSelector(grpColors);
+
+    Label lblForeground = new Label(grpColors, SWT.NONE);
     lblForeground.setText(foregroundPrompt);
-    foregroundColorSelector = new ColorSelector(controls);
-    new Label(contents, SWT.NONE);
+
+    foregroundColorSelector = new ColorSelector(grpColors);
+
+    Group grpFont = new Group(controls, SWT.NONE);
+    gridDataFactory.applyTo(grpFont);
+    grpFont.setLayout(new GridLayout(2, false));
+
+    SelectionListener fontButtonSelectionListener = new SelectionAdapter() {
+      @Override public void widgetSelected(SelectionEvent e) {
+        boolean useTextFont = btnUseTextFont.getSelection();
+        btnChangeFont.setEnabled(!useTextFont);
+        if (useTextFont) {
+          updateFontDataWithTextFont();
+        }
+      }
+    };
+
+    btnUseTextFont = new Button(grpFont, SWT.RADIO);
+    gridDataFactory.span(2, 1).applyTo(btnUseTextFont);
+    btnUseTextFont.setText("Use Eclipse's \"Text Font\"");
+    btnUseTextFont.addSelectionListener(fontButtonSelectionListener);
+
+    btnUseCustomFont = new Button(grpFont, SWT.RADIO);
+    gridDataFactory.applyTo(btnUseCustomFont);
+    btnUseCustomFont.setText("Use custom font");
+    btnUseCustomFont.addSelectionListener(fontButtonSelectionListener);
+
+    lblFontData = new Label(grpFont, SWT.NONE);
+    gridDataFactory.span(1, 1).applyTo(lblFontData);
+    lblFontData.setText("");
+
+    btnChangeFont = new Button(grpFont, SWT.NONE);
+    btnChangeFont.setText("Change...");
+    btnChangeFont.addSelectionListener(new SelectionAdapter() {
+      @Override public void widgetSelected(SelectionEvent e) {
+        FontDialog fontDialog = new FontDialog(getShell());
+        fontDialog.setFontList(new FontData[] { fontData });
+        FontData newFontData = fontDialog.open();
+        if (newFontData != null) {
+          updateFontData(newFontData);
+        }
+      }
+    });
+
     Label lblPreview = new Label(contents, SWT.NONE);
     lblPreview.setText(previewPrompt);
+
     previewer = new ProjectionViewer(contents, null, null, false, SWT.V_SCROLL | SWT.H_SCROLL);
     previewer.setEditable(false);
     previewer.setDocument(new Document(loadContentsFrom("ColorSettingPreviewText.txt"))); //$NON-NLS-1$
+
     StyledText previewerText = previewer.getTextWidget();
-    previewerText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
+    gridDataFactory.align(SWT.FILL, SWT.FILL).grab(true, true);
+    gridDataFactory.applyTo(previewerText);
     Cursor arrowCursor = previewerText.getDisplay().getSystemCursor(SWT.CURSOR_ARROW);
     previewerText.setCursor(arrowCursor);
+
     backgroundColorSelector.addListener(new ColorChangeListener() {
       @Override void onColorChanged(RGB newValue) {
         validateInput();
@@ -71,6 +142,7 @@
         }
       }
     });
+
     foregroundColorSelector.addListener(new ColorChangeListener() {
       @Override void onColorChanged(RGB newValue) {
         validateInput();
@@ -79,12 +151,22 @@
         }
       }
     });
+
+    textFontChangeListener = new IPropertyChangeListener() {
+      @Override public void propertyChange(PropertyChangeEvent event) {
+        if (TEXT_FONT.equals(event.getProperty()) && btnUseTextFont.getSelection()) {
+          updateFontDataWithTextFont();
+        }
+      }
+    };
+    JFaceResources.getFontRegistry().addListener(textFontChangeListener);
+
     updateContents();
     return contents;
   }
 
   private String loadContentsFrom(String fileName) {
-    String lineSeparator = System.getProperty("line.separator"); //$NON-NLS-1$
+    String lineSeparator = System.getProperty("line.separator");
     StringBuilder buffer = new StringBuilder();
     Scanner scanner = null;
     try {
@@ -118,45 +200,68 @@
     setValid(true);
   }
 
+  private void updateFontDataWithTextFont() {
+    updateFontData(JFaceResources.getTextFont().getFontData()[0]);
+  }
+
+  private void updateFontData(FontData newValue) {
+    fontData = newValue;
+    displayFont();
+  }
+
   private void updateContents() {
-    displayValue(BACKGROUND_COLOR, backgroundColorSelector);
-    displayValue(FOREGROUND_COLOR, foregroundColorSelector);
-    updatePreview();
-  }
-
-  private void displayValue(String preferenceName, ColorSelector colorSelector) {
-    RGB color = PreferenceConverter.getColor(getPreferenceStore(), preferenceName);
-    colorSelector.setColorValue(color);
-  }
-
-  private Color newColor(RGB rgb) {
-    return new Color(getShell().getDisplay(), rgb);
+    RGB background = getColor(getPreferenceStore(), BACKGROUND_COLOR);
+    RGB foreground = getColor(getPreferenceStore(), FOREGROUND_COLOR);
+    fontData = getFontData(getPreferenceStore(), CUSTOM_FONT_DATA);
+    boolean useCustomFont = getPreferenceStore().getBoolean(USE_CUSTOM_FONT);
+    updateContents(background, foreground, useCustomFont);
   }
 
   @Override public boolean performOk() {
-    storeValue(BACKGROUND_COLOR, backgroundColorSelector);
-    storeValue(FOREGROUND_COLOR, foregroundColorSelector);
+    setValue(getPreferenceStore(), BACKGROUND_COLOR, backgroundColorSelector.getColorValue());
+    setValue(getPreferenceStore(), FOREGROUND_COLOR, foregroundColorSelector.getColorValue());
+    preferenceStore().setValue(USE_CUSTOM_FONT, btnUseCustomFont.getSelection());
+    setValue(getPreferenceStore(), CUSTOM_FONT_DATA, fontData);
     return true;
   }
 
-  private void storeValue(String preferenceName, ColorSelector colorSelector) {
-    PreferenceConverter.setValue(getPreferenceStore(), preferenceName, colorSelector.getColorValue());
-  }
-
   @Override protected void performDefaults() {
-    displayDefaultValue(BACKGROUND_COLOR, backgroundColorSelector);
-    displayDefaultValue(FOREGROUND_COLOR, foregroundColorSelector);
-    updatePreview();
+    RGB background = getDefaultColor(getPreferenceStore(), BACKGROUND_COLOR);
+    RGB foreground = getDefaultColor(getPreferenceStore(), FOREGROUND_COLOR);
+    fontData = getDefaultFontData(getPreferenceStore(), CUSTOM_FONT_DATA);
+    boolean useCustomFont = getPreferenceStore().getDefaultBoolean(USE_CUSTOM_FONT);
+    updateContents(background, foreground, useCustomFont);
   }
 
-  private void displayDefaultValue(String preferenceName, ColorSelector colorSelector) {
-    RGB rgb = PreferenceConverter.getDefaultColor(getPreferenceStore(), preferenceName);
-    colorSelector.setColorValue(rgb);
+  private void updateContents(RGB background, RGB foreground, boolean useCustomFont) {
+    backgroundColorSelector.setColorValue(background);
+    foregroundColorSelector.setColorValue(foreground);
+    btnUseTextFont.setSelection(!useCustomFont);
+    btnUseCustomFont.setSelection(useCustomFont);
+    btnChangeFont.setEnabled(useCustomFont);
+    previewer.getTextWidget().setBackground(newColor(background));
+    previewer.setTextColor(newColor(foreground));
+    displayFont();
   }
 
-  private void updatePreview() {
-    previewer.getTextWidget().setBackground(newColor(backgroundColorSelector.getColorValue()));
-    previewer.setTextColor(newColor(foregroundColorSelector.getColorValue()));
+  private void displayFont() {
+    lblFontData.setText(StringConverter.asString(fontData));
+    previewer.getTextWidget().setFont(new Font(display(), fontData));
+  }
+
+  private Color newColor(RGB rgb) {
+    return new Color(display(), rgb);
+  }
+
+  private Display display() {
+    return getShell().getDisplay();
+  }
+
+  @Override public void dispose() {
+    if (textFontChangeListener != null) {
+      JFaceResources.getFontRegistry().removeListener(textFontChangeListener);
+    }
+    super.dispose();
   }
 
   private static abstract class ColorChangeListener implements IPropertyChangeListener {
diff --git a/com.google.eclipse.terminal.local/src/com/google/eclipse/terminal/local/ui/preferences/ColorsAndFontsPreferences.java b/com.google.eclipse.terminal.local/src/com/google/eclipse/terminal/local/ui/preferences/ColorsAndFontsPreferences.java
index 3fea8b7..866fe1e 100644
--- a/com.google.eclipse.terminal.local/src/com/google/eclipse/terminal/local/ui/preferences/ColorsAndFontsPreferences.java
+++ b/com.google.eclipse.terminal.local/src/com/google/eclipse/terminal/local/ui/preferences/ColorsAndFontsPreferences.java
@@ -10,9 +10,9 @@
 
 import static com.google.eclipse.terminal.local.Activator.preferenceStore;
 import static com.google.eclipse.terminal.local.ui.preferences.PreferenceNames.*;
+import static org.eclipse.jface.preference.PreferenceConverter.*;
 
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.*;
 
 /**
  * @author alruiz@google.com (Alex Ruiz)
@@ -20,10 +20,18 @@
 public class ColorsAndFontsPreferences {
 
   public static RGB background() {
-    return PreferenceConverter.getColor(preferenceStore(), BACKGROUND_COLOR);
+    return getColor(preferenceStore(), BACKGROUND_COLOR);
   }
 
   public static RGB foreground() {
-    return PreferenceConverter.getColor(preferenceStore(), FOREGROUND_COLOR);
+    return getColor(preferenceStore(), FOREGROUND_COLOR);
+  }
+
+  public static boolean useCustomFont() {
+    return preferenceStore().getBoolean(USE_CUSTOM_FONT);
+  }
+
+  public static FontData customFontData() {
+    return getFontData(preferenceStore(), CUSTOM_FONT_DATA);
   }
 }
diff --git a/com.google.eclipse.terminal.local/src/com/google/eclipse/terminal/local/ui/preferences/PreferenceInitializer.java b/com.google.eclipse.terminal.local/src/com/google/eclipse/terminal/local/ui/preferences/PreferenceInitializer.java
index 4ec4517..e38fa42 100644
--- a/com.google.eclipse.terminal.local/src/com/google/eclipse/terminal/local/ui/preferences/PreferenceInitializer.java
+++ b/com.google.eclipse.terminal.local/src/com/google/eclipse/terminal/local/ui/preferences/PreferenceInitializer.java
@@ -13,6 +13,7 @@
 
 import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
 import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.jface.resource.JFaceResources;
 import org.eclipse.swt.graphics.RGB;
 
 /**
@@ -23,6 +24,8 @@
     preferenceStore().setDefault(CLOSE_VIEW_ON_EXIT, true);
     setDefault(BACKGROUND_COLOR, new RGB(0, 0, 0));
     setDefault(FOREGROUND_COLOR, new RGB(229, 229, 229));
+    preferenceStore().setDefault(USE_CUSTOM_FONT, false);
+    PreferenceConverter.setDefault(preferenceStore(), CUSTOM_FONT_DATA, JFaceResources.getTextFont().getFontData());
   }
 
   private void setDefault(String name, RGB value) {
diff --git a/com.google.eclipse.terminal.local/src/com/google/eclipse/terminal/local/ui/preferences/PreferenceNames.java b/com.google.eclipse.terminal.local/src/com/google/eclipse/terminal/local/ui/preferences/PreferenceNames.java
index 2d6ec61..f554363 100644
--- a/com.google.eclipse.terminal.local/src/com/google/eclipse/terminal/local/ui/preferences/PreferenceNames.java
+++ b/com.google.eclipse.terminal.local/src/com/google/eclipse/terminal/local/ui/preferences/PreferenceNames.java
@@ -15,6 +15,8 @@
   static final String CLOSE_VIEW_ON_EXIT = "exitViewOnExit";
   static final String BACKGROUND_COLOR = "backgroundColor";
   static final String FOREGROUND_COLOR = "foregroundColor";
+  static final String USE_CUSTOM_FONT = "useCustomFont";
+  static final String CUSTOM_FONT_DATA = "customFontData";
 
   private PreferenceNames() {}
 }
diff --git a/com.google.eclipse.terminal.local/src/com/google/eclipse/terminal/local/ui/view/TerminalView.java b/com.google.eclipse.terminal.local/src/com/google/eclipse/terminal/local/ui/view/TerminalView.java
index ad8d241..6c6a2fc 100644
--- a/com.google.eclipse.terminal.local/src/com/google/eclipse/terminal/local/ui/view/TerminalView.java
+++ b/com.google.eclipse.terminal.local/src/com/google/eclipse/terminal/local/ui/view/TerminalView.java
@@ -22,7 +22,8 @@
 import org.eclipse.jface.resource.JFaceResources;
 import org.eclipse.jface.util.*;
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.widgets.*;
 import org.eclipse.tm.internal.terminal.control.ITerminalListener;
 import org.eclipse.tm.internal.terminal.provisional.api.TerminalState;
 import org.eclipse.ui.*;
@@ -106,13 +107,19 @@
       @Override protected void onColorChanged() {
         updateColors();
       }
+
+      @Override protected void onFontChanged() {
+        updateFont();
+      }
     };
     preferenceStore().addPropertyChangeListener(colorPreferencesChangeListener);
     updateColors();
     textFontChangeListener = new IPropertyChangeListener() {
       @Override public void propertyChange(PropertyChangeEvent event) {
         if (TEXT_FONT.equals(event.getProperty())) {
-          updateFont();
+          if (!useCustomFont()) {
+            setFont(JFaceResources.getTextFont());
+          }
         }
       }
     };
@@ -133,7 +140,18 @@
   }
 
   private void updateFont() {
-    terminalWidget.setFont(JFaceResources.getTextFont());
+    setFont(terminalFont());
+  }
+
+  private Font terminalFont() {
+    if (useCustomFont()) {
+      return new Font(Display.getDefault(), customFontData());
+    }
+    return JFaceResources.getTextFont();
+  }
+
+  private void setFont(Font font) {
+    terminalWidget.setFont(font);
   }
 
   private void connectUsingSavedState() {
diff --git a/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/ILinelRenderer.java b/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/ILinelRenderer.java
index c586f32..312fcc0 100644
--- a/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/ILinelRenderer.java
+++ b/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/ILinelRenderer.java
@@ -24,4 +24,5 @@
 	void setInvertedColors(boolean invert);
 	Color getDefaultBackgroundColor();
   void setColors(RGB background, RGB foreground);
+  void setFont(Font font);
 }
diff --git a/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/StyleMap.java b/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/StyleMap.java
index d89bb0a..2d8c41b 100644
--- a/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/StyleMap.java
+++ b/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/StyleMap.java
@@ -17,11 +17,7 @@
 
 import org.eclipse.jface.resource.JFaceResources;
 import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.*;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.tm.terminal.model.Style;
 import org.eclipse.tm.terminal.model.StyleColor;
@@ -56,6 +52,7 @@
 	private final int[] fOffsets=new int[256];
   private RGB background = new RGB(0, 0, 0);
   private RGB foreground = new RGB(229, 229, 229);
+  private Font font = JFaceResources.getFontRegistry().get(fFontName);
 	StyleMap() {
 		initColors();
 		fDefaultStyle=Style.getStyle(StyleColor.getStyleColor(BLACK),StyleColor.getStyleColor(WHITE));
@@ -180,17 +177,18 @@
 
 	public Font getFont(Style style) {
 		style = defaultIfNull(style);
+    FontData fontDatas[] = font.getFontData();
+    FontData data = fontDatas[0];
 		if(style.isBold()) {
-			return  JFaceResources.getFontRegistry().getBold(fFontName);
+      return new Font(font.getDevice(), data.getName(), data.getHeight(), data.getStyle() | SWT.BOLD);
 		} else if(style.isUnderline()) {
-			return  JFaceResources.getFontRegistry().getItalic(fFontName);
-
+      return new Font(font.getDevice(), data.getName(), data.getHeight(), data.getStyle() | SWT.ITALIC);
 		}
-		return  JFaceResources.getFontRegistry().get(fFontName);
+		return font;
 	}
 
 	public Font getFont() {
-		return  JFaceResources.getFontRegistry().get(fFontName);
+		return font;
 
 	}
 	public int getFontWidth() {
@@ -281,4 +279,8 @@
     this.foreground = foreground;
     initColors();
   }
+
+	public void setFont(Font font) {
+    this.font = font;
+  }
 }
diff --git a/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/TextCanvas.java b/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/TextCanvas.java
index 2074ebd..b0c67e5 100644
--- a/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/TextCanvas.java
+++ b/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/TextCanvas.java
@@ -403,5 +403,10 @@
   public void setColors(RGB background, RGB foreground) {
     fCellRenderer.setColors(background, foreground);
   }
+  
+  @Override public void setFont(Font font) {
+    super.setFont(font);
+    fCellRenderer.setFont(font);
+  }
 }
 
diff --git a/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/TextLineRenderer.java b/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/TextLineRenderer.java
index 436413c..d83bbe0 100644
--- a/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/TextLineRenderer.java
+++ b/com.google.eclipse.tm.terminal/src/org/eclipse/tm/internal/terminal/textcanvas/TextLineRenderer.java
@@ -162,4 +162,8 @@
 	@Override public void setColors(RGB background, RGB foreground) {
 	  fStyleMap.setColors(background, foreground);
   }
+
+	@Override public void setFont(Font font) {
+	  fStyleMap.setFont(font);
+  }
 }