Gargoyle 2022.1

The ARM64 build of 2022.1 launches on macOS Big Sur 11.6, but whenever I try to open a game file I get this error:

I think this is due to you having a garglk.ini file that you’ve modified from a previous version of Gargoyle. Since the default fonts have changed, you still have the older fonts listed. There are fallback fonts for this case, but it’s not properly working on macOS (and I’m pretty sure I know why.)

So, there are easy workarounds for this, at least.

The first is to download and install the fonts that are listed in your garglk.ini. One is obviously Liberation Mono, but you might also be missing the proportional font. You can see which fonts are set by running this in a terminal:

egrep '^(mono|prop)font' ~/garglk.ini

Then install those fonts to your system (e.g. with Font Book). You should be able to find copies in the 2019.1.1 source code, available at the releases page.

The other (easier) option is to modify your garglk.ini file, and set monofont and propfont as follows:

monofont      Gargoyle Mono
propfont      Gargoyle Serif

I’ll look at fixing the fallback fonts on macOS for the next release.

Thanks for this! The Intel Mac version works fine on my MBPro running Monterey.

Perhaps a silly question: is there any way to change the default font size and text/background color? The games I tried (even Beyond Zork, with its built-in mapping) displayed fine, but the font is a little small for my “old man” eyes.

Thanks for everyone’s hard work on this new version.

Yes! However, Gargoyle is configured via a text file rather than graphically. On Mac, you can go to the Gargoyle menu and select “Preferences” (or hit ⌘,) to open the config file in a text editor.

To change the font size, find the propsize and monosize entries. These are the sizes of the proportional font and monospaced font.

For colors, find the section starting windowcolor. Colors are 24-bit hex values of RRGGBB (if you do a Google search for “color picker”, Google should pop one up for you, if you need to look up colors).

windowcolor is the background color. tcolor and gcolor are the foreground colors for text buffers and text grids (which almost always correspond to the “normal” window and the top status line, respectively). These look complex because they allow fine-grained control over colors for various text styles. You can use wildcards, though:

tcolor * e7e8e9 31363b
gcolor * e7e8e9 31363b

Using * sets values for all text styles. These have to either replace, or come after the other tcolor and gcolor entries, or they’ll be overwritten.

This is complex, and I keep thinking about writing a graphical config tool, but as of yet, it’s still just vaporware. Feel free to follow up with any questions you may have.

1 Like

As a follow-up, this reminded me that I was going to add a Wiki page with some “color themes”, so to speak, now that 2022.1 supports the wildcard syntax. You can see some example themes here: https://github.com/garglk/garglk/wiki/Color-Themes

4 Likes

Thanks for this! Can’t tell you what a relief it is not to squint at the screen any more!

With the color schemes though I found (for Git 1.2.9 anyway) I had to manually change the Heading and Subheading like so:

#=================================================
# Lectrote Slate
#================================================

windowcolor   4d4d4f
caretcolor    ffffff
morecolor     ffddaa
tcolor * ffffff 4d4d4f
tcolor 3 ffffff 4d4d4f  # Header
tcolor 4 ffffff 4d4d4f  # SubHeader
tcolor 8 ddffdd 4d4d4f
gcolor * 333333 ffffff

Otherwise they remained unaffected by tcolor *. This was true for all the color schemes. I was changing a copy of garglk.ini in my Home directory rather than in /usr, if that matters.

Huh; I assume that problem you’re seeing with header/subheader is that the colors are the defaults, i.e. black on white, instead of the expected white on gray? I ask because I can’t reproduce this: headers and subheaders appear fine for me with the values from the Wiki.

Having garglk.ini in your home directory shouldn’t be a problem at all (I assume you’re on macOS, as that’s the only OS which looks in $HOME for garglk.ini).

If you’re willing to provide your garglk.ini, and let me know which macOS release you’re on, as well as a game that exhibits the problem, I can take a look and see if I can reproduce it.

Actually I’m on linux mint 19.2 Tina, using the Mate desktop. I just fired up an old wip - but it was a standard .ulx file with no quirky extensions. Maybe I should’ve said that it’s gargoyle-free I’m using, since that’s the only only one allowed in the repo for copyright reasons.

