TextSymbol font in IE 8 is only Arial

628
0
11-11-2011 02:24 PM
TrentHardy
New Contributor
I am trying to set a graphic textsymbol to a font other than Arial in Internet Explorer 8. I have seen the caveats about IE 7 only rendering Arial, but have seen nothing about IE 8. Below is a test page I have been using. It only renders Arial in IE 8. It works in FireFox 7.0.1.

I followed the advice here (http://stackoverflow.com/questions/6348959/how-to-disable-compatibility-view-in-ie) about checking IE 8 compatability view, and the user agent has no mention of IE 7.

Any ideas?

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> 
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=8" />
</head>
<body>
<div id="map" style="height:400px;width:400px;"></div>
<script src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.4"></script>
<script>
dojo.addOnLoad(function() {
 dojo.require("esri.map");
 dojo.require("esri.layers.agstiled");
 dojo.require("esri.layers.graphics");
 dojo.addOnLoad(function() {
  var map = new esri.Map('map');
  dojo.connect(map, 'onLoad', function() {
   var geometry = map.extent.getCenter(),
    fontFamily = 'Times New Roman',
    font = new esri.symbol.Font('12pt', esri.symbol.Font.STYLE_NORMAL, esri.symbol.Font.VARIANT_NORMAL, esri.symbol.Font.WEIGHT_NORMAL, fontFamily),
    symbol = new esri.symbol.TextSymbol(fontFamily + ' font', font, new dojo.Color([0, 0, 0])),
    graphic = new esri.Graphic(geometry, symbol);
   map.graphics.add(graphic);
  });
  var layer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/arcgis/rest/services/esri_streetmap_world_2d/mapserver");
  map.addLayer(layer);
 });
});
</script>
</body>
</html>
0 Kudos
0 Replies