intfiction.org

The Interactive Fiction Community Forum
It is currently Mon Nov 12, 2018 4:11 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 11 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Mon Dec 25, 2017 9:14 pm 
Offline
User avatar

Joined: Wed Oct 14, 2009 4:02 am
Posts: 2545
I have started specifying Gargoyle's Glk extensions so that they can be exposed directly to the VMs for all of you to use, and perhaps for them to be implemented in other interpreters in the future. For now I'm specifying the text formatting functions, which is what has been most under demand!

Have a look at the specification, and let me know if you think it needs any clarifications.

I'll be posting example code soon.

Edit: example code at https://github.com/curiousdannii/if/blo ... e-text.inf


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Dec 26, 2017 4:38 am 
Offline

Joined: Mon Jun 29, 2009 5:51 am
Posts: 607
Dannii wrote:
For now I'm specifying the text formatting functions, which is what has been most under demand!
This seems like a good idea! It all looks pretty straightforward, except for "zcolor_Transparent (-4)". Is that actually useful or even useable at all? "Transparent" was only supported by Z-code V6 and used for overlaying text onto images, but with Glk as it currently is, I don't see how you could usefully use "transparent" at the moment.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Dec 26, 2017 5:40 am 
Offline
User avatar

Joined: Wed Oct 14, 2009 4:02 am
Posts: 2545
garglk itself just completely ignores both zcolor_Transparent and zcolor_Cursor. Maybe it would be better to leave them out of what I'm specifying here? If, in some distance future, they ever become useful it would be easy to add them back because it would be a backwards-compatible change.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Dec 26, 2017 6:33 am 
Offline

Joined: Mon Jun 29, 2009 5:51 am
Posts: 607
Leaving them out makes sense - I'd forgotten that zcolor_Cursor is only really of use in the same way as zcolor_Transparent. If we're not going to have any use for them yet, and no-one implements it, let;s leave it out.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Dec 26, 2017 8:26 pm 
Offline
User avatar

Joined: Wed Oct 14, 2009 4:02 am
Posts: 2545
Okay, I've removed zcolor_Cursor and zcolor_Transparent.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Jan 26, 2018 3:31 am 
Offline

Joined: Mon Jun 29, 2009 5:51 am
Posts: 607
A further suggestion for clarification: what happens after glk_set_style() is called after a garglk_set_zcolors() call? Does the over-ride of the style colours remain, or do we reset back to what's in the Glk style hints? I would favour the latter, but the most important thing is to specify one way or another...


Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Jan 26, 2018 5:52 am 
Offline
User avatar

Joined: Wed Oct 14, 2009 4:02 am
Posts: 2545
From reading Gargoyle's cgstream.c the garglk_set_zcolors colours (as well as reverse) stay in place even after calling glk_set_style. Perhaps not ideal, but at least it's fairly self contained.

I'm having trouble building Gargoyle currently, but I'll try to test it soon, and then update the spec and test file.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Mar 06, 2018 10:34 am 
Offline

Joined: Mon Jun 29, 2009 5:51 am
Posts: 607
I've implemented these text formatting opcodes in Windows Glk, so that they can be used with the latest builds of Windows Glulxe and Windows Git, which are available from here:

Windows Glulxe: http://ifarchive.org/indexes/if-archiveXprogrammingXglulxXinterpretersXglulxe.html
Windows Git: http://ifarchive.org/indexes/if-archiveXprogrammingXglulxXinterpretersXgit.html

This would perhaps have been more use about 15 years ago, but better late than never ...


Top
 Profile Send private message  
Reply with quote  
PostPosted: Tue Mar 06, 2018 11:41 pm 
Offline
User avatar

Joined: Wed Oct 14, 2009 4:02 am
Posts: 2545
Excellent!

Sorry I haven't updated the unit test yet. I'm still planning to. I also want to make an Inform 7 extension.


Top
 Profile Send private message  
Reply with quote  
PostPosted: Fri Mar 23, 2018 10:04 pm 
Offline
User avatar

Joined: Wed Oct 14, 2009 4:02 am
Posts: 2545
Hi David, sorry it took so long, but I've checked how Garglk handles conflicting instructions from stylehints and these text functions. Unfortunately it's a bit messy. Here's what I added to the spec:

Quote:
Switching to a style which has a colour stylehint set will not override the colours specified with these functions. These colours will continue to be used until you disable them with zcolor_Default, after which the style’s colour stylehints will be used.

Unlike colours, reverse mode stylehints do interact with these functions: reverse mode will be used if either the current style has a stylehint enabling it, or if it has been enabled by these functions. When stylehints enable reverse mode, you cannot call garglk_set_reversevideo to disable it; you can only disable reverse mode by switching to another style.


I've updated the test file to test all the combinations I could think of: https://github.com/curiousdannii/if/blo ... e-text.ulx

I was concerned that you might have made Windows-Glk make garglk_set_reversevideo(0) overwrite a stylehint, but you followed what Garglk does, and the testcase runs correctly! :)


Top
 Profile Send private message  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 11 posts ]  Go to page 1, 2  Next

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group