Hi all! I’m new here but the gist of my problem is this: I need a way to use a custom font (loaded from file, not from Google fonts) on select portions of game text, in order to render the script of a fictional foreign language.
I feel like I’ve scoured the web for options and so far I’ve found Vorple and Bisquixe which both seemed like solutions, however - Bisquixe seems to only import google fonts, and using the Borogove.app website I haven’t been able to get Vorple to work at all.
Regarding Vorple I know there are multiple issues at play here: the documentation is poor, so far as I can tell styles don’t display properly in the preview window no matter what you do, but exporting doesn’t seem to work right; beyond that if you export as a web page there’s still the issue of what html elements you’re selecting to be modified which is not, apparently, as straightforward as the documentation made it sound, and as an added bonus Borogove.app won’t let me upload my font file anyway…
Anyway suffice to say I’m tearing my hair out. Can anyone point me in the direction of a way to use custom fonts with Inform 7? If not I’m afraid I’m going to have to seriously rework my whole idea for the project…
I’ve never used Borogove, but you can use Vorple locally with Inform 7.
It’s probably a lot more flexible than Borogove, but testing is a bit harder since you can’t run Vorple games locally on your computer (without doing lots of arcane stuff involving setting up your own local web server) - I usually keep a secret draft game page project on itch.io that I upload WIP Vorple games to.
To bundle the font with the game, you can put the font file in your materials folder.
You probably then also want to make a CSS file that applies that font to your style. Something like this:
@font-face {
font-family: "Custom Font";
src: url(Font.ttf); /* Or whatever your font filename is */
}
.custom-font {
font-family: "Custom Font";
}
Put the CSS file in your materials folder too, and finally do:
Release along with a file of "Custom Font" called "Font.ttf". [ or whatever the font filename is ]
Release along with the style sheet "style.css". [ or whatever you called the CSS file in the previous step ]
Release along with a "Vorple" interpreter.
Include Vorple Screen Effects by Juhana Leinonen.
Custom Font is a Vorple style.
When play begins:
say "[custom font style]This should appear in your custom font[end style]."
Basically the same procedure (putting the font and style sheet in your materials folder and releasing along with those files) should work in Bisquixe too, but I haven’t worked with custom styles there. (I even think it should work with “regular” Glulx interpreters that support stylehints.)
You can download the Inform code and folder structure I used to create that project on the page, but it’s more or less the same as above.
I saw that Borogove allows you to upload arbitrary files, so then you I thought you could just take the font and CSS files that I told you to put in your materials folder, and upload them to Borogove instead - but I get an error in the console when trying to upload a font file, so maybe that’s not allowed. Fonts can be included directly in the CSS file as base64 encoded blobs of data, but it doesn’t seem to actually release along with the style sheet either, so I’m not sure how that’s supposed to work. Anyway, if you can figure out how to do this, it could be a way to use Borogove instead of Inform 7 locally on your computer.
Late to this but just to make clear - custom fonts are usually pointless if you’re publishing the game as a Blorb that the player runs in a separate interpreter - the interpreter settings treat the Blorb as plain text and overrides formatting, which is shown as default or can be customized by the player.
Probably the easiest way to get a custom font without diving into Vorple is to use Inform’s “Release along with an interpreter” which gives you a way to make the game playable as an HTML file in a browser, then you can tweak CSS like normal using fonts and formatting as you wish.
That means the player is basically playing in a browser all the time instead of using a separate interpreter. Which is good if you’re distributing via a browser in a venue like itch.io.