New Text Renderer WIP

Want to edit the game, build your own craft and missions? Here you'll find help, tools, guides and people to discuss with.

Re: New Text Renderer WIP

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Sat Apr 11, 2020 5:05 am

Darksaber wrote:
Fri Apr 10, 2020 3:45 pm
Also could the size be adjusted too?
I've done some research into this in the past, and I would say: maybe, with some additional work. So far, it sounds like Jeremy is only touching the process of rendering letters from the font buffer, which holds the data imported from fonts.dat, to the HUD.

Internally, the game has three cached font sizes, which are never scaled (unless the in-game resolution is set less than the real screen resolution, in which case the entire HUD is scaled up by ddraw, rendered characters included). Instead of image scaling, the game picks between the three different font sizes for different elements of the HUD, depending on the HUD scale chosen. At HUD scale >= 1.5, it ends up picking the largest size for all elements - and it's this size that results in font clipping, for reasons I haven't been able to identify. (Even at HUD scales down to 1.25, some elements (such as the name of the targeted craft in the CMD, and radio subtitles & critical messages) are rendered in the largest size, and these don't break.) If the font caches are dynamically allocated (and I think they are, since they seem to be dx objects), it should be possible to render larger fonts to fonts.dat, and Jeremy's new rendering process would hopefully understand the larger sizes and adjust wrapping accordingly. It may also be necessary/desirable to patch the functions that decide which of the three font sizes to use based on HUD scale to reflect the new sizes, so that you still get two different sizes for different HUD elements at HUD scales beyond 1.5.

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Sat Apr 11, 2020 5:05 am

Jaeven wrote:
Sat Apr 11, 2020 4:49 am
ual002 wrote:
Sat Apr 11, 2020 2:43 am

Some of us.. I'm not gonna name names, can read and write it and it might be cool for them.
No way. :shock:
Never underestimate the fandom

User avatar
JeremyaFr
XWAU Member
Posts: 3922
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Apr 11, 2020 8:54 am

blue_max wrote:
Fri Apr 10, 2020 11:45 pm
Also, I don't see Jeremy's commit yet in his repo, so it might be a while before I catch up.
I will publish the source code soon. Maybe today. Unless someone discovers a bug.

User avatar
JeremyaFr
XWAU Member
Posts: 3922
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sat Apr 11, 2020 12:53 pm

UPDATE

Hello,
I've uploaded DDraw dll v1.3.9 with the new text renderer.

I've added 2 settings in DDraw.cfg:

; TextFontFamily = font family
; Set the font family used to render in-flight text
TextFontFamily = Verdana

; TextWidthDelta = delta
; Set the delta added to the character width
TextWidthDelta = 0

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Sat Apr 11, 2020 9:21 pm

Wait, so you can pick the font in the cfg? When you said this isn't a replacement for fonts.dat, I took that to mean "this isn't a replacement for the game's use of an external pre-rendered font file". Did I misunderstand, and what you actually meant was "this isn't a new font file replacing the current font file; it's something completely new"?

User avatar
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Sat Apr 11, 2020 10:52 pm

you may have missed this Keiran
JeremyaFr wrote:
Fri Apr 10, 2020 2:53 pm
Hello,

This is NOT a replacement of "Fonts.dat".

The function in the exe that draws the text is hooked.
Then the text is drawn in DDraw.dll using Direct2D and DirectWrite.
And yes you can pick any font you like, I've tested a few :)
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Sat Apr 11, 2020 11:17 pm

Darksaber wrote:
Sat Apr 11, 2020 10:52 pm
you may have missed this Keiran
JeremyaFr wrote:
Fri Apr 10, 2020 2:53 pm
Hello,

This is NOT a replacement of "Fonts.dat".

The function in the exe that draws the text is hooked.
Then the text is drawn in DDraw.dll using Direct2D and DirectWrite.
And yes you can pick any font you like, I've tested a few :)
Far from missing it, this is precisely the statement I was talking about!

I originally read: "This is NOT a replacement of 'Fonts.dat'." => "this isn't a replacement for the game's use of an external pre-rendered font file" i.e., "this isn't a replacement for the fonts.dat system; this is an update to the way fonts.dat is used".

But it seems now what was meant was: "this isn't [merely] a new font file replacing the current font file; it's something completely new", i.e., "This isn't a replacement for the fonts.dat file; this is a replacement for the entire fonts.dat system".

I was just seeking confirmation. From Jeremy. :kopfwand:

User avatar
Darksaber
Vice Admiral
Posts: 10931
Joined: Mon Jan 10, 2000 12:01 am
Contact:

Post by Darksaber » Sat Apr 11, 2020 11:27 pm

Hmm.. ok sorry I mentioned it :handjob: :ua_fuck:
“You can please some of the people all of the time, you can please all of the people some of the time, but you can’t please all of the people all of the time”.”
- John Lydgate

Good Things Come To Those Who Wait....
Darksaber's X-Wing Station

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Sun Apr 12, 2020 12:15 am

Other questions for Jeremy:

So, how does it work? I expect you're generating the font caches using system font calls at game/mission load time, and then, during flight, rendering from those caches to the HUD texture using DX calls?

Also, why does it need to be done in ddraw.dll? Can regular hooks not make DX calls?

EDIT: Question for a mod: How to make D X not come out as a smilie?

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Sun Apr 12, 2020 1:46 am

ATTN: Unnamed people whom ual002 alleges can read and would like to try playing in Aurebesh:

flightscreen17.png

(That's with HUD scale = 2.0, btw, for visibility.)
You do not have the required permissions to view the files attached to this post.

User avatar
ual002
XWAU Member
Posts: 983
Joined: Wed Sep 24, 2008 2:23 am

Post by ual002 » Sun Apr 12, 2020 2:03 am

FANTASTIC. See at least its a stupid option for us stupid nerds. I mean... other people, not me.
Image Image Image Image Image

User avatar
ual002
XWAU Member
Posts: 983
Joined: Wed Sep 24, 2008 2:23 am

Post by ual002 » Sun Apr 12, 2020 2:11 am

So now we need a modeler to get us a suite of Mandal Motors fighters from Rebels and TCW, then I guess Mando'a would be an optional font too, hehe. However those nerds have been arguing about the font/language for a while.
Image Image Image Image Image

User avatar
JeremyaFr
XWAU Member
Posts: 3922
Joined: Mon Jan 18, 2010 5:52 pm
Contact:

Post by JeremyaFr » Sun Apr 12, 2020 8:45 am

When I say
This is NOT a replacement of "Fonts.dat"
I mean that this is not a new "Fonts.dat" file.
This is a new method to render the text.

When the game asks to draw a char, the char and related data (position, size, color) are pushed to a buffer. Then at the end of each frame, the text present in the buffer is rendered and the buffer is cleared.

You can see the source code here:
Add text renderer

User avatar
JaggedFel
Galactic Empire
Posts: 434
Joined: Wed Sep 06, 2006 11:01 pm
Contact:

Post by JaggedFel » Sun Apr 12, 2020 12:26 pm

Driftwood wrote:
Fri Apr 10, 2020 2:10 pm
Could always give an option for arubesh for lore adherent masochists :p

Would be neat to have for immersion if bit impractical.
I can't find it right now, but somewhere I've got screenshots for when I did this as well. I've got a font editor utility, and I've replaced all of the fonts in the game before, TIE and XvT as well. Used to fly like that for quite a while. I don't use the reversed characters for "caps" like Keiran's picture, though.
Ye Olde Galactic Empire Mission Editor v1.15.6
Current software WIPs: TIE Layout and Cutscene Editor, TIE/XvT Cockpit Editor
Libraries / Format specs: *.tie, *.plt, *.tfr, *.lfd , *.act, *.dat image files, *.fnt

User avatar
ual002
XWAU Member
Posts: 983
Joined: Wed Sep 24, 2008 2:23 am

Post by ual002 » Sun Apr 12, 2020 12:51 pm

JaggedFel wrote:
Sun Apr 12, 2020 12:26 pm
I don't use the reversed characters for "caps" like Keiran's picture, though.
That's a little annoying, yeah.
Image Image Image Image Image

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Sun Apr 12, 2020 3:53 pm

Sorry, I just grabbed an Aurebesh font on the web. Find your own font if you don't like it.

User avatar
DTM
Fleet Admiral (Administrator)
Posts: 2119
Joined: Tue Apr 22, 2003 11:01 pm
Contact:

Post by DTM » Sun Apr 12, 2020 6:09 pm

I use this font in the new active cockpits. Maybe you like to have the same font...
https://www.dafont.com/aurebesh-english.font

User avatar
Driftwood
Admiral (Moderator)
Posts: 2174
Joined: Wed Oct 22, 2003 11:01 pm
Contact:

Post by Driftwood » Sun Apr 12, 2020 6:15 pm

ual002 wrote:
Sun Apr 12, 2020 2:03 am
FANTASTIC. See at least its a stupid option for us stupid nerds. I mean... other people, not me.
Liar.

Anybody smell burning pants?

Not practical, but it's a nice option.
DTM wrote:
Sun Apr 12, 2020 6:09 pm
I use this font in the new active cockpits. Maybe you like to have the same font...
https://www.dafont.com/aurebesh-english.font
This is definitely a happy medium I'll probably use myself.

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Tue Apr 14, 2020 7:41 pm

I'm catching up with Jeremy's new text renderer. I'll release a preview this week:
Dynamic-Cockpit-Aurebesh.jpg
You do not have the required permissions to view the files attached to this post.

User avatar
Ace Antilles
Admiral (Moderator)
Posts: 7829
Joined: Sat Jan 22, 2000 12:01 am
Contact:

Post by Ace Antilles » Tue Apr 14, 2020 7:46 pm

Brilliant! Can't wait for the nicer font and the cockpits together :)
Just don't default it to Aurebesh ;)
Chief XWAU Team annoying nitpicker.
Ace Antilles - The X-Wing Outpost
Image

User avatar
ual002
XWAU Member
Posts: 983
Joined: Wed Sep 24, 2008 2:23 am

Post by ual002 » Tue Apr 14, 2020 8:19 pm

Yeah, agreed. While I advocate for the option of Aurebesh, I absolutely agree it should be an option, and not the default one for sure.
Image Image Image Image Image

User avatar
keiranhalcyon7
Lieutenant JG
Posts: 599
Joined: Tue Jan 02, 2018 6:41 am

Post by keiranhalcyon7 » Tue Apr 14, 2020 8:34 pm

It's getting the font by name using an OS call. The default is Verdana, but you can use any font installed on your system. If the OS can't find the font you've named in the .cfg, it appears to default to Verdana.

User avatar
Vince T
Fleet Admiral (Administrator)
Posts: 14045
Joined: Fri Apr 27, 2001 11:01 pm
Contact:

Post by Vince T » Tue Apr 14, 2020 9:23 pm

Wow that's incredible!
Your ship, Captain. I need a drink. - Vince Trageton
Vince T's X-Wing HQ - where the bad guys get their gear

User avatar
blue_max
XWAU Member
Posts: 2295
Joined: Wed Mar 20, 2019 5:12 am

Post by blue_max » Wed Apr 15, 2020 9:10 pm

The latest update posted here: https://xwaupgrade.com/phpBB3/viewtopic ... 91#p165191 adds support for Jeremy's text renderer to the VR mod.

User avatar
Ace Antilles
Admiral (Moderator)
Posts: 7829
Joined: Sat Jan 22, 2000 12:01 am
Contact:

Post by Ace Antilles » Wed Apr 15, 2020 9:44 pm

blue_max wrote:
Wed Apr 15, 2020 9:10 pm
The latest update posted here: https://xwaupgrade.com/phpBB3/viewtopic ... 91#p165191 adds support for Jeremy's text renderer to the VR mod.
Image


Yay! More cool improvements
Chief XWAU Team annoying nitpicker.
Ace Antilles - The X-Wing Outpost
Image

Post Reply