Announcement: Be excellent to each other.


Caravel Forum : DROD Boards : Bugs : Scroll kerning (Seriously. Kerning.)
New Topic New Poll Post Reply
Poster Message
Tahnan
Level: Smitemaster
Avatar
Rank Points: 2460
Registered: 11-14-2005
IP: Logged
icon Scroll kerning (0)  
The following two images are screenshots from disoriented and Rheb, on the same screen of Rheb's latest hold:

Click here to view the secret text


As you can see, in the upper screenshot, the scroll ends with "...any token t"; in the lower screenshot, the full clause "...any token they step on" appears.

If you look reeeeeeeally closely at the two scrolls, it seems the difference is the kerning. That is to say: in Rheb's screenshot, the letters are just close enough together that "and strong enough" appears on a single line; in disoriented's, "and strong" appears on one line, and "enough" wraps to the next.

What, I wonder, is causing this? Is Rheb using a PC and disoriented a Mac (or Linux, or...?).

To make things that much more complicated: I'm pretty sure that when I first looked at the scroll, I saw what disoriented is seeing, but I didn't notice that stray "t" and assumed that "trigger any token" was the end of the sentence. Unfortunately, I can't get a screenshot of that, because my screen currently looks like Rheb's. Which could mean I was imagining the too-long scroll, or it could mean that we've got a really irritatingly unreliable bug.
10-26-2011 at 12:39 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
west.logan
Level: Smitemaster
Avatar
Rank Points: 608
Registered: 03-09-2011
IP: Logged
icon Re: Scroll kerning (0)  
I believe you're correct.
Click here to view the secret text


It's most noticeable after a lowercase "r" (look at the word "creature" for example) or in the word "decoy."

If I had to take a guess, I would say that the one that fits all the text is on a Mac, where I would assume it takes advantage of the font's kerning table. The other one looks like it has had no kerning adjustments made. I measured the scroll width and they are of course the same.

I have /no/ idea how one would go about fixing that, unless this isn't using the system font or kerning table somehow.

____________________________
-Logan
10-26-2011 at 01:18 AM
View Profile Send Private Message to User Send Email to User Show all user's posts This architect's holds Quote Reply
TFMurphy
Level: Smitemaster
Rank Points: 3118
Registered: 06-11-2007
IP: Logged
icon Re: Scroll kerning (+2)  
This has come up again and again before. I've looked into it briefly in the past, and not been able to fix it, so this time around I might as well state exactly what DROD is doing here.

Scroll text is dealt with via a class called CLabelWidget, which handles a number of different text-related procedures in DROD. When you step on a scroll, the entirety of the scroll's contents is sent to pScrollLabel (an instance of CLabelWidget) as a WSTRING.

pScrollLabel has a set width and height of 132 x 340. It uses tomnr.ttf (Toms New Roman) at 19pt, with antialiasing and a wSpaceWidth of 3.

When it comes to update the scroll, a call to DrawTextToRect is made in DROD's FontManager class. This draws each word of the scroll individually, so that word wrap can be done properly. This is done with a call to RenderWord. RenderWord creates an SDL_Surface, and the width of this SDL_Surface is what it used to determine whether a word will fit.

RenderWord ultimately creates this SDL_Surface by using a call to TTF_RenderUNICODE_Shaded, which in this case is sent the Toms New Roman font, the word to be printed, and the font colors. This is an SDL library function.

Past this, I can't dig any further, nor see any differences between Windows and other builds that would cause this problem. I do know that the Russian build uses a different font, but that shouldn't affect Mac/Linux. EDIT: Oh, and for the record, DROD does not use TTF_SetKerning to change any factor of the font's kerning, and the default value for this is thus to have kerning enabled. And the one that actually has the graphics fit is the Windows version.

EDIT 2: As a further note, I'm not sure exactly which versions of SDL_ttf and FreeType are being used by the various builds of DROD out there. Legal.txt for the last Windows version specifies SDL_ttf 2.0.8 and FreeType 2.1.4. I know that a lot of newer versions of Freetype have come out since the last Linux/Mac releases, but I also know trick mentioned often having problems finding versions of SDL_ttf and Freetype that were both compatible with each other *and* with DROD.

[Last edited by TFMurphy at 10-26-2011 01:59 AM]
10-26-2011 at 01:22 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
12th Archivist
Level: Smitemaster
Avatar
Rank Points: 789
Registered: 12-07-2008
IP: Logged
icon Re: Scroll kerning (0)  
Trickster wrote:
Just don't drop me so low I can't upload files or playtest holds or anything, guys. That would be mean.
Unless you go and get yourself banned, no amount of downmods will prevent you from playtesting or releasing holds.

