style = 2;
}
- setFont(new Font(fontName, style, Integer.parseInt(fontSize)));
+ setFont(new Font(fontName, style, Integer.parseInt(fontSize)), true);
alignment
.setGapCharacter(Cache.getDefault("GAP_SYMBOL", "-").charAt(0));
/**
* update view settings with the given font. You may need to call
* alignPanel.fontChanged to update the layout geometry
+ *
+ * @param setGrid
+ * when true, charWidth/height is set according to font mentrics
*/
- public void setFont(Font f)
+ public void setFont(Font f, boolean setGrid)
{
font = f;
java.awt.FontMetrics fm = c.getFontMetrics(font);
int w = viewStyle.getCharWidth(), ww = fm.charWidth('M'), h = viewStyle
.getCharHeight();
- setCharHeight(fm.getHeight());
- setCharWidth(ww);
+ if (setGrid)
+ {
+ setCharHeight(fm.getHeight());
+ setCharWidth(ww);
+ }
viewStyle.setFontName(font.getName());
viewStyle.setFontStyle(font.getStyle());
viewStyle.setFontSize(font.getSize());
{
super.setViewStyle(settingsForView);
setFont(new Font(viewStyle.getFontName(), viewStyle.getFontStyle(),
- viewStyle.getFontSize()));
+ viewStyle.getFontSize()), false);
}
/**
*/
package jalview.gui;
-import java.awt.*;
-import java.awt.event.*;
-import javax.swing.*;
-
-import jalview.bin.*;
-import jalview.jbgui.*;
+import jalview.bin.Cache;
+import jalview.jbgui.GFontChooser;
import jalview.util.MessageManager;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.event.ActionEvent;
+
+import javax.swing.JInternalFrame;
+import javax.swing.JLayeredPane;
+import javax.swing.JOptionPane;
+
/**
* DOCUMENT ME!
*
{
if (ap != null)
{
- ap.av.setFont(oldFont);
+ ap.av.setFont(oldFont, true);
ap.paintAlignment(true);
}
else if (tp != null)
}
else if (ap != null)
{
- ap.av.setFont(newFont);
+ ap.av.setFont(newFont, true);
ap.fontChanged();
}
af.viewport.setConservationSelected(view.getConservationSelected());
af.viewport.setShowJVSuffix(view.getShowFullId());
af.viewport.setRightAlignIds(view.getRightAlignIds());
- af.viewport.setFont(new java.awt.Font(view.getFontName(), view
- .getFontStyle(), view.getFontSize()));
+ af.viewport.setFont(
+ new java.awt.Font(view.getFontName(), view.getFontStyle(), view
+ .getFontSize()), true);
// TODO: allow custom charWidth/Heights to be restored by updating them
- // after setting font
+ // after setting font - which means set above to false
af.viewport.setRenderGaps(view.getRenderGaps());
af.viewport.setWrapAlignment(view.getWrapAlignment());
af.viewport.setShowAnnotation(view.getShowAnnotation());
af.viewport.setColourText(view.getShowColourText());
af.viewport.setConservationSelected(view.getConservationSelected());
af.viewport.setShowJVSuffix(view.getShowFullId());
- af.viewport.setFont(new java.awt.Font(view.getFontName(), view
- .getFontStyle(), view.getFontSize()));
+ af.viewport.setFont(
+ new java.awt.Font(view.getFontName(), view.getFontStyle(), view
+ .getFontSize()), true);
af.viewport.setRenderGaps(view.getRenderGaps());
af.viewport.setWrapAlignment(view.getWrapAlignment());
fontSize = 1;
}
- av.setFont(new Font(av.font.getName(), av.font.getStyle(), fontSize));
+ av.setFont(
+ new Font(av.font.getName(), av.font.getStyle(), fontSize),
+ true);
av.setCharWidth(oldWidth);
ap.fontChanged();
}