Generating JK2 font from .ttf

Discussions about modding, questions, mod requests or just show off what you're working on.
User avatar
Tr!Force
Posts: 433
Joined: 26 Feb 2015, 12:25
Location: Chile
Contact:

Re: Generating JK2 font from .ttf

Post by Tr!Force »

fau wrote:No, they are not:

Code: Select all

		s = CG_GetStripEdString("INGAMETEXT", "SERVER_CHANGING_MAPS");	// s = "Server Changing Maps";
		w = CG_DrawStrlen( s ) * BIGCHAR_WIDTH;
		CG_DrawBigString( 320 - w/2, 100, s, 1.0F);
CG_DrawBigString, CG_DrawStringExt, CG_DrawChar and Co are left-over from q3arena without TA expansion, where printing text was handled exclusively by cgame/ui code (there wasn't renderer/tr_font.cpp). Aparently q3 and jk2 devs didn't care enough to replace them with CG_Text_Paint in more obscure places. I'm going to do this in next patch, just need to decide what font/fonts to use.
i see, what about the same font of the console? can be used? is the most similar font i think
Image
"The dark side? I've been there. Do your worst." - Kyle Katarn
  • JK2 & JK3 Code-Mod Developer
  • Jedi Knight Plus Mod Project: Click Here
  • E-Mail: triforce@gznetwork.com
  • Discord: TriForce#8785
User avatar
fau
Staff
Posts: 433
Joined: 16 Aug 2015, 01:01
Location: Warsaw / Poland
Contact:

Re: Generating JK2 font from .ttf

Post by fau »

It is the same font.
User avatar
Tr!Force
Posts: 433
Joined: 26 Feb 2015, 12:25
Location: Chile
Contact:

Re: Generating JK2 font from .ttf

Post by Tr!Force »

fau wrote:It is the same font.
oh i see, what about converting the console font (or search the same font) and convert like the others to show properly? i think "replacing" with another existing font isnt a good idea, the only similar font is ergoec, but is not lighter like the console one...
Image
"The dark side? I've been there. Do your worst." - Kyle Katarn
  • JK2 & JK3 Code-Mod Developer
  • Jedi Knight Plus Mod Project: Click Here
  • E-Mail: triforce@gznetwork.com
  • Discord: TriForce#8785
User avatar
fau
Staff
Posts: 433
Joined: 16 Aug 2015, 01:01
Location: Warsaw / Poland
Contact:

Re: Generating JK2 font from .ttf

Post by fau »

I'm not going to waste my time hand-crafting such a terrible font. You wont find a similiar one because, as I wrote earlier
charsgrid_med.tga is some sort of badly monospaced, condensed helvetica clone with terrible non-ascii glyphs.
It was manually monospaced (from non-monospace helvetica or similar) by whoever produced charsgrid_med. Just have a look at i, l, non-ascii chars, j (wtf) and overall kerning. If you want to see how monospaced helvetica should look, here: https://www.myfonts.com/fonts/linotype/ ... onospaced/

I'll make it a separate patch so you can stick with the old one if you don't like what I come up with.
User avatar
Tr!Force
Posts: 433
Joined: 26 Feb 2015, 12:25
Location: Chile
Contact:

Re: Generating JK2 font from .ttf

Post by Tr!Force »

fau wrote:I'm not going to waste my time hand-crafting such a terrible font. You wont find a similiar one because, as I wrote earlier
charsgrid_med.tga is some sort of badly monospaced, condensed helvetica clone with terrible non-ascii glyphs.
It was manually monospaced (from non-monospace helvetica or similar) by whoever produced charsgrid_med. Just have a look at i, l, non-ascii chars, j (wtf) and overall kerning. If you want to see how monospaced helvetica should look, here: https://www.myfonts.com/fonts/linotype/ ... onospaced/

I'll make it a separate patch so you can stick with the old one if you don't like what I come up with.
i understand...

ive seen an alternative open font to monospace, its very similar too i think: https://www.google.com/fonts/specimen/Inconsolata
Image
"The dark side? I've been there. Do your worst." - Kyle Katarn
  • JK2 & JK3 Code-Mod Developer
  • Jedi Knight Plus Mod Project: Click Here
  • E-Mail: triforce@gznetwork.com
  • Discord: TriForce#8785
User avatar
fau
Staff
Posts: 433
Joined: 16 Aug 2015, 01:01
Location: Warsaw / Poland
Contact:

Re: Generating JK2 font from .ttf

Post by fau »

Gonna try few things and ask for your opinions.
First goes reusing ergoec and ocr_a fonts:
shot0006.jpg
shot0006.jpg (214.57 KiB) Viewed 112048 times
shot0004.jpg
shot0004.jpg (204.17 KiB) Viewed 112048 times
Imo ergoec looks great and ocr_a... strange at first, but I got used to already :-) This "snc" looks bad. Gonna make high-res ocr_a less bold, I overdone it.
Haven't done a team overlay yet.
User avatar
Tr!Force
Posts: 433
Joined: 26 Feb 2015, 12:25
Location: Chile
Contact:

Re: Generating JK2 font from .ttf

Post by Tr!Force »

yeh, was strange at first, i had to check the height between lines, the first time was :shock: but looks fine, the font is little bit "stronger" but nothing weird, is just fine. but if u want know my personal opinion, i preffer a lighter font for those, so much "strong" fonts on the screen are a little bit annoying sometimes.

anyways, everychange is better as the original one :lol:
Image
"The dark side? I've been there. Do your worst." - Kyle Katarn
  • JK2 & JK3 Code-Mod Developer
  • Jedi Knight Plus Mod Project: Click Here
  • E-Mail: triforce@gznetwork.com
  • Discord: TriForce#8785
User avatar
Boothand
Administrator
Posts: 986
Joined: 24 Feb 2015, 08:21
Contact:

Re: Generating JK2 font from .ttf

Post by Boothand »

That looks great!
User avatar
fau
Staff
Posts: 433
Joined: 16 Aug 2015, 01:01
Location: Warsaw / Poland
Contact:

Re: Generating JK2 font from .ttf

Post by fau »

Tr!Force wrote:yeh, was strange at first, i had to check the height between lines, the first time was :shock: but looks fine, the font is little bit "stronger" but nothing weird, is just fine. but if u want know my personal opinion, i preffer a lighter font for those, so much "strong" fonts on the screen are a little bit annoying sometimes.
It's not positioned perfectly yet, I will take care of it when I choose a font. You're right that a lighter font may be more fitting for these. Here is a bunch of samples, please review them and tell me what you think.
Attachments
font-samples.zip
(1.88 MiB) Downloaded 1655 times
User avatar
Tr!Force
Posts: 433
Joined: 26 Feb 2015, 12:25
Location: Chile
Contact:

Re: Generating JK2 font from .ttf

Post by Tr!Force »

inconsolata is a good one, same with source code pro, but i think these fonts are very similar as the base one ocr_a, what do think? in that case would be better to use the base once ocr_a? to keep the "jk2 game font style" untouch? idk how looks with the anothers messages, like the vote message. :o or if u want,

EDIT: anyways i will look for a font exactly like the charsgrid_med because all fonts u show, are "serif" style, and the charsgrid one is "non-serif" ;)
Image
"The dark side? I've been there. Do your worst." - Kyle Katarn
  • JK2 & JK3 Code-Mod Developer
  • Jedi Knight Plus Mod Project: Click Here
  • E-Mail: triforce@gznetwork.com
  • Discord: TriForce#8785
User avatar
fau
Staff
Posts: 433
Joined: 16 Aug 2015, 01:01
Location: Warsaw / Poland
Contact:

Re: Generating JK2 font from .ttf

Post by fau »

They are all sans-serif but if you can find something closer - sure, send it to me. I'll make other screenshots when we narrow it down a little. My personal favorites are Bitstream Vera and ergoec. Keep in mind that charsgrid_med glyphs are rendered as 16 x 16px in these texts, may be impossible to find something this wide (besides some ancient bitmap console fonts).
User avatar
fau
Staff
Posts: 433
Joined: 16 Aug 2015, 01:01
Location: Warsaw / Poland
Contact:

Re: Generating JK2 font from .ttf

Post by fau »

