Some Annotation Style Fonts can not be set from code

Trying to set the font to “Arial Black” from code but it defaults to “Arial”, Works Ok in the UI…

  • I am using the following code to generate a list of font names. When I select “Arial Black” and I assume others it will not set the font in a new DimStyle. When I select "Arial: and others it works fine.

  • I am trying to set the PreSelectItem to “Bahnschrift” and this name is not selected in the List Box when it comes up. I think this is the way it should work. Please let me know if I am missing somthing.

InstalledFontCollection installedFontCollection = new InstalledFontCollection();
Object preselectItem = new FontFamily("Bahnschrift");
Object selectedFontFamilyName = Dialogs.ShowListBox("Names","Select",installedFontCollection.Families.Select(font => font.Name).ToList(),preselectItem);
 if (selectedFontFamilyName == null)
{
return;
 }

defaultFontFamilyName = Convert.ToString(selectedFontFamilyName);

Best:

Steve

Hi @slyon,

This seems to work correctly:

protected override Result RunCommand(RhinoDoc doc, RunMode mode)
{
  var quartets = Rhino.DocObjects.Font.InstalledFontsAsQuartets();
  var quartets_names = quartets.Select(f => f.QuartetName).ToList();
  var default_quartet = quartets.FirstOrDefault(f => f.QuartetName == "Bahnschrift");
  var selected = Rhino.UI.Dialogs.ShowListBox("Names", "Select", quartets_names, default_quartet?.QuartetName);
  // todo...

– Dale

Dale:

Cool… this solves both of my questions.

Thanks a bunch!

Best;

Steve