Regarding the sorting out of fonts, I am using a .NET function called GlyphTypeface that lets me access the typeface information, such as family, point size, etc. There is a glaring bug in GlyphTypeface.
hooray
I have a few options; I can fix the bug in GlyphTypeface but that would entail getting hired at Microsoft, getting assigned to that team, fixing the bug, then quitting immediately after my pull request is accepted. Alternatively I could build my own GlyphTypeface just for this problem. I could use other libraries that implement a workable solution. Or I can brute force it by the shortest path. I am going to brute force it.
The process, due to GlyphTypeface, that inspects the font puts a lock on the file, and also, because of the bug, will crash when you inspect a second font immediately afterwards. This is a hell of a bug. My solution is to have a parent process which simply enumerates all of the fonts, but a second process that does the actually inspection and renaming of the font files. And that child process immediately exits after processing precisely one font file. The parent process will loop over the font files, invoking a child process to do the actual work needed.
I am not real happy with that solution. It is “inelegant.” But the solution takes care of the problem, and I only need the solution to run for a few hours before the code is thrown away. I cannot imagine any scenario in the near future where I will need to rename several tens of thousands of font files…