Jump to content
The Dark Mod Forums

Readables: No title guis. Font control from xdata possible? xdata info?


Recommended Posts

I made a letter using a handwritten font but not quite enough room so I did a new gui so the body starts at the top and left the title blank. It occurred to me that this might be commonly needed but would double up every gui. Might there be value in doing all the readables guis like this by default? The title space and font still exists but unused. When a title is needed the mapper just puts \n\n\n at the start of his body text.

 

Is it possible to have any font control from the xdata? I've searched the net before for xdata info but I think it is a common variable name in some languages so results get flooded with those. The wiki articles don't give a lot of info and I suspect there is more somewhere. I did find a colour control for about 16 colours but they are one line only and over bright, virtually luminous, for our needs. Wiki down at the moment so can't check what's there. No it's not - I left my firewall locked during an overnight virus scan. :blush:

 

Line spacing distance seems to be built into the font unfortunately with a small font size yet wastes line space - almost looks double spaced. Can't recall if I'm using popsie or everett but I'm inclined to increase the font size. Trouble is, it looks so real, like when you try to read real handwriting. That might be good for special cases where you want the player to struggle a minute to make out the whereabouts of a secret crypt but probably not for general use.

 

Can't recall if multi- page readables work yet - fairly sure they do but suit only books. Maybe we need a 'multi-sheets of parchment' model and inventory icon to represent several sheets.

 

Not even tried mixing with graphics yet, would font position vary with screen res? - will be easier to do a custom background like a map and probably the way to go. It's probably not such a big deal to have a few like that in a map zip.

Link to post
Share on other sites
Is it possible to have any font control from the xdata? I've searched the net before for xdata info but I think it is a common variable name in some languages so results get flooded with those.

The fonts are defined in the GUI file, I would have to check if the font can be a variable.

 

Can't recall if multi- page readables work yet - fairly sure they do but suit only books. Maybe we need a 'multi-sheets of parchment' model and inventory icon to represent several sheets.

Multi-page readables work, check out test/readables.map, there should be a small variety of single-page and multi-page readables in there.

 

Not even tried mixing with graphics yet, would font position vary with screen res? - will be easier to do a custom background like a map and probably the way to go. It's probably not such a big deal to have a few like that in a map zip.

The GUI screen is referring to a "virtual" 640x480 screen, so font positions should not vary with different user screen resolutions. I can't be entierly sure on that, though.

Link to post
Share on other sites

What I was thinking was say illuminated characters - coloured letter graphics to start paragraphs. Or just a scrawled ring around a word or rough underline etc. If that graphic did not line up on some systems it would be unsuitable to use.

 

The advantage of setting the font, and font size and colour from the xdata is you don't need dozens of variations of guis in the resources or several custom guis with the map. Thought maybe that last is not too bad. Probably just be one or a few. I'm just thinking up possibilities.

Link to post
Share on other sites

Ah, if you want to change the font in the middle of the text like in Word or something, this won't be possible via the xdata file. The GUI has defined text areas and each of them has one single font.

 

If you want capitals, you'll need to create a custom GUI. If you want a different font in the middle of a sentence, this will be tricky.

Link to post
Share on other sites

Not necessarily change the font (though that might be useful if two people write on a doc or a special printed page - though a custom gui might have several rectangles?) No I was thinking more of setting the one font,size, colour from xdata. As it is we have several fixed guis. For more variety you might have hundreds of guis. But if the guis fonts could be controlled by the xdata then just one gui for each background type might do as now but the mapper could more easily vary the appearance.

Link to post
Share on other sites

