intfiction.org

The Interactive Fiction Community Forum
It is currently Sat Sep 23, 2017 8:21 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 66 posts ]  Go to page 1, 2, 3, 4, 5 ... 7  Next
Author Message
PostPosted: Sun Jan 29, 2012 1:18 am 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 5448
Two days before the end of the month, even.

I have posted three documents:

* Overview
* All the Details
* The Short Form (for people who don't want to read about CSS or HTML or anything, they just want it to work)

There is a whole lot of work involved in this plan, so you're not going to start using it next week or anything. But I am reasonably convinced that this is the roadmap. It's consistent with the last discussion I had with Graham on the subject.


Top
 Profile Send private message  
 
PostPosted: Sun Jan 29, 2012 2:41 am 
Offline
User avatar

Joined: Wed Oct 14, 2009 4:02 am
Posts: 2394
Comments:

  • If glk_end_style_name()/glk_end_style() generate run time errors then will they get used? It would be far too risky for the library to call them, because the user may have forgotten to end a style they added to the stack. I'd like to suggest the following API functions instead:
    • glk_inspect_style(): returns the style at the top of the stack
    • glk_end_style_name()/glk_end_style(): these functions would instead pop styles from the stack until the given style is popped. The whole stack could be emptied. No errors would be generated
  • Part of me wants to say that the generated HTML shouldn't have para_ and span_ class names as style sheets could have div.style and span.style instead. (As well as a generic .style.) But then that would lock implementations into using particular elements, which I don't like the idea of (I'd like to use <tt>s I think.)
  • Can you explain some of the use cases for HTML windows/frames?
  • Instead of html windows loading resources from the blorb, can they just use inline styles and scripts, and use data: for images?
  • Instead of GlkEntry/GlkEvent, what about just using postMessage()? Support is good: http://caniuse.com/x-doc-messaging


Top
 Profile Send private message  
 
PostPosted: Sun Jan 29, 2012 4:26 am 
Offline

Joined: Mon Jun 09, 2008 8:58 pm
Posts: 764
Location: Seattle
Neat-o.

Quote:
(I am not sure whether games will want their style nesting to be strictly checked or not. The library can ensure correct nesting either way, so I'm willing to offer both options.)

I think that's wise, for Glk not to check strict usage and let a higher level do, or not do, it. But if it does take this hands-off approach, is printing a run-time message to the player appropriate for confused usage? Maybe Glk should just tell the calling library instead, and let the library decide whether to bother the player.

What does Glk do in cases of the style stack overflowing or underflowing? I think underflow could be silently ignored, but overflow...?

Quote:
Code:
void glk_begin_style_name(glui32 num, char *name)
void glk_begin_style(glui32 num)

Add Num/"Name" to the current style stack. If the stack is empty, this also sets the current paragraph style.

This confuses me. If I don't use paragraph styles, but just stick a span style mid-paragraph, the above wording implies than when I end the span, the rest of the paragraph will still have that style -- it won't turn off until the end of the paragraph even though I told it to end at the end of the span. Do I misunderstand something here?

Quote:
Code:
Chapter is a text style based on Header.

Other parts of I7 use the form "a number based rulebook", so I'd be somewhat surprised by anything but "header based text style". A minor point, I know. (And please let us not capitalize non-proper names mid-sentence! "header", not "Header"! It's a pet peeve of mine when I read others' I7 code.)

Quote:
[/italic]

I feel slashes are un-Inform-like -- witness [bracket] and [close bracket] -- but, ::shrug::

Quote:
But the current I7 compiler generates a lot of hardcoded line breaks. That would have to change.

Yes please!

Also: is Glk married to Javascript, disallowing Javascript's competitors?

_________________
Blog at Gamasutra :: Programmer's Guide to Inform 7 :: Seattle I-F


Top
 Profile Send private message  
 
PostPosted: Sun Jan 29, 2012 3:01 pm 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 5448
Quote:
If glk_end_style_name()/glk_end_style() generate run time errors then will they get used?


That's a fair point.

I want errors to be visible to the author during testing. But they don't have to be *fatal* errors for that, and the interpreter really can only throw fatal errors. At the same time, I don't want game code to be in a paranoid loop of constantly interrogating the style state in order to do anything. That's a waste of time.

I like Ron's suggestion that the call should return an error value. That way, the game can display a warning when in debug mode only.

Quote:
Part of me wants to say that the generated HTML shouldn't have para_ and span_ class names as style sheets could have div.style and span.style instead. (As well as a generic .style.)


I separated them out because, in some cases, double-applying a CSS attribute is bad.

If you have "Header" as the current style, then (following the rules as I've written them) you'll get span_Header spans inside para_Header divs. That's not a problem with my sample stylesheet. But if these had the *same* class name ("Header"), then a ".Header {font-size: 1.4em;}" declaration would apply twice, and the font size would be multiplied by 1.96!

Quote:
But then that would lock implementations into using particular elements, which I don't like the idea of (I'd like to use <tt>s I think.)


The examples I gave are supposed to be definitive for elements as well as classes. So yes, I'm already locking the implementing into using <div> and <span>.

Quote:
Can you explain some of the use cases for HTML windows/frames?


I've got a guy in email who's been begging me to permit panoramic photo display in a Glulx window. I don't know how that works (it's probably a Flash applet) but if he can make it work in a web browser, he should be able to make it work in a Glulx window.

More generally, it's an out for people who are tired of writing graphics in I7 code. No offense to GLIMMR! But if I want a fancier status line, with custom fonts, gradients, some icons, and maybe a decorative border, it's very easy to build that using HTML.

Quote:
Instead of html windows loading resources from the blorb, can they just use inline styles and scripts, and use data: for images?


People could do that but I'd hate to require it of them. We'll see how practical my other ideas are.

Quote:
Instead of GlkEntry/GlkEvent, what about just using postMessage()?


I hadn't looked at that; I'll read up on it. It looks designed for JS-to-JS communication, right? I also have to think about (e.g.) a MacOS app which has embedded a WebKit view and is calling from ObjC-to-JS.


Top
 Profile Send private message  
 
PostPosted: Sun Jan 29, 2012 3:08 pm 
Offline

Joined: Sat Jan 23, 2010 4:56 pm
Posts: 5448
Quote:
What does Glk do in cases of the style stack overflowing or underflowing?


Underflowing is an error, which is currently described as a fatal error, but I'll change that to an error return value. As for overflow, there is no limit on span nesting. (If you want to run the interpreter out of memory, there are easier ways than style abuse.)

Quote:
If I don't use paragraph styles, but just stick a span style mid-paragraph, the above wording implies than when I end the span, the rest of the paragraph will still have that style


The "current paragraph style" is only applied to a paragraph when the paragraph begins. Further changes only affect what will happen to the *next* paragraph. I guess that's not very clear -- I'll add some explanation.

Quote:
Other parts of I7 use the form "a number based rulebook", so I'd be somewhat surprised by anything but "header based text style"


Up to Graham. But you're right about capitalization. I'll change those examples.

Quote:
is Glk married to Javascript, disallowing Javascript's competitors?


Ask me again in a couple of years, if there *are* competitors by then. :/

I deliberately made the call name generic -- "glk_script_send()" -- to avoid specifying this. In theory, Glk doesn't care what the scripting language is, as long as the game and browser agree. In practice, that means Javascript. I can imagine a future where there's a real choice, and then somebody would have to specify a language somewhere, but we're not there today.


Top
 Profile Send private message  
 
PostPosted: Sun Jan 29, 2012 3:44 pm 
Offline

Joined: Thu Oct 22, 2009 4:31 pm
Posts: 1301
zarf wrote:
Quote:
Can you explain some of the use cases for HTML windows/frames?

More generally, it's an out for people who are tired of writing graphics in I7 code. No offense to GLIMMR! But if I want a fancier status line, with custom fonts, gradients, some icons, and maybe a decorative border, it's very easy to build that using HTML.

No offense taken. I will be very happy to see Glimmr obsolesce when these new features are in place and widely supported! Embedding an HTML frame will allow for all kinds of stuff that you can't do with Glulx graphics--images mixed with actual text, dynamic rotation, shadows, etc. And the ability to get input from embedded frames opens up all kinds of possibilities.

The plan looks great. Will there be a core of recommended CSS rules that interpreters that don't use HTML for display should support? (Mostly so that game authors will know what will work widely and what will only work on web or widget interpreters.)


Top
 Profile Send private message  
 
PostPosted: Sun Jan 29, 2012 7:19 pm 
Offline

Joined: Mon Jun 09, 2008 8:58 pm
Posts: 764
Location: Seattle
zarf wrote:
I deliberately made the call name generic -- "glk_script_send()" -- to avoid specifying this. In theory, Glk doesn't care

I noticed the call naming, but the spec has JS all over it and even called out jQuery specifically. I don't know how agnostic Glk can be, but the spec should at least state if it's agnostic or not, or at least where it is and isn't, or at least its intention.

I know JS is everywhere now, but IF tech seems to have longer shelf life than many tech, so it's not unreasonable to presume this spec will live to see a JS competitor.

_________________
Blog at Gamasutra :: Programmer's Guide to Inform 7 :: Seattle I-F


Top
 Profile Send private message  
 
PostPosted: Sun Jan 29, 2012 7:42 pm 
Offline

Joined: Thu Jan 26, 2012 11:37 pm
Posts: 14
Location: USA
Quote:
This confuses me. If I don't use paragraph styles, but just stick a span style mid-paragraph, the above wording implies than when I end the span, the rest of the paragraph will still have that style -- it won't turn off until the end of the paragraph even though I told it to end at the end of the span. Do I misunderstand something here?


I was confused too. As I read the document, it looks like:
  • There is a stack of styles.
  • A style is either a single ClassicStyleNum or a pair (ClassicStyleNum, StyleNameStr).
  • The "current paragraph style" is an alternate name for the style at the bottom of the style stack.
  • The "style of the current paragraph" is the default style used within the paragraph. The paragraph's style is set to the "current paragraph style" the first time text is emitted after a paragraph break and cannot be changed thereafter (because the <div> open tag has already been emitted).
  • Text emitted as part of a paragraph uses the style at the top of stack.
  • The style stack MUST NOT be cleared by `glk_paragraph_break()`.

The distinction between "the current paragraph style" and "the style of the current paragraph" is a subtle one. Replacing "the current paragraph style" with "the bottommost style" or "the style at bottom of stack" might reduce the confusion.

_________________
jeremywsherman.com | @jeremywsherman
wip: Ten Rooms comp entry


Top
 Profile Send private message  
 
 Post subject: Empty paragraphs
PostPosted: Sun Jan 29, 2012 8:04 pm 
Offline

Joined: Thu Jan 26, 2012 11:37 pm
Posts: 14
Location: USA
Quote:
QUERY: Is there such a thing as an empty paragraph? (That is, if you call glk_paragraph_break() twice in a row, do you get a big blank space?) In HTML the answer is "no", and it would be easier to stick to that. It does introduce a small consistency problem with the non-HTML interpreters, though.


I agree that under the break model of paragraphing (versus a model built around *glk_paragraph_begin() or *glk_paragraph_new or whatever), making glk_paragraph_break() idempotent seems sensible. If you really want a blank paragraph, then write a non-printing character or a space and break again right after.

The paragraphing model threw me off initially. I wanted to equate paragraph break to emitting the open tag for the next paragraph (something like <p id="N" class="K">), so each time you call it, you would begin a new paragraph. The fine point that paragraph style is not set till you emit text after a break finally made things clear.

_________________
jeremywsherman.com | @jeremywsherman
wip: Ten Rooms comp entry


Top
 Profile Send private message  
 
PostPosted: Sun Jan 29, 2012 8:24 pm 
Offline

Joined: Thu Jan 26, 2012 11:37 pm
Posts: 14
Location: USA
Quote:
There is a whole lot of work involved in this plan, so you're not going to start using it next week or anything. But I am reasonably convinced that this is the roadmap.

How could I help?

_________________
jeremywsherman.com | @jeremywsherman
wip: Ten Rooms comp entry


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 66 posts ]  Go to page 1, 2, 3, 4, 5 ... 7  Next

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 3 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