gemot encubed  

Go Back   gemot encubed > Gemot > Technical Issues

Technical Issues For bug reports, problem solving, and help running Japanese software.

Reply
 
Thread Tools Display Modes
  #1  
Old 2006-11-30, 16:32
Rasqual Twilight
Guest
 
Posts: n/a
Default Engine assuming fixed-width font?

I think Healeth illustrated it in a news entitled "2005.3.26 De impossibilitas collocationis versuum", most vn engines just allow/assume using only fixed width fonts, but it turns out rather poorly for Western text.

In RealLive, it's been solved by plugging an extension DLL (IIRC?), but how would you do otherwise?

Haeleth mentionned intercepting GetGlyphOutline calls, but all I've got is a single call to GetTextExtentPoint32 for obtaining the bbox of a single character; otherwise it's TextOut all the way...
Reply With Quote
  #2  
Old 2006-11-30, 23:10
zalas zalas is offline
 
 
Join Date: Feb 2004
Location: fushigi misuterii
Posts: 1,831
Send a message via ICQ to zalas
Default

Most straight-forward way would be to just patch their text engine. Find where it's incrementing the x position, and replace the constant by the width of the current character being processed (which you should be able to get from a Win32 function call). Some assembly required...
__________________
~Yoda is waiting in the air~ | HAVEN
Reply With Quote
  #3  
Old 2006-12-01, 11:57
Haeleth's Avatar
Haeleth Haeleth is offline
Ex-boss
 
Join Date: Mar 2003
Location: England
Posts: 2,106
Default

Just for reference, rlBabel's GetGlyphOutline interception is used for applying custom mappings between the CP932 codespace and Unicode -- i.e. as a way of supporting non-Japanese text in an engine that was designed only to use Japanese text. It's a separate issue from proportional text.
Reply With Quote
  #4  
Old 2006-12-01, 13:38
Rasqual Twilight
Guest
 
Posts: n/a
Default

To zalas: Alas, this is not exactly how it is done.
Basically, the layout engine sees the rendering surface (whole screen in vn mode, message box otherwise) as a grid whose coordinates, and therefore dimensions, are determined once for all at game init using the aforementioned method. I'll see if patching that call and hardcode a constant instead works (CreateFont uses hardcoded "MS Gothic", a font with fixed metrics).

I'm not convinced this is a really good idea though, only by considering people might run Windows with different dpi settings than those commonly used.

OT: さがしものを見つけたか。

To Haeleth: Let's see, if I still follow you, this means possibility to render "out of locale" text? Hmm, sounds interesting.

I'm having a look at the rlBabel source at the moment, it seems it performs a hook on GGO; I suppose I could just hook my call and perform magic tricks (UTF-8>WCHAR, etc.)...
Reply With Quote
  #5  
Old 2006-12-01, 14:36
Haeleth's Avatar
Haeleth Haeleth is offline
Ex-boss
 
Join Date: Mar 2003
Location: England
Posts: 2,106
Default

Yes, by intercepting requests for Shift_JIS character codes, converting them to Unicode via a custom transformation, requesting the Unicode characters, and returning the results to the game - which has no way of realising that it's been given a totally different character from the one it asked for. :)

As for the original problem: if the message window is unavoidably a grid of squares, you might be able to adapt the technique used in rlBabel's tiled_string module (basically, replace the calls that print characters in the grid with calls that render the entire text to a bitmap and then copy squares of that to the grid).

How feasible that would be depends on a lot of factors, of course.
Reply With Quote
  #6  
Old 2006-12-01, 16:00
Rasqual Twilight
Guest
 
Posts: n/a
Default

Given that the call to TextOutA acts on a SJIS string (well, narrow would be a proper term) as a whole and not char by char, it looks clearer now.
There are several references to the import but drawing VN text is centralized at one spot; it seems fairly logical to patch that particular call rather than hooking.
Since I'm not very inclined to distributing a modified executable, I'll enquire into ways of injecting alien code into the process (the CreateProcess/VirtualAllocEx/VirtualProtect etc. gig).
Reply With Quote
  #7  
Old 2006-12-01, 16:15
Haeleth's Avatar
Haeleth Haeleth is offline
Ex-boss
 
Join Date: Mar 2003
Location: England
Posts: 2,106
Default

If it's calling TextOutA on a complete string, then you may be in luck - simply hooking the call to CreateFontA and having it request Arial or whatever instead of MS Gothic might work.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may post new threads
You may post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PS3 game font.. albert1905 General Discussion 2 2021-07-20 23:08
Cyrillic characters in Higurashi MG engine + font borders From Russia with Love Technical Issues 5 2012-01-26 10:04
CLannad problem Font SouYir0 Technical Issues 2 2008-04-12 04:16
Font colors in NScripter? Starchanchan Technical Issues 1 2006-07-22 10:15
Games with bad font DragonmasterX General Discussion 3 2006-02-19 03:12


All times are GMT -8. The time now is 23:49.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2021, vBulletin Solutions, Inc.