Importing Fonts w/Bisquixe

Prelude: this is probably just a bungle on my part, but I am failing to import google fonts in my bisquixe project.

Here’s a demo project

lab is a room.

release along with a "bisquixe" interpreter.

include glulx entry points by emily short.
include simple multimedia effects for v10 by mathbrush.

first when play begins:
	import-google-fonts "family=Open+Sans&family=Roboto+Mono";
	css-set-fast ".BufferWindow; font-family; Open Sans, monospace";
	css-set-fast ".GridWindow; font-family; Roboto Mono, sans-serif";

I’ve set the fallback fonts to their opposite, i.e. the bufferwindow fallback is monospace so that it’s easy to tell that the sans-serif font specified is not displaying.

Here’s a page running the demo:

1 Like

I’m looking into this. So far I’ve found this out. Here’s how bisquixe translates your code to CSS:

I can see that it’s monospace right now (which is the bad default). I’ll keep looking!

1 Like

I think font families with spaces in them need to be wrapped in quotation marks? So it should be "Open Sans", not Open Sans.

Also, I notice that yours says “family=” twice. What happens if you delete the copy of ‘family=’ in your code?

I’ll try to download and run it in bisquixe myself.

@tvil I think Bisquixe might have trouble with that. I got this basic html file to display without using quotes:

 <style>@import url('https://fonts.googleapis.com/css2?family=Open+Sans&family=Roboto Mono&display=swap');
 body {
	font-family: Open Sans;
 }
 </style>
 
 Hello!

(I deleted the ‘family=’ from the beginning of the text)

Right - I looked it up, and it’s “technically valid, but not recommended”, so that’s probably not the problem and I wouldn’t worry about it after all. font-family - CSS: Cascading Style Sheets | MDN

(As you identified, the double family= is probably the problem.)

1 Like

That’s great. I’m hoping to write a bit about this, so it will be helpful to share this technique. Thank you!

1 Like

I got it to work! Deleting the very first instance of ‘family=’ will fix the problem.

Using this:

first when play begins:
	import-google-fonts "Open+Sans&family=Roboto+Mono";

results in this:

It’s because it was designed for use with one font at a time so prepends the ‘family=’. Adding another family with the ‘&family=’ is basically a kind of CSS injection. I would have added a better way of adding multiple families, but that would require me understanding inform 6 arrays and I don’t think I’m ready for that.

2 Likes

JFYI @kamineko, you can set itch.io games as draft or restricted to not announce them to all your followers :slight_smile:

1 Like