Issue #2488 Change to use DejaVu fonts

Change-Id: I82f4b93f340bca0e6dfa4f9c14a9890644c9f224

Former-commit-id: 7a3c7d530e [formerly d72119409e] [formerly 633137d8c0 [formerly 396cd96c02521a33c65fa9e447275307c2d6168c]]
Former-commit-id: 633137d8c0
Former-commit-id: f6b9e69738
This commit is contained in:
Ron Anderson 2013-11-20 13:43:25 -06:00
parent 90601f6ff8
commit 769df41dea
10 changed files with 210 additions and 167 deletions

View file

@ -25,10 +25,11 @@
#------*-python-*-------------------------------------------------------------
# Config file for the GFE (Graphical Forecast Editor).
#
# $Id$
#-----------------------------------------------------------------------------
# Heading
#-----------------------------------------------------------------------------
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# 11/20/2013 2488 randerso Changed to use DejaVu fonts
GFESUITE_HOME = "/awips2/GFESuite"
GFESUITE_PRDDIR = "/tmp/products"
@ -262,11 +263,11 @@ MapBackgrounds_default = ['States','CWA']
# style is a font style (one of "regular", "bold", "italic", or "bold italic")
# height is an integer representing the font height.
# Example: Times New Roman-bold-36.
TextFont0 = "Bitstream Vera Sans Mono-regular-9"
TextFont1 = "Bitstream Vera Sans Mono-regular-9"
TextFont2 = "Bitstream Vera Sans Mono-bold-12"
TextFont3 = "Bitstream Vera Sans Mono-bold-14"
TextFont4 = "Bitstream Vera Sans Mono-bold-20"
TextFont0 = "DejaVu Sans Mono-regular-9"
TextFont1 = "DejaVu Sans Mono-regular-9"
TextFont2 = "DejaVu Sans Mono-bold-12"
TextFont3 = "DejaVu Sans Mono-bold-14"
TextFont4 = "DejaVu Sans Mono-bold-20"
# The color which will be used as the background for all of the display
# panes.

View file

