Been a long time since this thread was spawned & maybe there's a better way to deal with this by now, but I couldn't find it so I hacked a resolution by adding THREE text graphics for every label I wanted to place in the map: two of them act as a highlight/mask...First to create the three slightly different symbols:
var TextSymbolJson = { // This is the main readable label
"type": "esriTS",
"color": [0, 0, 0, 255],
"verticalAlignment": "middle",
"horizontalAlignment": "center",
"font": {
"family": "Arial",
"size": 16,
"style": "normal",
"weight": "bold",
"decoration": "none"
}
};
// This one is white, partially transparent, a bit bigger & bolder, and offset south 1 pixel from the main label (1st part of the mask)
var TextHighlightJson1 = Object.create(TextSymbolJson);
TextHighlightJson1.color = [255, 255, 255, 245];
TextHighlightJson1.yoffset = -1;
TextHighlightJson1.font.size = 18;
TextHighlightJson1.font.weight = "bolder";
// This one is just like the one above except offset north 1 pixel (2nd part of the mask)
var TextHighlightJson2 = Object.create(TextHighlightJson1);
TextHighlightJson2.yoffset = 1;
Then to use those symbols ...
for (feature in ListOfFeaturesToLabel) {
AddNumText = feature.attributes.PROPADDNUM;
AddNumPoint = feature.geometry.getExtent().getCenter();
var TS = new esri.symbol.TextSymbol(TextSymbolJson);
TS.setColor(layerTextColor);
TS.setText(AddNumText);
var labelPointGraphic = new esri.Graphic(AddNumPoint, TS);
var highlightSymbol1 = new esri.symbol.TextSymbol(TextHighlightJson1);
highlightSymbol1.setText(AddNumText);
var highlightGraphic1 = new esri.Graphic(AddNumPoint, highlightSymbol1);
var highlightSymbol2 = new esri.symbol.TextSymbol(TextHighlightJson2);
highlightSymbol2.setText(AddNumText);
var highlightGraphic2 = new esri.Graphic(AddNumPoint, highlightSymbol2);
map.graphics.add(highlightGraphic1);
map.graphics.add(highlightGraphic2);
map.graphics.add(labelPointGraphic); // Make sure to add the main label to the map last so it's on top of its mask
}