StreamCompanion icon indicating copy to clipboard operation
StreamCompanion copied to clipboard

Issue with font changes

Open SpoonMcForky opened this issue 2 years ago • 1 comments

I opened an issue a while ago about something similar, but now I'm getting a whole different error. I tried changing the font and it gave me an error: image I just assumed it was an updated error message of the old problem, so I changed it back to a system default font, and after a couple of restarts, it started working again. So there's still the issue of not being able to load fonts that aren't system default, but now it just crashes and gives that error message. I've installed the font with an admin command prompt as well, so I don't think it's a problem with a font or if it's installed globally or not

Edit: Now for some reason, after I changed it back to a system default font, it loaded the font that I originally wanted.

SpoonMcForky avatar Sep 16 '21 21:09 SpoonMcForky

From a technical standpoint, this error can appear only if font file can't be found or it is corrupted. This is configuration for each output pattern that is sent to overlay: https://github.com/Piotrekol/StreamCompanion/blob/master/plugins/FileMapDataSender/FileMapDataSender.cs#L45. Overlay first looks in Software\\Microsoft\\Windows NT\\CurrentVersion\\Fonts registry key for user and machine roots for font entry that matches provided name. If found, it uses font name provided in registry and constructs following path: %windir%\Fonts\<fileName>.

To be honest, I don't remember why this was handled in this exact way(other than primitive configuration parser on overlay side, which didn't allow for sending full paths).

I'll revisit this and most likely replace current parser in overlay with rapidjson, which will then allow passing full font path directly instead of this unnecessarily complicated method.

/edit As to why it keeps crashing even after changing the font: overlay configuration is updated only after changing song in osu!(SC has to be running while that is happening). This could be avoided by changing font in SC, and then stopping both SC and osu!. By doing that you make sure that memory files holding current configuration are wiped, and when SC starts again it will set it with correct font name.

Piotrekol avatar Sep 17 '21 19:09 Piotrekol