Hmmm. I see if I go open Jack Toresal and the secret letter (also a plain .ulx file) the instances of italic text are also still the default black text on white background, although the rest of the file looks fine now that I’ve manually changed the Heading and Subheading colors.
garglk.txt (8.1 KB)
(OK uploaded: had to change the extension to txt to allow the site to accept it.)

1 Like

Oops. Ignore the previous content of this post. I was still using 2019.1!
:man_facepalming:

Is this version 2022.1, or is it the older 2019.1? If it’s 2019.1, the wildcard syntax won’t work there: you’ll have to specify each style manually. 2022.1 introduced the wildcard syntax making “theming” somewhat easier. The themes will look the same in 2019.1 if you list out all the styles, it’s just more of a pain to do.

Ah, that would explain it. Repository apps are usually a version or two behind - just the sheer shortage of volunteer hours. Unfortunately there doesn’t seem to be an “about” menu, so I don’t know how to find out the version (except that it says Git 1.2.9 in the top of the window.) But at least it doesn’t look like it’s some mysterious bug that’s going to come around and bite you later.

But thanks a lot for taking a look at it. And as I said: going to a dark theme was just the icing on the cake. The main triumph for me has been my eyes thanking me for enbiggening the text!

(Looks like Linux Mint 19.2 gets packages it doesn’t provide directly from Ubuntu 18.04, which, along with Git 1.2.9, implies Gargoyle 2011.1.)

1 Like

An classic tool for checking duplicate executable names in a *nix environment in the path is whereis(1)

I change the name with one reflecting the release (in gargoyle’s case, the release year
), so in my case, I have:

pigi@Duilio:~$ garg
garg2019 garg22 gargoyle gargoyle2019 gargoyle-free

(whose illustrate well the usefulness of bash’s tab completion
 :wink: )

Best regards from Italy,
dott. Piergiorgio.

2 Likes

Is there anything new about the “replay” command? Looks like the filename of the .txt must not contain umlauts anymore (“Warning: unable to open the command script.”).

Is this Mac or another platform? There is a new file picker on all other platforms which might be the source of what you’re seeing. Can you give specifics on which platform and which Gargoyle download you used? And any idea if the filename is encoded in UTF-8, or some other encoding? I’m not at a computer at the moment but will try to reproduce when I am.

I used the gargoyle-2022.1-windows-x86_64.exe from the Github page provided in the first post. The filename of my replay file contained an umlaut (like, Ă€Ă¶ĂŒĂ„Ă–ĂœĂŸ), and opening a file worked after I renamed it (removing the umlaut). Does that help?

Yes, thank you! I can reproduce this and it’s not an easy problem (at least for a Unix developer on Windows).

This problem exists in another fashion in the 2019.1 release of Gargoyle. 2019.1 will allow you to load your file properly, but it will not load a file called ☹.txt. It also fails on Ȁ.txt


The problem is Unicode vs ANSI functions on Windows: C functions like fopen() are so-called ANSI functions on Windows, which don’t support Unicode. Gargoyle cannot use Windows specific functions, meaning it gets the ANSI versions. Your umlauted filename is compatible with Windows ANSI functions, but something like Ȁ.txt is not.

With the latest Gargoyle release, filenames come from Qt and are converted with a function that assumes the target is UTF-8, which is not the case on Windows. I think I can get the 2019.1 behavior working on Windows using a different conversion function; this will also fail with the same names that 2019.1 failed with, but at least it won’t be a regression. I don’t know if there is a way to get all possible filenames working when crossing the WIndows/C boundary.

Windows developers, if I’ve made a gross misstatement here, please correct me!

On a related note, presumably also for encoding reasons, filenames on Unix platforms which are not UTF-8 can’t be loaded. I haven’t tested whether this is a regression or identical to 2019.1, but I’ll look into that as well. It’s not as big a deal since UTF-8 is more or less the standard on Unix these days.

1 Like

I think you’ve got the gist of it. The detail is as ever a bit more complicated, so a longer explanation 


