I need to apply a black outline to a font but maintain the white fill color. Expanding the stroke or adding an outline style applies the outline, but when I generate the .ttf or the .otf, the fill color is lost. I've never used fontforge before and a lot of the terms in the documentation are lost on me. Any guidance is appreciated. Using Windows 10.
In a OpenType font, glyphs are described as shape outlines that get filled by a TrueType or CFF (PostScript type 1) rasterizer. The rasterizer is determining which regions are interior to the outline and, accordingly, which pixels get "ink". But the rasterizer doesn't determine the colour. It's up to the application to determine what colour is used for the glyph shape interior (the "foreground" colour) and what colour is used for the background.
Many graphics apps allow you to set a fill colour separate from the stroke colour. But the way that is done is to draw the text using the fill colour as foreground colour (as text would normally be drawn), and then separately to obtain the outline data from the font and then to draw that as paths on top of the "fill". In effect, the app is using the outlines twice in two different modes.
You can create a font that appears as outline stroke with a fill where the foreground colour applies to the outline and the background colour applies to the fill. E.g.,
These kinds of fonts are often referred to as "outline" fonts. (Don't get confused with the technical sense of "outline" to mean the paths in a font's glyph data.) Here's another example of the same font but with the foreground colour set to red and the background set to light green:
The way that would be done is that the glyph outline includes the outer and inner contours of the stroke.
The rasterizer will turn on pixels only for the interior regions of the combined paths.
So far, this is describing typical monochrome fonts. If you want to control the colour of the outline stroke and the fill within the font, then you can create a colour font. Unlike typical monochrome fonts, in which the font doesn't specify any colour info and the app determines foreground and background colours, colour fonts have polychromatic glyphs in which the font developer specifies particular colours. See here for an overview of colour fonts (a little dated and doesn't mention recent enhancements, but still a good intro).
The OpenType spec supports different formats for colour fonts:
I don't know if Fontforge supports creation of colour fonts, but other font development apps such as FontCreator, FontLab and Glyphs do have support for colour fonts.