@ -41,6 +41,22 @@ import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
/**
* Time Duration Scale Composite
*
* <pre>
*
* SOFTWARE HISTORY
*
* Date Ticket# Engineer Description
* ------------ ---------- ----------- --------------------------
* Nov 20, 2013 #2488 randerso Changed to use DejaVu font
*
* </pre>
*
* @author randerso
* @version 1.0
*/
public class TimeDurScaleComp extends Composite {
/**
* Parent composite.
@ -252,13 +268,10 @@ public class TimeDurScaleComp extends Composite {
*/
private void init() {
// Create the font
// canvasFont = new Font(parentComp.getDisplay(), "Courier", 10,
// SWT.NORMAL);
// canvasFont = new Font(parentComp.getDisplay(), "Monospace", 10,
// SWT.NORMAL);
FontData fd = parentComp.getDisplay().getSystemFont().getFontData()[0];
fd.setName("Bitstream Vera Sans Mono");
// TODO not have hard coded font name
fd.setName("DejaVu Sans Mono");
canvasFont = new Font(parentComp.getDisplay(), fd);
// Create the time bar colors
@ -307,6 +320,7 @@ public class TimeDurScaleComp extends Composite {
this.pack();
this.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent arg0) {
greyColor.dispose();
yellowColor.dispose();
@ -328,6 +342,7 @@ public class TimeDurScaleComp extends Composite {
timeSliderCanvas.setLayoutData(new GridData(CANVAS_WIDTH + 10,
CANVAS_HEIGHT));
timeSliderCanvas.addPaintListener(new PaintListener() {
@Override
public void paintControl(PaintEvent e) {
drawTimeSliderCanvas(e.gc);
}

View file

@ -65,8 +65,9 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
* ------------ ---------- ----------- --------------------------
* Oct 26, 2011 randerso Initial creation
* Oct 30, 2012 1298 rferrel Code clean for non-blocking dialog.
* 02/13/2013 #1597 randerso Made number of concurrent save threads a configurable value.
* Feb 13, 2013 1597 randerso Made number of concurrent save threads a configurable value.
* Added logging to support GFE Performance metrics
* Nov 20, 2013 2488 randerso Changed to use DejaVu font
*
* </pre>
*
@ -127,7 +128,8 @@ public abstract class AbstractSaveParameterDialog extends CaveJFACEDialog
master.addDisposeListener(this);
FontData fd = master.getDisplay().getSystemFont().getFontData()[0];
fd.setName("Bitstream Vera Sans Mono");
// TODO not have hard coded font name
fd.setName("DejaVu Sans Mono");
font = new Font(master.getDisplay(), fd);
initializeComponents();

View file

@ -59,6 +59,7 @@ import com.raytheon.viz.ui.dialogs.CaveJFACEDialog;
* ------------ ---------- ----------- --------------------------
* Jan 21, 2011 randerso Initial creation
* Oct 25, 2012 1287 rferrel Code clean up for non-blocking dialog.
* Nov 20, 2013 2488 randerso Changed to use DejaVu font
*
* </pre>
*
@ -107,7 +108,8 @@ public class WERevertDialog extends CaveJFACEDialog implements DisposeListener {
master.addDisposeListener(this);
FontData fd = master.getDisplay().getSystemFont().getFontData()[0];
fd.setName("Bitstream Vera Sans Mono");
// TODO not have hard coded font name
fd.setName("DejaVu Sans Mono");
font = new Font(master.getDisplay(), fd);
String t;

View file

@ -65,6 +65,7 @@ import com.raytheon.uf.common.status.UFStatus.Priority;
import com.raytheon.uf.viz.core.RGBColors;
import com.raytheon.viz.gfe.Activator;
import com.raytheon.viz.gfe.dialogs.formatterlauncher.ProductEditorComp.PTypeCategory;
import com.raytheon.viz.gfe.rsc.GFEFonts;
import com.raytheon.viz.gfe.textformatter.TextFmtParserUtil;
/**
@ -207,10 +208,12 @@ public class StyledTextComp extends Composite {
private void init() {
String fontSetting = Activator.getDefault().getPreferenceStore()
.getString("ProductOutputDialog_font");
FontData fontData;
if (fontSetting.isEmpty()) {
fontSetting = "Bitstream Vera Sans Mono-bold-12";
fontData = GFEFonts.getFontData(2);
} else {
fontData = StringConverter.asFontData(fontSetting);
}
FontData fontData = StringConverter.asFontData(fontSetting);
textFont = new Font(parent.getDisplay(), fontData);
createMouseListner();
@ -227,6 +230,7 @@ public class StyledTextComp extends Composite {
createTextControl();
this.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent arg0) {
textFont.dispose();
bgColor.dispose();
@ -398,8 +402,7 @@ public class StyledTextComp extends Composite {
// should be unlocked. Cities list is unlocked for editing
// when framing codes are present.
if (newProduct) {
if (cityTip != null &&
cityTip.getText().indexOf("|*") > 0) {
if (cityTip != null && cityTip.getText().indexOf("|*") > 0) {
unlockCitySegs.add(ugc);
}
}
@ -411,8 +414,7 @@ public class StyledTextComp extends Composite {
lockLines(productTextArray, startLine, cityStart);
lockLines(productTextArray, cityEnd, endLine);
}
else {
} else {
lockLines(productTextArray, startLine, endLine);
}
}
@ -731,8 +733,7 @@ public class StyledTextComp extends Composite {
// .getStyleRangeAtOffset(event.start + event.length + 1);
// if it's in a framing code, turn it red
if (startRange != null
&& endRange != null
if (startRange != null && endRange != null
&& event.start > startRange.start
&& event.start + event.length < endRange.start
&& startRange.similarTo(endRange)
@ -856,6 +857,7 @@ public class StyledTextComp extends Composite {
private void createMouseListner() {
mouseListener = new Listener() {
@Override
public void handleEvent(Event e) {
if (e.type == SWT.MouseDown) {
handleMouseDown(e);
@ -1036,16 +1038,18 @@ public class StyledTextComp extends Composite {
protected boolean isUpperCase(final String word) {
for (int index = word.length() - 1; index >= 0; index--) {
if (Character.isLowerCase(word.charAt(index)))
if (Character.isLowerCase(word.charAt(index))) {
return false;
}
}
return true;
}
protected void upper() {
String text = textEditorST.getText();
if (isUpperCase(text))
if (isUpperCase(text)) {
return;
}
int topIdx = textEditorST.getTopIndex();
setProductText(textEditorST.getText().toUpperCase());
textEditorST.setTopIndex(topIdx);

View file

@ -46,6 +46,7 @@ import com.raytheon.viz.gfe.GFEPreference;
* Apr 27, 2011 #9250 bkowal getStyle and getName are now used to
* get the style and name associated with
* a FontData object.
* Nov 20, 2013 #2488 randerso Changed to use DejaVu fonts
*
* </pre>
*
@ -57,9 +58,9 @@ public class GFEFonts {
private static final transient IUFStatusHandler statusHandler = UFStatus
.getHandler(GFEFonts.class);
private static final String DEFAULT_FONT_NAME = "Bitstream Vera Sans";
private static final String DEFAULT_FONT_NAME = "DejaVu Sans Mono";
private static final int[] DEFAULT_FONT_SIZE = { 8, 10, 12, 14, 20 };
private static final int[] DEFAULT_FONT_SIZE = { 9, 9, 12, 14, 20 };
private static final int DEFAULT_FONT_STYLE = SWT.BOLD;

View file

@ -147,4 +147,12 @@
</menu>
</menuContribution>
</extension>
<extension
point="org.eclipse.ui.themes">
<fontDefinition
id="com.raytheon.viz.radar.rsc.graphic.RadarGraphicsPage"
label="Radar Graphics Font"
value="Monospaced-regular-12">
</fontDefinition>
</extension>
</plugin>

View file

@ -19,13 +19,12 @@
**/
package com.raytheon.viz.radar.rsc.graphic;
import java.io.File;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.awt.image.BufferedImage;
import javax.measure.converter.UnitConverter;
import javax.measure.unit.NonSI;
@ -42,8 +41,8 @@ import com.raytheon.uf.common.dataplugin.radar.level3.CellTrendDataPacket;
import com.raytheon.uf.common.dataplugin.radar.level3.CellTrendVolumeScanPacket;
import com.raytheon.uf.common.dataplugin.radar.level3.CorrelatedShearPacket;
import com.raytheon.uf.common.dataplugin.radar.level3.DMDPacket.DMDAttributeIDs;
import com.raytheon.uf.common.dataplugin.radar.level3.GFMPacket;
import com.raytheon.uf.common.dataplugin.radar.level3.ETVSPacket;
import com.raytheon.uf.common.dataplugin.radar.level3.GFMPacket;
import com.raytheon.uf.common.dataplugin.radar.level3.HailPositivePacket;
import com.raytheon.uf.common.dataplugin.radar.level3.HailProbablePacket;
import com.raytheon.uf.common.dataplugin.radar.level3.HdaHailPacket;
@ -78,20 +77,19 @@ import com.raytheon.uf.common.dataplugin.radar.level3.generic.GenericDataCompone
import com.raytheon.uf.common.geospatial.ReferencedCoordinate;
import com.raytheon.uf.common.geospatial.ReferencedGeometry;
import com.raytheon.uf.common.geospatial.ReferencedObject.Type;
import com.raytheon.uf.common.localization.PathManagerFactory;
import com.raytheon.uf.viz.core.DrawableLine;
import com.raytheon.uf.viz.core.DrawableString;
import com.raytheon.uf.viz.core.IGraphicsTarget;
import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment;
import com.raytheon.uf.viz.core.IGraphicsTarget.LineStyle;
import com.raytheon.uf.viz.core.IGraphicsTarget.VerticalAlignment;
import com.raytheon.uf.viz.core.data.prep.IODataPreparer;
import com.raytheon.uf.viz.core.drawables.IDescriptor;
import com.raytheon.uf.viz.core.drawables.IFont;
import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.core.drawables.IRenderable;
import com.raytheon.uf.viz.core.drawables.IWireframeShape;
import com.raytheon.uf.viz.core.drawables.PaintProperties;
import com.raytheon.uf.viz.core.drawables.ext.ICanvasRenderingExtension;
import com.raytheon.uf.viz.core.drawables.IImage;
import com.raytheon.uf.viz.core.exception.VizException;
import com.raytheon.viz.core.rsc.jts.JTSCompiler;
import com.raytheon.viz.pointdata.PointWindDisplay;
@ -121,6 +119,7 @@ import com.vividsolutions.jts.geom.LineString;
* Jan 8, 2009 chammack Initial creation
* 03/05/2013 DCS51 zwang Handle GFM product
* 06/24/2013 DR16162 zwang Remove "wind behind"
* 11/20/2013 2488 randerso Removed use of VeraMono font file
*
* </pre>
*
@ -193,7 +192,8 @@ public class RadarGraphicsPage implements IRenderable {
// for GFM product, add gfmFcstWireframeShape
public RadarGraphicsPage(IDescriptor descriptor, GeneralGridGeometry gg,
IWireframeShape shape, IWireframeShape gfmShape, IGraphicsTarget target, RGB color) {
IWireframeShape shape, IWireframeShape gfmShape,
IGraphicsTarget target, RGB color) {
this(descriptor, gg, shape, target, color);
this.gfmFcstWireframeShape = gfmShape;
}
@ -895,7 +895,8 @@ public class RadarGraphicsPage implements IRenderable {
throws VizException {
List<PlotObject> images = new ArrayList<PlotObject>();
UnitConverter metersPerSecondToKnots = SI.METERS_PER_SECOND.getConverterTo(NonSI.KNOT);
UnitConverter metersPerSecondToKnots = SI.METERS_PER_SECOND
.getConverterTo(NonSI.KNOT);
boolean isFcst = false;
double x, y;
@ -920,19 +921,23 @@ public class RadarGraphicsPage implements IRenderable {
}
// 11 parameters
else {
propU = currFeature.getValue(GFMPacket.GFMAttributeIDs.PROPU.getName());
propU = currFeature.getValue(GFMPacket.GFMAttributeIDs.PROPU
.getName());
if ((propU != null) && (propU.length() > 0)) {
pU = metersPerSecondToKnots.convert(new Double(propU));
}
propV = currFeature.getValue(GFMPacket.GFMAttributeIDs.PROPV.getName());
propV = currFeature.getValue(GFMPacket.GFMAttributeIDs.PROPV
.getName());
if ((propV != null) && (propV.length() > 0)) {
pV = metersPerSecondToKnots.convert(new Double(propV));
}
windX = currFeature.getValue(GFMPacket.GFMAttributeIDs.WINDBEHINDX.getName());
windX = currFeature.getValue(GFMPacket.GFMAttributeIDs.WINDBEHINDX
.getName());
if ((windX != null) && (windX.length() > 0)) {
wX = Float.parseFloat(windX);
}
windY = currFeature.getValue(GFMPacket.GFMAttributeIDs.WINDBEHINDY.getName());
windY = currFeature.getValue(GFMPacket.GFMAttributeIDs.WINDBEHINDY
.getName());
if ((windY != null) && (windY.length() > 0)) {
wY = Float.parseFloat(windY);
}
@ -946,7 +951,8 @@ public class RadarGraphicsPage implements IRenderable {
// Prop wind arrow
PlotObject poWind = new PlotObject();
PointWindDisplay barb = new PointWindDisplay(imgSize * 0.4, 0.5, 2, 0);
PointWindDisplay barb = new PointWindDisplay(imgSize * 0.4, 0.5, 2,
0);
barb.setImageParameters(imgSize, imgSize, 255, 255, 255, 1);
barb.setColor(this.color);
@ -958,8 +964,10 @@ public class RadarGraphicsPage implements IRenderable {
}
barb.setWind(pU, pV, false);
BufferedImage imgBuf = barb.getWindImage(false, DisplayType.ARROW, 0.2);
IImage img = this.target.initializeRaster(new IODataPreparer(imgBuf, UUID.randomUUID().toString(), 0), null);
BufferedImage imgBuf = barb.getWindImage(false, DisplayType.ARROW,
0.2);
IImage img = this.target.initializeRaster(new IODataPreparer(
imgBuf, UUID.randomUUID().toString(), 0), null);
poWind.image = img;
ReferencedCoordinate rc = referencedGfmCoord(wX, wY);
@ -986,10 +994,11 @@ public class RadarGraphicsPage implements IRenderable {
// Connect the dots
if (isFcst) {
gfmFcstWireframeShape.addLineSegment(new Coordinate[] {pos1, pos2 });
}
else {
wireframeShape.addLineSegment(new Coordinate[] {pos1, pos2 });
gfmFcstWireframeShape.addLineSegment(new Coordinate[] {
pos1, pos2 });
} else {
wireframeShape
.addLineSegment(new Coordinate[] { pos1, pos2 });
}
pos1 = pos2;
}
@ -1190,9 +1199,7 @@ public class RadarGraphicsPage implements IRenderable {
public void paint(IGraphicsTarget target, PaintProperties paintProps)
throws VizException {
if (font == null) {
File fontFile = PathManagerFactory.getPathManager().getStaticFile(
"fonts" + File.separator + "VeraMono.ttf");
this.font = target.initializeFont(fontFile, 12.0f, null);
this.font = target.initializeFont(getClass().getName());
this.font.setMagnification((float) magnification, false);
this.font.setSmoothing(true);
}
@ -1201,9 +1208,9 @@ public class RadarGraphicsPage implements IRenderable {
// GFM forecast positions should be dashed thick lines
if (this.gfmFcstWireframeShape != null) {
target.drawWireframeShape(this.wireframeShape, this.color, 3.0f);
target.drawWireframeShape(this.gfmFcstWireframeShape, this.color, 3.0f, LineStyle.DASHED);
}
else if (this.wireframeShape != null) {
target.drawWireframeShape(this.gfmFcstWireframeShape, this.color,
3.0f, LineStyle.DASHED);
} else if (this.wireframeShape != null) {
target.drawWireframeShape(this.wireframeShape, this.color, 1.0f);
}
@ -1483,20 +1490,21 @@ public class RadarGraphicsPage implements IRenderable {
* Need to convert x/y to lon/lat for GFM product
*/
public ReferencedCoordinate referencedGfmCoord(double i, double j) {
return new ReferencedCoordinate(rectifyCoordinate(new Coordinate(i * 4, j * 4)),
this.gridGeometry, Type.GRID_CENTER);
return new ReferencedCoordinate(rectifyCoordinate(new Coordinate(i * 4,
j * 4)), this.gridGeometry, Type.GRID_CENTER);
}
/**
* Gets the nearest point from GFM front to wind behind point to plot
* front movement arrow
* Gets the nearest point from GFM front to wind behind point to plot front
* movement arrow
*
* @param AreaComponent
* @param Coordinate
* @return Coordinate
*
*/
private Coordinate getPlotPoint(AreaComponent currFeature, Coordinate windBehind) {
private Coordinate getPlotPoint(AreaComponent currFeature,
Coordinate windBehind) {
Coordinate point = new Coordinate();
double minDist = Double.MAX_VALUE;

View file

@ -61,6 +61,7 @@ import com.raytheon.viz.ui.dialogs.CaveSWTDialog;
* Feb 03, 2012 14317 mhuang Make alarm display window wider
* Sep 6, 2012 13365 rferrel Accumulate and Display fix.
* Sep 25, 2012 1196 lvenable Dialog refactor for AlarmDisplayWindow.Added DO_NOT_BLOCK.
* Nov 20, 2013 2488 randerso Changed to use DejaVu font
*
* </pre>
*
@ -127,7 +128,8 @@ public class AlarmDisplayWindow extends CaveSWTDialog {
shell.setMinimumSize(300, 100);
FontData fd = shell.getDisplay().getSystemFont().getFontData()[0];
fd.setName("Bitstream Vera Sans Mono");
// TODO not have hard coded font name
fd.setName("DejaVu Sans Mono");
font = new Font(shell.getDisplay(), fd);
GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);