Ok, so how do we proceed with this? Finding a fitting font replacement is really not my thing and it has succesfully discouraged me from continuing work so far. Maybe someone with more typographic design experience could help us on this?

Here is the current situation:
charsgrid_med font is a terrible helvetica clone made fit into monospace glyphs and without descends (sic!). It's used in few places:
* In client (can't change that): in console (but it's never scaled there so it looks ok-ish), when you type a message after /say command family and in few hardcoded places.
* In cgame/ui eg. "Waiting for players", "Server changing map" (glyphs are stretched to 16x16 px), in fps counter, timer, callvote message and on team overlay.

Screenshots I made don't look good. I think we should just drop the whole "monospace" idea and go for a nice looking font, fitting ergoe and "a new hope" fonts used elsewhere. Tr!force says it should be a thiner face for a change and I agree.

I tried few Helvetica clones and they look bad and generic. Here are few other attempts, I don't like them neither. Just give me a font name and I will make a screenshot.
Attachments
ubuntu.jpg
ubuntu.jpg (135.04 KiB) Viewed 111990 times
tex_gyre_adventor.jpg
tex_gyre_adventor.jpg (132.08 KiB) Viewed 111990 times
pt_sans.jpg
pt_sans.jpg (137.42 KiB) Viewed 111990 times
User avatar
Tr!Force
Posts: 433
Joined: 26 Feb 2015, 12:25
Location: Chile
Contact:

Re: Generating JK2 font from .ttf

Post by Tr!Force »

im doing some tests trying some fonts. so i tested them streching like jk2 does. (also i added how is non streched)

Note: some of these arent fixed-width, that is a problem? the font NEED to be fixed-width to match the jka font converter? maybe we can use one of these if doesnt, but if is requiried to be fixed-width i can convert the font to work properly.

Some examples:
example2.png
example2.png (678.62 KiB) Viewed 111974 times
Open Sans Bold
Free sans bold
Roboto Bold
AE AlMothnna Bold
Image
"The dark side? I've been there. Do your worst." - Kyle Katarn
  • JK2 & JK3 Code-Mod Developer
  • Jedi Knight Plus Mod Project: Click Here
  • E-Mail: triforce@gznetwork.com
  • Discord: TriForce#8785
User avatar
fau
Staff
Posts: 433
Joined: 16 Aug 2015, 01:01
Location: Warsaw / Poland
Contact:

Re: Generating JK2 font from .ttf

Post by fau »

Hmm so non-monospace font, stretched to the old charsgrid_med size? Looks good to me. The fact that in some places it's used stretched like this and in some others it's non-stretched (half the width of this) may be an issue. Gonna look into this, thanks.

I think we actually SHOULD use non-fixed width font. It will look better and console sticks to charsgrid_med anyway. Numbers are usually same width too in regular fonts.
User avatar
fau
Staff
Posts: 433
Joined: 16 Aug 2015, 01:01
Location: Warsaw / Poland
Contact:

Re: Generating JK2 font from .ttf

Post by fau »

There is no way to stretch fonts rendered by tr_font.cpp vertically, so I'd need to include two font sets for wide (16x16) and normal (16x8) glyphs.
I used TeX Gyre Heros eventually, glyph shapes fit just perfectly.
Compare to original here: http://jk2world.net/files/fonts/compare.html
I may make space a little wider for even better fit.
Do you think it's good enough?
User avatar
fau
Staff
Posts: 433
Joined: 16 Aug 2015, 01:01
Location: Warsaw / Poland
Contact:

Re: Generating JK2 font from .ttf

Post by fau »

