If I set my output font to be Dina loaded from the MUSHclient folder instead of one of the system installed fonts, when I start up MUSHclient it refuses to actually use the font until I open the world settings and pop open the font selector and then hit ok.
main output font in MUSHclient folder not loading at startup?
Posted by Fiendish on Wed 29 May 2019 03:48 AM — 13 posts, 46,593 views.
I can't even see in the code what might enable that behaviour. Perhaps use AddFont in world startup?
AddFont
The documentation for the AddFont script function is available online. It is also in the MUSHclient help file.
Well it's definitely shown as an option when I go to select my output font. And I can choose it, and the setting sticks. It just doesn't work. ¯\ _(ツ)_/¯
What is shown as an option? I'm surprised that it works at all.
Quote:
What is shown as an option?
What is shown as an option?
The Dina font. See: https://i.imgur.com/CX5Yxeb.png
Yes, but the font configuration dialog doesn't have any code to load fonts from your current folder. Windows must be doing that.
Ok but that aside, why does MUSHclient happily load the local Dina font when I choose it but then not load the font at startup until I go and choose it again?
Let's say one of my plugins is adding Dina (they are) and then a user seeing it as an option decides to set it as their main output font.
Is it possible for AddFont to try to run automatically if the world output setting at launch indicates a font that isn't in the MUSHclient space?
Is it possible for AddFont to try to run automatically if the world output setting at launch indicates a font that isn't in the MUSHclient space?
Also, something isn't working right here when I try to do it manually.
Loading this plugin does not update the font display as I would expect:
The font only updates if I open the output font configuration dialog and re-save the current setting.
See this screen recording: https://youtu.be/cWxxuQoO8QA
Loading this plugin does not update the font display as I would expect:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<muclient>
<plugin
name="Dina_test"
author="Fiendish"
id="0399d8b2259be90d8a4c3442"
language="Lua"
requires="4.00"
version="1.0"
>
</plugin>
<script>
<![CDATA[
AddFont(GetInfo(66).."Dina.fon")
SetAlphaOption("output_font_name", "Dina")
SetOption("output_font_height", 10)
SetOutputFont("Dina", 10)
Repaint()
]]>
</script>
</muclient>
The font only updates if I open the output font configuration dialog and re-save the current setting.
See this screen recording: https://youtu.be/cWxxuQoO8QA
I can't reproduce that. I tried on Ubuntu Wine and Mac with Crossover Wine. In both cases your plugin worked.
You need to give more details. Exactly what version of MUSHclient, and what operating system (including version of Wine) are you using?
You need to give more details. Exactly what version of MUSHclient, and what operating system (including version of Wine) are you using?
I have a new video for you: https://youtu.be/yLxsTrdrfr0
MUSHclient 5.07-pre and 5.06 at least.
macOS 10.14.6 with Wine 5.0 and 5.7 staging where everything else works fine.
Loading a world file that has output_font_name="Dina" and output_font_height="10" ( like this one: https://pastebin.com/raw/41jwn5RW ). This part I believe is key.
I cannot get the output to actually show using Dina 10 until I manually go into world settings and click OK on the font. I can get it to show Dina 8, but I believe that that's because the world file tried to load Dina 10 at startup and failed because Dina had not yet been added.
I think that if the world file specifies a font that doesn't yet exist because it has to be loaded first with AddFont, then MUSHclient should try to call AddFont to load it as the first fallback and then only use the wrong font if that fails. It would require storing the font file path and not just font name if the world font was loaded with AddFont.
MUSHclient 5.07-pre and 5.06 at least.
macOS 10.14.6 with Wine 5.0 and 5.7 staging where everything else works fine.
Loading a world file that has output_font_name="Dina" and output_font_height="10" ( like this one: https://pastebin.com/raw/41jwn5RW ). This part I believe is key.
I cannot get the output to actually show using Dina 10 until I manually go into world settings and click OK on the font. I can get it to show Dina 8, but I believe that that's because the world file tried to load Dina 10 at startup and failed because Dina had not yet been added.
I think that if the world file specifies a font that doesn't yet exist because it has to be loaded first with AddFont, then MUSHclient should try to call AddFont to load it as the first fallback and then only use the wrong font if that fails. It would require storing the font file path and not just font name if the world font was loaded with AddFont.
Even adding this code to the start of CMUSHclientDoc::SetUpOutputWindow doesn't work
I don't know what to try next.
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
CString app_dir = ExtractDirectory(App.m_strMUSHclientFileName);
list<CString> font_globs {app_dir + "*.fon", app_dir + "*.ttf"};
for (list<CString>::iterator fit = font_globs.begin(); fit != font_globs.end(); fit++) {
hFind = FindFirstFile(*fit, &FindFileData);
if (hFind != INVALID_HANDLE_VALUE) {
do {
AddSpecialFont(app_dir + FindFileData.cFileName);
} while (FindNextFile(hFind, &FindFileData) != 0);
}
}
I don't know what to try next.
Sorry for the tardy response. My mind has boggled a bit due to other things happening in the world right now.
(The response is still tardy, I'll try to look at it shortly).
(The response is still tardy, I'll try to look at it shortly).