____________________________
It was going well until it exploded.
~Scott Manley

Check out the DROD Wikia project here!
10-26-2011 at 05:55 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Tahnan
Level: Smitemaster
Avatar
Rank Points: 2460
Registered: 11-14-2005
IP: Logged
icon Re: Scroll kerning (+1)  
TFMurphy wrote:
Scroll text is dealt with via a class called garble garble computerese mumble mumble whatnow garble library function.
Needless to say, I didn't understand a whole lot of that. So correct me if I'm wrong, but I think what you're saying is that all the actual text layout is done by procedures in the C code (I assume it's C code?), and those are being called in the same way on Macs and PCs, so whatever is going wrong is the fault of C and not of DROD?

The two things that occur to me to ask--and bear in mind that I myself am in no position to answer these--are: (1) is it possible to find out whether these classes are in fact different versions in the Mac and PC installations, or whether it's the same version but is known to behave differently? (2) Is it possible, and does it make sense, to call pScrollLabel with a wSpaceWidth of 2, on Macs?

---

Aside to Trickster: CSI joke or otherwise, I'm not sure there's any unsecreted use of "[size=+2][size=+2][size=+2]" that wouldn't get a downmod, never mind adding "[color=red]".
10-26-2011 at 07:18 AM
View Profile Send Private Message to User Show all user's posts High Scores This architect's holds Quote Reply
skell
Level: Legendary Smitemaster
Avatar
Rank Points: 3757
Registered: 12-28-2004
IP: Logged
icon Re: Scroll kerning (0)  
Tahnan wrote:
TFMurphy wrote:
Scroll text is dealt with via a class called garble garble computerese mumble mumble whatnow garble library function.
Needless to say, I didn't understand a whole lot of that. So correct me if I'm wrong...

As far as I can say: there are tree factors that determine the actual size of the text. Version of SDL_ttf, version of FreeType and the version of the actual font itself (though it seems it is the same everywhere). Different version of different libraries may yield different results on different operating systems.

One easy to do hack to fix it would be to, in the editor, display the scroll having NOT 132 pixels in width, but rather something smaller, say 125. This way, if you can fit in less space you are bound to fit in more space, and thus even with different kernings it should display everything on all platforms. This of course is a filthy workaround.

Other solution is to add some kind of detection system when the scroll is too long, and if that's the case show notification - with mouse click on the scroll you could browse next/prev pages.


