Is it possible to add TTF font support in the scumm engine?

General chat related to ScummVM, adventure gaming, and so on.

Moderator: ScummVM Team

Post Reply
vimrc
Posts: 5
Joined: Wed Aug 12, 2009 2:56 pm
Location: The Netherlands

Is it possible to add TTF font support in the scumm engine?

Post by vimrc »

Hi, everyone,

I have a problem about the font render. Currently I got the subtitle file using debug function in scummvm, so I want to draw the TTF font with SDL_ttf() to the graphic surface directly, but I failed every time. my problem is if it's possible to add the ttf_font support to the scumm engine conveniently? If possible, it will make life easier when we want to add multi-language support to scummvm.

Thanks for your valuable suggestions!
fingolfin
Retired
Posts: 1452
Joined: Wed Sep 21, 2005 4:12 pm

Post by fingolfin »

Adding support for Truetype fonts (TTF format) would be desirable, and has been considered in the part, e.g. as part of GSoC (Google Summer of Code) project proposals. It is, however, not without problems. In particular, TTF font rendering incurs an overhead in terms of binary size, memory and CPU usage etc. -- and it might be (resp. almost certainly is) just too much for some of the lower spec devices we support. Hence such code would have to be optional.

Also, using SDL_ttf would only work for the SDL backend, but many of our backends are not based on that. It would be much better to use FreeType directly.

AFAIK, no team member is planning to do any work on this at this time, though. If you are interested in this subject, I strongly recommend talking about it on the -devel mailing list, not here.
User avatar
eriktorbjorn
ScummVM Developer
Posts: 3561
Joined: Mon Oct 31, 2005 7:39 am

Post by eriktorbjorn »

fingolfin wrote:Adding support for Truetype fonts (TTF format) would be desirable, and has been considered in the part, e.g. as part of GSoC (Google Summer of Code) project proposals.
Wasn't that just for the ScummVM GUI? When I read vimrc's post I thought he meant adding it to the SCUMM engine specifically, even though that does sound a bit odd to me.
fingolfin
Retired
Posts: 1452
Joined: Wed Sep 21, 2005 4:12 pm

Post by fingolfin »

Indeed, my remark was only targeted at TrueType support for the GUI and other non-engine related things (like message overlay).

The SCUMM engine (nor any other engine) does not require TrueType support, as all font data is contained in the game data files.
vimrc
Posts: 5
Joined: Wed Aug 12, 2009 2:56 pm
Location: The Netherlands

Post by vimrc »

I will check my code again. Sometimes it's a little difficult to zoom in/out the fonts into a proper size. Moreover, for several Asian characters, we have to adjust the font render code for each engine even for each game, it's quite painful. :(

Anyway, I will try to move on and will post my problem in the dev maillist later. Thank you again.
fingolfin
Retired
Posts: 1452
Joined: Wed Sep 21, 2005 4:12 pm

Post by fingolfin »

And what is it you are trying to achieve, anyway? Asian characters... Are you trying to make fan-translations of SCUMM games?
vimrc
Posts: 5
Joined: Wed Aug 12, 2009 2:56 pm
Location: The Netherlands

Post by vimrc »

We are from ChinaAVG forum (www.chinaavg.com). With the help of the forum's moderator Shane007, we are translating the retro games such as FT, Indy series, Broken sword 1/2 etc, and publish the language patches free. Here are an successful font patch in FT:

FT:
Image

However, we meet a problem in indy4. That is the font size is difficult to adjust, so it overlapped the dialog separator bar as the following figure:

Image

We can't make the font smaller or it'll be unclear. At the current stage, we decide to try the true type font, so it's easy to use the bold one or other slender font shapes to prevent this problem. This is our point. Thank you.
User avatar
eriktorbjorn
ScummVM Developer
Posts: 3561
Joined: Mon Oct 31, 2005 7:39 am

Post by eriktorbjorn »

Isn't there some mechanism in ScummVM for drawing the font at a higher resolution? I've never had one of those games myself (and wouldn't be able to understand it if I did), so I never paid much attention to the "CJK mode" handling. It's quite possible that I've completely misunderstood it.
User avatar
LordHoto
ScummVM Developer
Posts: 1029
Joined: Sun Oct 30, 2005 3:58 pm
Location: Germany

Post by LordHoto »

eriktorbjorn wrote:Isn't there some mechanism in ScummVM for drawing the font at a higher resolution? I've never had one of those games myself (and wouldn't be able to understand it if I did), so I never paid much attention to the "CJK mode" handling. It's quite possible that I've completely misunderstood it.
There is *some* handling for drawing fonts at a higher resolution. But that handling is always engine specific. So I can't say whether it would be easy to get it to work with SCUMM in a fan made game easily. Some official SCUMM games are using it though, IIRC there's for example a Japanese version of The Dig and of course all FM-Towns games should be Japanese too.

(Here's some notes about Japanese The Dig: http://sev-notes.blogspot.com/2008/04/s ... nough.html)
vimrc
Posts: 5
Joined: Wed Aug 12, 2009 2:56 pm
Location: The Netherlands

Post by vimrc »

Errrrr.. It looks like quite promising according to the Japanese the dig. I will check the relevant code, thank you all indeed. You really trigger a new idea for us. :)
User avatar
LordHoto
ScummVM Developer
Posts: 1029
Joined: Sun Oct 30, 2005 3:58 pm
Location: Germany

Post by LordHoto »

vimrc wrote:Errrrr.. It looks like quite promising according to the Japanese the dig. I will check the relevant code, thank you all indeed. You really trigger a new idea for us. :)
It actually might really require you to patch the ScummVM sources, thus your fan made patches wouldn't work with vanilla ScummVM (we usually don't add extra code for fan made translations). So if you are required to do so, please do not forget to follow the rules of our source code license.
vimrc
Posts: 5
Joined: Wed Aug 12, 2009 2:56 pm
Location: The Netherlands

Post by vimrc »

Sure thing. Thank you for your reminding.
Post Reply