Select to view content in your preferred language

TextSymbol with embedded font not working

2742
3
10-25-2010 07:46 PM
MikeMcDougall
New Contributor
I have an embedded true type font that I have successfully displayed through a label on a widget within the viewer:
          <s:Label id="SymbolLabel" fontFamily="ERSIncidents" fontSize="45" text="A">

However when I try to use that same font in a TextSymbol it does not work. Just the plain letter A displays on the map instead of the font symbol.

var pictureGraphic:Graphic = new Graphic();
var symbol:TextSymbol = new TextSymbol();
symbol.text = "A";
var textFormat:TextFormat = new TextFormat();
textFormat.font = "ERSIncidents";
textFormat.size = 60;
symbol.textFormat = textFormat;
    
pictureGraphic.geometry=this.convertLatLonToMapPoint(incident.lon, incident.lat);
pictureGraphic.symbol= symbol; 
mapLayer.add(pictureGraphic);

Any ideas? Is there some difference in font versus fontFamily?
Thanks,
Mike
Tags (2)
0 Kudos
3 Replies
RobertScheitlin__GISP
MVP Emeritus
Mike,

  I remember going through this before and what you have to did (if I recall correctly) is add the embeded font to the index.mxml.
0 Kudos
Ganael_Jatteau
Emerging Contributor
Hi, I have the same problem with a font that is not in the client side but embedded into a SWF.

The font is embedded like this in the SWF named  fonts_container.swf:


[Embed(source="/assets/esri_150.ttf", fontFamily="ESRI AMFM Electric", embedAsCFF="true")]
private var ESRI_AMFM_Electric:Class;

public function fonts_container()
{
      Font.registerFont(ESRI_AMFM_Electric);
}


and i call it in my application (application.swf) like this :

@font-face {
   src:url("assets/fonts_container.swf");
   fontFamily: "ESRI AMFM Electric";
  }


And this symbol is not displayed correctly :

<flash:TextFormat id="ftf" font="ESRI AMFM Electric"/>

<esri:symbol>
<esri:TextSymbol id="txt1" text="S" textFormat="{ftf}"/>
</esri:symbol>


If I add the font in the client device and remove the @font-face, the symbol display correctly.

It is a problem because the font is not supposed to be installed on the client device.



Am I forgetting some parameters to make the  symbol display correctly with embedded font ?
0 Kudos
DasaPaddock
Esri Regular Contributor
Which versions of the Flex SDK and ArcGIS API for Flex are you using?
0 Kudos