C functions like fopen are invariably implemented in library code that comes with the compiler. They’re not the actual operating system call. On classic Unix the actual operating system call was open, I don’t know if that’s what’s still used on Linux. On Windows there are two basic operating system calls for opening files, CreateFileA and CreateFileW.

For historical reasons most Windows calls that take strings have two forms, A (for ANSI, even though it’s not really ANSI, it’s whatever 8-bit character encoding is relevant for the process, known as the “code page”) and W (for Wide, which originally meant UCS-2, and now means UTF-16).

The usual way that fopen is implemented is just as a simple call to the appropriate operating system call. I assume on Windows Gargoyle is built with MinGW? If so then fopen is a pretty simple call to CreateFileA, so the encoding of the string passed to fopen should match CreateFileA’s requirements, i.e. it should be in the code page for the process. It would be entirely possible to write a Windows implemention of fopen that assumed the input string was UTF-8, converted it to UTF-16 and then called CreateFileW. That’s how Unix-like systems on Windows like Cygwin tend to work.

The harder problem is then what to do about this. The simplest approach, and what Microsoft seem to want to do these days, is to just set the code page for the process to UTF-8. This can be done from code, or in the application manifest, see Use UTF-8 code pages in Windows apps - Windows apps | Microsoft Learn

The downside of this is that it only works on recent versions of Windows, from 2019 onwards (Windows 10 build 1903). If working well on older Windows versions matters to you then that’s no good, though it’s worth considering now as most consumer PCs will be updated to at least that version. If you don’t want to go that route, you’d need Windows specific code to do the right thing somewhere. As you’ve noticed a relatively easy solution is to re-encode the string from UTF-8 to the process’ code page, and pass that to fopen, which will work for all characters in the code page. This is virtually always good enough for most uses.

2 Likes

Thank you for the detailed explanation! This really clears things up for me.

I assume on Windows Gargoyle is built with MinGW? If so then fopen is a pretty simple call to CreateFileA, so the encoding of the string passed to fopen should match CreateFileA’s requirements, i.e. it should be in the code page for the process.

Yes, that’s correct. So it makes sense that only certain characters are working (if it’s Windows-1252 or Latin-1, characters like Ă€ and Ă« exist, but Ȁ and :radioactive: don’t).

The harder problem is then what to do about this. The simplest approach, and what Microsoft seem to want to do these days, is to just set the code page for the process to UTF-8. This can be done from code, or in the application manifest, see Use UTF-8 code pages in Windows apps - Windows apps | Microsoft Docs

The downside of this is that it only works on recent versions of Windows, from 2019 onwards (Windows 10 build 1903). If working well on older Windows versions matters to you then that’s no good, though it’s worth considering now as most consumer PCs will be updated to at least that version. If you don’t want to go that route, you’d need Windows specific code to do the right thing somewhere. As you’ve noticed a relatively easy solution is to re-encode the string from UTF-8 to the process’ code page, and pass that to fopen, which will work for all characters in the code page. This is virtually always good enough for most uses.

Supporting older versions, at least for the time being, is a high priority, but if it’s something that can be determined at runtime, that’d be a fine solution; or if not, it may be useful to provide two versions for download, which is something we’ve done for macOS in the past, to support older versions.

For the time being, it does sound like just converting to the current code page is acceptable, at least until I can get something more comprehensive done. I don’t mind adding Windows-specific code at all. What’s one more #ifdef, after all?

Thanks again for the info. I’ve got a much better grasp of this area of Windows now.

Looking at this again, it seems like it can’t be done in code, it can only be specified in the manifest. My current plan for my applications that need to use UTF-8 at some point is

  1. Convert between UTF-8 and the process’ current code page as needed in code. This works pretty well in everything I’ve worked on, and no-one has ever complained that characters outside of the code set can’t be used.
  2. Specify UTF-8 in the manifest: that will be used for recent Windows versions, and ignored in old ones. If it’s used, the functions that convert between the current code page and UTF-8 will be effectively no-ops, so harmless. I haven’t actually done this yet but will do it at some point.