Add custom fonts to the font dropdown
Rita works on the corporate-templating team inside a Fortune-500 insurance company. The team ships a single internal app that every claims agent, every underwriter, and every adjuster uses to draft customer-facing letters. The marketing department spent two years and a six-figure budget commissioning a custom brand typeface - Verdant Sans for body text, Verdant Serif for legal language - and the brand-compliance team has a rule: every customer-facing communication must use the brand fonts, full stop, no exceptions.
The editor's font dropdown, out of the box, lists every font installed on the local machine. That is exactly the wrong behavior for Rita. An adjuster running the app on a Citrix VDI might see Arial, Calibri, Comic Sans, Wingdings, and forty other fonts that have no business appearing in a claim denial letter. Worse, Verdant Sans is shipped as a private application font - it is not installed system-wide and would not appear in the dropdown at all without Rita's intervention.
How the font combo actually works
The dropdown is exposed as htmlEditor1.CmbFontName. It is a SpiceFontCombo, a custom ToolStripComboBox. By default it lazily populates from FontFamily.Families the first time the user focuses or opens it - that is the AddSystemFonts = true path. Each item is a SpiceFontCombo.FontComboBoxItem built from a preview System.Drawing.Font and, optionally, the CSS font-family string the editor should write into the document when the user picks the item.
Path 1: Rita's curated list
Rita's requirement maps onto the second code path: do not populate system fonts at all. Set AddSystemFonts to false before the combo populates itself, clear any items, then add the brand entries.
using SpiceLogic.HtmlEditor.WinForms.Helpers.Controls;
private void LetterEditor_Load(object sender, EventArgs e)
{
var combo = htmlEditor1.CmbFontName;
combo.AddSystemFonts = false; // do not auto-load FontFamily.Families
combo.Items.Clear();
AddBrandFont(combo, "Verdant Sans", "'Verdant Sans', Arial, sans-serif");
AddBrandFont(combo, "Verdant Serif", "'Verdant Serif', Georgia, serif");
AddBrandFont(combo, "Consolas", "Consolas, 'Courier New', monospace"); // for policy IDs
}
private static void AddBrandFont(SpiceFontCombo combo, string previewName, string cssFontFamily)
{
var font = new Font(previewName, 12, FontStyle.Regular, GraphicsUnit.Point);
combo.Items.Add(new SpiceFontCombo.FontComboBoxItem(font, cssFontFamily));
}Three fonts in the dropdown, all brand-approved. The adjuster cannot accidentally pick Comic Sans because Comic Sans is no longer in the list.

Path 2: keeping system fonts and adding the brand font
Rita's second use case - the internal "free-format" notes editor that the brand-compliance team does not police - calls for the opposite move: keep all system fonts, just add Verdant Sans on top so it shows up alongside Arial. She loads the font privately first (via a PrivateFontCollection elsewhere in the application), then appends an item:
using SpiceLogic.HtmlEditor.WinForms.Helpers.Controls;
private void NotesEditor_Load(object sender, EventArgs e)
{
// The combo populates system fonts lazily on first focus/dropdown.
// Trigger the population, then append the brand font.
htmlEditor1.CmbFontName.ComboBox.PerformLayout();
var previewFont = new Font("Verdant Sans", 12, FontStyle.Regular, GraphicsUnit.Point);
htmlEditor1.CmbFontName.Items.Add(
new SpiceFontCombo.FontComboBoxItem(previewFont, "'Verdant Sans', Arial, sans-serif"));
}
The detail Rita almost missed
The second argument to FontComboBoxItem is the CSS string that ends up in the document's inline font-family rule. Rita's first cut passed just "Verdant Sans". The letters rendered fine in the editor (where the private font was loaded into the process), but when QA opened a saved letter on a machine that didn't have Verdant Sans, the browser fell back to a serif default and the layout shifted. The fix was the web-safe fallback stack - "'Verdant Sans', Arial, sans-serif" - so any machine without the brand font still renders the document in something sensible.
What Rita verified before shipping
- When an adjuster picks an item, the editor applies
font-familywith the CSS string Rita passed (not with the preview font'sName). - The preview text in the dropdown is rendered using the preview
Fontobject Rita constructed - so the brand font only previews correctly when the font is loaded into the process (typically viaPrivateFontCollectionat app startup). - If a document's
BodyStylealready declaresfont-family, that body-level rule wins until the adjuster actively picks a font from the dropdown for a selection. Rita keeps the default body style aligned with Verdant Sans so new letters start out brand-compliant.