Cannot Set Font Size to Below 13 (C# .NET)

Discussion created by DrColgate on Oct 11, 2011
Latest reply on Oct 12, 2011 by jamesfreddyc
When I use the following script I cannot set the font size to below 13.  This works when I try font sizes 13 and above (converts 13 to 12.75). The data comes in as a string but this should not make a difference otherwise it would fail the conversion to Decimal.  The exception I get is the "value not within expected range".

ESRI.ArcGIS.Carto.IElement element = new ESRI.ArcGIS.Carto.TextElementClass();
ESRI.ArcGIS.Carto.ITextElement textElement = (ESRI.ArcGIS.Carto.ITextElement)element;
textElement.Text = elementString;

stdole.IFontDisp font = (stdole.IFontDisp)new stdole.StdFontClass();
font.Size = System.Convert.ToDecimal(textSize);
ESRI.ArcGIS.Display.ITextSymbol symbol = textElement.Symbol;
symbol.Font = font; //FAILS HERE if textSize > 12
textElement.Symbol = symbol;

This seems to be a bug as the lowest value in ArcMap is 5 but more importantly the default value is 12 which I cannot set either.

I am also not sure why I must explicilty set "textElement.Symbol = symbol" as I assumed it was referencing it anyway.