Text window text offset

Started by Dave Gilbert, Wed 30/03/2016 15:48:11

Previous topic - Next topic

Gurok

#20
This hasn't been mentioned yet, but a simple, immediate solution here would be for Dave to edit the font file. I don't know what the licence restrictions are on the font, but it's fairly easy to edit ascender, descender, x-height, whatever is necessary and save a custom version for use with AGS. There are various font editors available. FontCreator and FontForge come to mind. FontForge is also free. I know it's just a workaround, but it would take the pressure off for finding an engine-based solution.
[img]http://7d4iqnx.gif;rWRLUuw.gi

Crimson Wizard

Quote from: Gurok on Mon 11/04/2016 02:07:57
This hasn't been mentioned yet, but a simple, immediate solution here would be for Dave to edit the font file. I don't know what the licence restrictions are on the font, but it's fairly easy to edit ascender, descender, x-height, whatever is necessary and save a custom version for use with AGS. There are various font editors available. FontCreator and FontForge come to mind. FontForge is also free. I know it's just a workaround, but it would take the pressure off for finding an engine-based solution.
True, basically all he has to do is to put Baseline to where currently Descend line is.

Snarky

Quote from: Crimson Wizard on Mon 11/04/2016 01:49:06
The only solution I see now is to add some per-font options that would control how the particular font is drawn.
For example:
- Font's height only counts Ascender (upper part). This will be backwards-compatible too.
- Font's height counts both Ascender and Descender.

I think it would be better to, as Dave suggested, just have a parameter for vertical text offset (baseline shift) that would allow you to shift the text up or down. And perhaps another parameter for the line spacing (leading), in case the one calculated from the ascender/descender values isn't correct. I think this would be more intuitive to work with, more flexible, wouldn't require users to look deeply into what's wrong with the font metrics, and is more consistent with the type of options offered by other applications.

Crimson Wizard

#23
Small clarification to what I wrote yesterday: current AGS behavior does not stretch ascender, nor stretch letters visually, but simply aligns baseline with the bottom line of the user-defined height. The letters stay same, but some empty vertical space is added above.

Danvzare

I just want to add, that I tested that test-build with some pretty old AGS games.
And... it had some really odd effects.

This is what the text was supposed to look like:
[imgzoom]http://orig08.deviantart.net/e59c/f/2016/102/c/1/supposed_to_look_like_by_danvzare-d9ynkh5.png[/imgzoom]

And this is what it ended up looking like:
[imgzoom]http://orig01.deviantart.net/5c80/f/2016/102/e/8/actually_looks_like_by_danvzare-d9ynkhb.png[/imgzoom]

Of course, I think there's more than one problem going on here, just because of how old the game is. But still, I thought I'd bring it to someone's attention.

Crimson Wizard

Can you post a link to this game?

I saw similar effect in other game, but it was far less noticeable.
Apparently the library finds smaller(?) or thinner style of the font when looking for matching font size.

Dave Gilbert

That looks like a high-res font in a low-res game? I know those tend to look VERY ugly.


Crimson Wizard

#28
Quote from: Danvzare on Mon 11/04/2016 17:43:38
Quote from: Crimson Wizard on Mon 11/04/2016 17:05:57
Can you post a link to this game?

Here you go: http://www.adventuregamestudio.co.uk/site/games/game/1078/

I found there is more than just TTF rendering problem, apparently version 3.4.0 has some error that makes game choose incorrect font for drawing speech text. I will have to investigate that separately.
That's pretty lucky you stumbled across that one (no sarcasm intended).

Crimson Wizard

#29
Here is new test version with some fixes:
http://www.mediafire.com/download/vcxuwbtkuv2l2yd/acwin_3.4.0.6--alfont-new-2.zip

But I believe it could be easier for Dave Gilbert to just modify the font, as Gurok suggested above. With FontForge, for example, it should be a minute of work (simply change one global font parameter).

Also, the latest version of the font library I put into use is somehow less forgiving to mistakes in the font. For instance, the LucasFan font, used by all the Maniac Mansion Mania games is not drawn as nicely anymore. I found there are some tricks that could possibly help in sake of backwards compatibility, but they require more work.

Crimson Wizard

I wanted to say, that I am going to follow old Snarky's (I think it was him) advice to just add "vertical offset" property to the fonts.
Upgrading library, as I planned months ago, may require additional work, related to both implementing compatibility modes and dealing with automatic building we have now; and I am sparing much much less time to AGS now.
In any way, this "vertical offset" may come useful event if the library gets upgraded, for precise tuning of imperfectly designed fonts and backwards compatibility.

Dave Gilbert

Seems like the best solution. Thanks CW!

SMF spam blocked by CleanTalk