Ok, was lazing around again :P
charsgrid_med (aka BIGCHAR/SMALLCHAR) due to multiple issues can't be properly improved. if you want to make it sharper I'd recommend replacing it with CG_Text_ functions and another font in your mod. TeX Gyre Heros and Nimbus Sans L match very well, although they are not monospace. I wrote partial patches for doing it (it's straightforward with exception of teamoverlay), but I'd rather leave it as it is for now.


In the attachments section (and on github), there is a 1.04 patch allowing your mod to use high resolution fonts when they are available. In case they are not - it defaults back to the original behaviour. Applying it to your mod should be enough, unless you used low-level trap_R_Font_ and MenuFontToHandle functions instead of CG_Text_
It introduces a single new cvar: ui_fontSharpness. You can disable hi-res fonts by setting it to 0, or make them not-so-sharp by setting it somewhere between 0 and 1 if you like.

There is a pk3 with fonts themselves attached below. They should be good enough up to 4k resolutions. They are independent of the patch and can be updated, modified and reused by multiple mods so I recommend shipping them as separate pk3.

I'll add a simple description how to accomodate your mod in "Tutorials" section once they get some testing, should be pretty easy and painless for all mods under active development.

Gonna add some screenshots later, but you've seen them already in the topic.

PS I had a quick look at 1.02 code and you'll need to reimplement CG_Text_ functions there.
Attachments
1.04hi-res-fonts-patch.zip
(4.96 KiB) Downloaded 1694 times
hi-res-fonts.pk3
(669.03 KiB) Downloaded 1618 times
User avatar
fau
Staff
Posts: 433
Joined: 16 Aug 2015, 01:01
Location: Warsaw / Poland
Contact:

Re: Generating JK2 font from .ttf

Post by fau »

1920x1200 screenshots:

Image Image Image Image Image Image
Last edited by fau on 10 Feb 2016, 22:00, edited 2 times in total.
User avatar
Boothand
Administrator
Posts: 986
Joined: 24 Feb 2015, 08:21
Contact:

Re: Generating JK2 font from .ttf

Post by Boothand »

Makes quite a difference
User avatar
fau
Staff
Posts: 433
Joined: 16 Aug 2015, 01:01
Location: Warsaw / Poland
Contact:

Re: Generating JK2 font from .ttf

Post by fau »

Hold your horses, I think there is a bug!
edit: Yeah, it was using only the smallest font in-game. Last minute change :(
edit2: OK, so the patch is good, pk3 with fonts is good, just screenshots are wrong. gonna remake them in a moment. Sry for confusion, I mixed up my branches :P
Last edited by fau on 10 Feb 2016, 21:40, edited 1 time in total.
User avatar
Daggolin
Administrator
Posts: 794
Joined: 23 Feb 2015, 13:05

Re: Generating JK2 font from .ttf

Post by Daggolin »

That looks nice. :D
User avatar
fau
Staff
Posts: 433
Joined: 16 Aug 2015, 01:01
Location: Warsaw / Poland
Contact:

Re: Generating JK2 font from .ttf

Post by fau »

Screenshots fixed, enjoy!

Amazing map btw, who made it? Looks like Hexes's style.

edit: Apparently it was made by a guy named Starrunner back in 2002, props to him :-)
User avatar
ouned
Administrator
Posts: 596
Joined: 23 Feb 2015, 13:03
Location: Gliese581c

Re: Generating JK2 font from .ttf

Post by ouned »

looks really nice
User avatar
Tr!Force
Posts: 433
Joined: 26 Feb 2015, 12:25
Location: Chile
Contact:

Re: Generating JK2 font from .ttf

Post by Tr!Force »

wow, really impresive! well done dude :P

im really busy this month with office work projects, i will try this in march.

seeing these screenshots makes me very impatient :shock:
Image
"The dark side? I've been there. Do your worst." - Kyle Katarn
  • JK2 & JK3 Code-Mod Developer
  • Jedi Knight Plus Mod Project: Click Here
  • E-Mail: triforce@gznetwork.com
  • Discord: TriForce#8785
User avatar
Kazuka
Moderator
Posts: 260
Joined: 10 Aug 2015, 20:30

Re: Generating JK2 font from .ttf

Post by Kazuka »

Very well! :)
User avatar
fau
Staff
Posts: 433
Joined: 16 Aug 2015, 01:01
Location: Warsaw / Poland
Contact:

Re: Generating JK2 font from .ttf

Post by fau »

Forgot to mention that the same high resolution fonts are in jk2mv already and will be available in next release, so cgame/ui patches I posted earlier are obsolete. I've got something coming for charsgrid font too.
Post Reply
Created by Matti from StylesFactory.pl and Warlords of Draenor (modified by jk2.info)
Powered by phpBB® Forum Software © phpBB Limited
 

 

cron