____________________________
My website
10-26-2011 at 07:53 AM
View Profile Send Private Message to User Send Email to User Visit Homepage Show all user's posts High Scores This architect's holds Quote Reply
TFMurphy
Level: Smitemaster
Rank Points: 3118
Registered: 06-11-2007
IP: Logged
icon Re: Scroll kerning (+2)  
Tahnan wrote:
So correct me if I'm wrong, but I think what you're saying is that all the actual text layout is done by procedures in the C code (I assume it's C code?), and those are being called in the same way on Macs and PCs, so whatever is going wrong is the fault of C and not of DROD?
Not *quite*. It's done by a set of third party libraries. In this case, the two libraries I mentioned were FreeType, which offers a set of tools to work with fonts, and SDL_ttf, which is an interface between FreeType and the Simple DirectMedia Layer (a cross-platform library that allows easy access to displaying graphics, sound and accessing input from the user).

If you recall the Alt+R Beep bug you reported several months back? The cause of that bug is in the SDL library.

Tahnan wrote:
The two things that occur to me to ask--and bear in mind that I myself am in no position to answer these--are: (1) is it possible to find out whether these classes are in fact different versions in the Mac and PC installations, or whether it's the same version but is known to behave differently? (2) Is it possible, and does it make sense, to call pScrollLabel with a wSpaceWidth of 2, on Macs?
(1) is possible, but tricky to establish. I can easily determine the version of the Windows SDL_ttf library, since SDL_ttf.dll is stamped with its version (hover over it in Windows, and it should show you on the tooltip). But FreeType isn't distributed as a 'dynamic' library, so I can't get at the version details that a specific build of DROD was compiled with. And I don't know how to do any of this on Linux or Mac.

As for (2), we *could* make the Mac build use a different wSpaceWidth. It wouldn't exactly solve the issue though: note that both screenshots are dealing with the fonts slightly differently. In the 2nd screenshot, 'do' and 'ro' are closer together than in the 1st screenshot. But in the 1st screenshot, 'li' is closer together than in the 2nd. In fact, if you actually go and look closer on a pixel-by-pixel comparison, you'll see that every single letter is aliased subtly differently between the two screenshots. It's recognisably the same font displayed at what definitely looks to be the same font size, but the rendering of every letter in each line is different. And since DROD has a pixel-limit for determining whether a word will fit, small differences like this add up. And I'm sure there are scrolls written by Mac authors that fit fine on a Mac but don't in Windows.
10-26-2011 at 08:03 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Rheb
Level: Smitemaster
Avatar
Rank Points: 1211
Registered: 08-04-2006
IP: Logged
icon Re: Scroll kerning (0)  
I'm not sure if this would be easy to implement, (but my guess is no).

Anyway, wouldn't it be possible to lock the lines of scrolls?

By that I mean that when a scroll is created in the editor text is displayed using the same procedure as we have now. But when the editing of the scroll is done the lines are locked in position forcing the scroll to display in the same way as the creator saw it to everyone. This would mean that some parts of characters can end up outside the pixel restrictions. But as far as I can tell, the differences are so small that no ugliness would be noticeable.

Edit: Of course, that wouldn't go well with all the already created holds. Hmm -_-

____________________________
Voligner is my very own DROD-like game. Please check it out!

[Last edited by Rheb at 10-26-2011 06:03 PM]
10-26-2011 at 05:56 PM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
Jatopian
Level: Smitemaster
Rank Points: 1842
Registered: 07-31-2005
IP: Logged
icon Re: Scroll kerning (+2)  
10-26-2011 at 08:44 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
disoriented
Level: Smitemaster
Avatar
Rank Points: 2394
Registered: 08-07-2007
IP: Logged
icon Re: Scroll kerning (0)  
N.B.: My screenshot was taken of DROD 3.2.0.83 running on Ubuntu 11.04 inside VMWare.

(Eagerly awaiting the Intel-native Mac version :D)

____________________________
34th Skywatcher

Best to PM me, since I might miss your message on CaravelNet chat.
10-27-2011 at 07:06 AM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
Banjooie
Level: Smitemaster
Avatar
Rank Points: 1645
Registered: 12-12-2004
IP: Logged
icon Re: Scroll kerning (0)  
http://cow.org/csi/

Here. Use this instead, Trickster.
12-11-2011 at 09:27 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
12th Archivist
Level: Smitemaster
Avatar
Rank Points: 789
Registered: 12-07-2008
IP: Logged
icon Re: Scroll kerning (0)  
Banjooie wrote:
http://cow.org/csi/
...

Okay!

____________________________
It was going well until it exploded.
~Scott Manley

Check out the DROD Wikia project here!
12-11-2011 at 10:04 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
mrimer
Level: Legendary Smitemaster
Avatar
Rank Points: 5106
Registered: 02-04-2003
IP: Logged
icon Re: Scroll kerning (0)  
I think the kerning issue has been fixed in the latest version that was just uploaded last week. Can anyone verify this?

____________________________
Gandalf? Yes... That's what they used to call me.
Gandalf the Grey. That was my name.
I am Gandalf the White.
And I come back to you now at the turn of the tide.
04-12-2012 at 05:37 AM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
Dischorran
Level: Smitemaster
Avatar
Rank Points: 3413
Registered: 09-10-2005
IP: Logged

File: MC2S4.0.1.110.png (819 KB)
Downloaded 189 times.
License: Public Domain
icon Re: Scroll kerning (+1)  
I always seemed to have issues with scroll text cutting off before, and this is what I have now for the room up top.
Click here to view the secret text


____________________________
Click here to view the secret text


[Last edited by Dischorran at 04-12-2012 07:24 AM]
04-12-2012 at 07:23 AM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
trick
Level: Legendary Smitemaster
Rank Points: 2580
Registered: 04-12-2003
IP: Logged
icon Re: Scroll kerning (+1)  
Oh right, this should be fixed in TCB 3.3.0.96.1 for Linux too. Forgot about that.
04-12-2012 at 12:56 PM
View Profile Send Private Message to User Send Email to User Show all user's posts Quote Reply
New Topic New Poll Post Reply
Caravel Forum : DROD Boards : Bugs : Scroll kerning (Seriously. Kerning.)
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.