The font size is also set per text rectangle in the GUI (you can't have multiple font sizes in one text area). I'd have to check if it's possible to make that a variable (as I mentioned with the font type above).

 

The font colour is also set per text area. As you posted above, there are a few escape characters which allow you to override the colour within a sentence, but they are too bright and saturated.

 

Is this a pressing issue? I can of course look into it, but if it's not too urgent, I'd suggest you open an issue about "font style, sizes and colours in GUIs to be controlled by xdata settings" and assign it to me. I'll check it out when I have time then.

 

If it keeps you from getting work done, I can look into it right now, leaving DarkRadiant coding for a while.

Link to post
Share on other sites

Readables are limited by what GUIs can do. That precludes things like changing font or size in the middle of a paragraph. The only things that xdata can affect are settings that can be changed at runtime (because the GUI reads its settings and modifies itself at runtime to apply those settings). Font-size can be changed at runtime, so it would be possible to control that with xdata. On the other hand, the font is static, and therefore cannot be affected by the xdata decl.

 

I was eventually planning on implementing some way for GUIs to detect when a setting has been set (for use with textscale), but never got around to it...

 

I highly recommend avoiding all text colors except black, because they're drawn using alpha-blending, which causes them to glow in the dark, even on in-game models. (if we could find a way to draw them multiplicatively, other colors would be feasible)

Link to post
Share on other sites

@greebo: No, definitely not urgent - not even something I need at this moment. I was just sounding out ideas. All these things can be done with custom guis or custom graphic backgrounds but I just wondered what flexibility there might be from xdata which might mean almost no custom guis need be developed. Mappers could just directly choose font and size with any background. Say you want a big scrawled message of just one sentence on a parchment. The mapper has to make a custom gui. With xdata control the mapper would choose the font and set the size big and use an existing gui. Or the message fits one page all but one word even when the mapper reduces it as much as possible. Slightly reduce the font size and it fits but it needs a custom gui. But low priority compared with other TDM wip.

 

The one suggestion I did make which would be easy to do but would 'break' existing useage is to start all body rectangles to the top at the same start point as the title. This would enable the mapper to choose in the xdata to start the body at the top without a title. At the moment, if the mapper leaves the title blank then it leaves an empty space at the top. The mapper might be glad of that space for the body as I was today as it enabled me to squeeze in a message on one page which makes it more readable than having 2 or 3 lines straggling onto a second page and then, as said, you can see the the model in-game is just a single parchment. I did it by making a custom gui but it would not be necessary if they were all like that and there is no downside other than that mappers have to put \n\n\n at the start of the body text if they also want a title. This is also all that would be needed to correct any existing maps if their text format is 'broken' by such a change in the readables guis.

Link to post
Share on other sites

You would find the section of the code that looks like

set "title::text" "$gui::title";
set "body::text" "$gui::body";

and add something to change the size of the body rectangle if the title is empty. Perhaps something like:

set "title::text" "$gui::title";
set "body::text" "$gui::body";
if ("$gui::title" == "") { // I forget if the $ is needed
set "body::rect" "x y w h"; // replace x y w h with enlarged body rectangle
}

Instead of "x y w h", you'd have the rectangle that'd you want the body to take up when there's no title.

Link to post
Share on other sites

Not quite right. The new IF statement always returns true, ie, title empty so it seems its not referencing that variable correctly. So it always starts at 10 whether there is a title or not. The statement is functioning because it does always operate the new value. I've also tried $gui instead just gui but no difference. I guess just gui is correct as the IF above it does not have a $.

 

	windowDef body {
	WORLD_SCALE
	rect 20, 50, 250, 380
	forecolor 0, 0, 0, 0 //1st show before fadein. keep at 0,0,0,0
	font "fonts/everett"
	text "<body>"
	textscale 0.4
}

onTime 0 {
	if ("gui::worldDisplay" == 1)
	{
		set "title::forecolor" "0 0 0 1";
		set "body::forecolor" "0 0 0 1";
	}
	set "title::text" "$gui::title";
	set "body::text" "$gui::body";
if ("gui::title" == "")
{
	set "body::rect" "20, 10, 250, 380";
}
}
}

Link to post
Share on other sites
  • 2 months later...

BUMP

 

I'm about to start making readable prefabs for use in the next release. We need to make a decision soon about where the body starts if there is no title. Just to sum up...

  • Mappers will often struggle to squeeze all the text they want on to one page but often one page is better in-game, eg, a scroll or sheet of parchment.
  • Posters and notices often need a title, eg WARNING! but most messages and letters do not.
  • At present with the current guis, messages will waste the space reserved for the title; in RL probably a handwritten note will start near the top not 3/4ths of the way down and this will help the mapper get his text on one page.
  • These are the four possibilities I know of:

  1. Remain as we are and waste the title space if not needed
  2. Duplicate every gui that is affected so some have no title space
  3. Move the body start point up to the top where the title starts. This will mean if there is no title then the message can use the whole page. If there IS a title then the mapper need only put a few \n\n\n\n at the start of his body message. This is easy to do for the mapper. It is fairly easy to change the guis - just alter a value. It will 'break' a few existing maps: A message with a title will have the body text overwritten on it and one without a title the body will start at the top whereas the mapper might have intended it to be centred vertically.
  4. Implement Gildoran's idea (above @ http://forums.thedarkmod.com/index.php?showt...t&p=147997) to have a conditional body position that will start higher automatically if there is no title. This will only 'break' existing maps insofar as body text without a title will start higher than the mapper expected. I could not get this idea to work as I recall but no doubt someone could figure out how to make it work?

If this can be decided before the next release then there is no chance of readables in the release being 'broken' later.

Link to post
Share on other sites

I'd vote for 4 as this would be the most intuitive way for the mapper.

 

When do you want to start with the readables? Just so that I can plan for it, unless somebody else wants to look into the GUI code?

Link to post
Share on other sites

@greebo: Would it help if I do a test map - probably derive from or modify the current readables test and a test gui with gildoran's adjustments for you to tinker with? If so I'll put that on bugtracker

Link to post
Share on other sites
@greebo: Would it help if I do a test map - probably derive from or modify the current readables test and a test gui with gildoran's adjustments for you to tinker with? If so I'll put that on bugtracker

Such test setup are always very helpful for me. So, take this as a yes. :)

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...