Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
aJynks

Adding Custom Font (new font, not overwriting other fonts)

Recommended Posts

Little confused about adding new fonts to gzDoom.

 

My understanding is I make a export of all the font glyphs and then use unicode i a fontdef to define the font.... 

 

I found an all called FontForge, than can export a installed font on windows as individual PNP image for each glyph. The thing is that it exports them all slightly different sizes.. maybe that is ok as doom places them form the mid point or something so different sizes will make a "g" hang lower and a "F" higher than a "m". What about the background colour? What colour should be set to be "removed". Or is the png supposed to be transparent?

 

EDIT : I did find that app "UDFC_TEST_KOREANS"... but while it looks like it works fine.. most of the fonts on my system do not show up in the list to choose?

Edited by aJynks

Share this post


Link to post

You can go two ways with making fonts

1. the difficult way as in Hindsight2020's map Hindsight.pk3 , which has individual images for each letter. The bonus for that is you get exactly what your artistic vision guides you to.
Download the pwad and inspect with Slade3.

2. the easy way would be by using BagHeadSpidey's DoomFont Generator , which is a frontend for ZDoom's Imagetool. The advantage is to have a vast selection of downloadable TTF fonts, for example DaFont.com

 

It's a two-step process

  1. create a pcx image of the font, font.pcx
  2. create a lump from the image, font.lmp

Then in a script specify Hudmessage

 

Quote

 

include "zcommon.acs"
// ===================================

script 2 OPEN
{
    SetFont (const:"PATH");
    SetHudSize(640, 480, 0);
    
    HudMessage(s:"ABCDEFG\n",
               s:"HIJKLMN\n",
               s:"OPQRSTU\n",
               s:"VWXYZ\n\n",
               s:"abcdefg hijklmn opqrstu vwxyz\n\n",
               s:"12345 67890";
       HUDMSG_PLAIN, 0, 4, 350.0, 250.0, 25.0);
}
// ====================================

 


 

 

Share this post


Link to post

For reference, you can open GZDoom's game_support.pk3 in SLADE, then look at filter/doom.id/fonts/, and see how it's made. One folder per font, one image file per character, and a font.inf file that contains optional information about font height and kerning.

 

And yes, transparent parts should be transparent.

 

For fonts that have both ascenders and descenders, use image offsets to align them. Example, in filter/game-heretic/fonts/defbigfont, you can compare 0145.lmp with 0.147.lmp. Set SLADE to display graphics as sprites (little drop-down widget next to offset boxes). Then move up and down between those two and note how the "n" doesn't move, because 0145's offset of -4 makes it move down to compensate for its lack of ascender.

Edited by Gez

Share this post


Link to post

Thanks guys!!

 

5 hours ago, Kappes Buur said:

1. the difficult way as in Hindsight2020's map Hindsight.pk3 , which has individual images for each letter. The bonus for that is you get exactly what your artistic vision guides you to.


Download the pwad and inspect with Slade3.

 

this link dose not seem to work?

 

If anyone has a file with an example of a custom  font I can look at, that would be awesome. Thanks!

Edited by aJynks

Share this post


Link to post
39 minutes ago, aJynks said:

If anyone has a file with an example of a custom  font I can look at, that would be awesome. Thanks!

 

3 hours ago, Gez said:

For reference, you can open GZDoom's game_support.pk3 in SLADE

 

Share this post


Link to post

<doomworld seemed to have some kind of reboot or something, and my post was screwed up.. just going to edit this out and post again when it is back up and responsive>

Edited by aJynks

Share this post


Link to post

More Questions

  1. With these unicode fonts, can you still use the colour options in the Draw command? Or are they only able to be the colour of the actual bitmap? As in if you want more colours do you need to duplicate the entire font in those colours? So if I want a red and a yellow version, I need to make two entire versions of the font? One for each colour?
  2. I found this cool mod : Custom Text Colour PK3 :: 260 New Colours! (@zandronum). It is for having more colour text options for deathmatch. Can these be used in normal doom wads? As extra colours?
  3. On the Unicode Font @zDoomWiki it says "Place all of the images under the /fonts/<yourfontname>/ folder in your PK3 archive. This way your font will be accessible everywhere with the name you gave to the folder." Dose this mean that you do not need to do any coding at all. Simply putting the font into the correct directory and everything will make it available via the directoryName? As in I could access it with something like this?
class drawTest : EventHandler {
    override void RenderOverlay(RenderEvent c) {
        String stringTest = String.Format("This is a string test");

        HUDFont myfont = HUDFont.Create(directoryName);

        Statusbar.BeginHUD();
        Statusbar.DrawString(myfont, stringTest, (53,-43),
            Statusbar.DI_SCREEN_LEFT_BOTTOM | Statusbar.DI_TEXT_ALIGN_RIGHT,
            Font.CR_RED);
    }
}

 

18 hours ago, aJynks said:

I did find that app "UDFC_TEST_KOREANS"... but while it looks like it works fine.. most of the fonts on my system do not show up in the list to choose?


I found out that the app will only read fonts installed to ALL USERS. Windows 11 obfuscates how to do this, which is a pain. 

 

Move Fonts from Users, into All Users

  • Navigate to your user font folder : C:\Users\<YourUsername>\AppData\Local\Microsoft\Windows\Font
  • Select the fonts you wish to move to All Users.
  • Right Click, but DO NOT click "Install".
  • Instead click : Show More Options
  • You should see a different install option in the context menu : Install for All Users
  • The Font is now installed into All Users.
  • Follow the same steps for newly downloaded fonts.

 

13 hours ago, Gez said:

For reference, you can open GZDoom's game_support.pk3 in SLADE, then look at filter/doom.id/fonts/, and see how it's made. One folder per font, one image file per character, and a font.inf file that contains optional information about font height and kerning.


I'm so sorry, somehow I totally missed this reply yesterday! 

Share this post


Link to post
2 minutes ago, aJynks said:
  • With these unicode fonts, can you still use the colour options in the Draw command?

Yes of course.

2 minutes ago, aJynks said:

Cf. Print. Custom colors can be used in text if you use the code \c[colorname].

2 minutes ago, aJynks said:
  • On the Unicode Font @zDoomWiki it says "Place all of the images under the /fonts/<yourfontname>/ folder in your PK3 archive. This way your font will be accessible everywhere with the name you gave to the folder." Dose this mean that you do not need to do any coding at all. Simply putting the font into the correct directory and everything will make it available via the directoryName? As in I could access it with something like this?

Anything that needs a font name can use the directory name. Essentially, the directory is a font.

Share this post


Link to post
Spoiler

0000.png
0001.png
0002.png
0003.png
0004.png
0005.png
0006.png
0007.png
0008.png
0009.png
000A.png
000B.png
000C.png
000D.png
000E.png
000F.png
0010.png
0011.png
0012.png
0013.png
0014.png
0015.png
0016.png
0017.png
0018.png
0019.png
001A.png
001B.png
001C.png
001D.png
001E.png
001F.png
0020.png
0021.png
0022.png
0023.png
0024.png
0025.png
0026.png
0027.png
0028.png
0029.png
002A.png
002B.png
002C.png
002D.png
002E.png
002F.png
0030.png
0031.png
0032.png
0033.png
0034.png
0035.png
0036.png
0037.png
0038.png
0039.png
003A.png
003B.png
003C.png
003D.png
003E.png
003F.png
0040.png
0041.png
0042.png
0043.png
0044.png
0045.png
0046.png
0047.png
0048.png
0049.png
004A.png
004B.png
004C.png
004D.png
004E.png
004F.png
0050.png
0051.png
0052.png
0053.png
0054.png
0055.png
0056.png
0057.png
0058.png
0059.png
005A.png
005B.png
005C.png
005D.png
005E.png
005F.png
0060.png
0061.png
0062.png
0063.png
0064.png
0065.png
0066.png
0067.png
0068.png
0069.png
006A.png
006B.png
006C.png
006D.png
006E.png
006F.png
0070.png
0071.png
0072.png
0073.png
0074.png
0075.png
0076.png
0077.png
0078.png
0079.png
007A.png
007B.png
007C.png
007D.png
007E.png
007F.png
0080.png
0081.png
0082.png
0083.png
0084.png
0085.png
0086.png
0087.png
0088.png
0089.png
008A.png
008B.png
008C.png
008D.png
008E.png
008F.png
0090.png
0091.png
0092.png
0093.png
0094.png
0095.png
0096.png
0097.png
0098.png
0099.png
009A.png
009B.png
009C.png
009D.png
009E.png
009F.png
00A0.png
00A1.png
00A2.png
00A3.png
00A4.png
00A5.png
00A6.png
00A7.png
00A8.png
00A9.png
00AA.png
00AB.png
00AC.png
00AD.png
00AE.png
00AF.png
00B0.png
00B1.png
00B2.png
00B3.png
00B4.png
00B5.png
00B6.png
00B7.png
00B8.png
00B9.png
00BA.png
00BB.png
00BC.png
00BD.png
00BE.png
00BF.png
00C0.png
00C1.png
00C2.png
00C3.png
00C4.png
00C5.png
00C6.png
00C7.png
00C8.png
00C9.png
00CA.png
00CB.png
00CC.png
00CD.png
00CE.png
00CF.png
00D0.png
00D1.png
00D2.png
00D3.png
00D4.png
00D5.png
00D6.png
00D7.png
00D8.png
00D9.png
00DA.png
00DB.png
00DC.png
00DD.png
00DE.png
00DF.png
00E0.png
00E1.png
00E2.png
00E3.png
00E4.png
00E5.png
00E6.png
00E7.png
00E8.png
00E9.png
00EA.png
00EB.png
00EC.png
00ED.png
00EE.png
00EF.png
00F0.png
00F1.png
00F2.png
00F3.png
00F4.png
00F5.png
00F6.png
00F7.png
00F8.png
00F9.png
00FA.png
00FB.png
00FC.png
00FD.png
00FE.png
00FF.png

 

I've made the font files... they look like this...

TDNaywY.png

This is a png file I have coloured blue to make it more visible... the actual ones are white. 

 

I've placed them in ./fonts/infofont

Ive not made the textfile yet as my understanding is it is optional if you want specific kerning and stuff. I did try just using this as a test

Kerning -1
FontHeight 16

font.ini in the font's folder.

 

So now I am sorta stuck on how to actually define this... I'm not really understanding how to use the information on the zWiki and zdoom-docs.github.io. There are no examples. Like the font thing literally only says

 

Quote

 

To add a Unicode font, follow these steps:

Generate a series of PNG images where each image represents one glyph of the font. This can be done with a font generator, like this one.

Make sure the name of each image is the Unicode codepoint of the character it represents, in hexadecimal notation. For example the image with the glyph for Latin Capital Letter A must be named 0041.png; glyph with the number 1 should be named 0031.png, and so on. If you're using a font generator, it should take care of this automatically.

Place all of the images under the /fonts/<yourfontname>/ folder in your PK3 archive.

 

 

it dose not say anything about how it is defined, or used.

 

I tried modifying my draw test code... but it says that the font dose not exist.

 

class testText : EventHandler {
    override void RenderOverlay(RenderEvent c) {
        String orbsString = String.Format("This is a test");

        //HUDFont myfont = HUDFont.Create(smallfont);
        HUDFont myfont = HUDFont.Create(infofont);
        
        Statusbar.DrawString(myfont, "This is a Testing", (53,-43),
        Statusbar.DI_SCREEN_LEFT_BOTTOM | Statusbar.DI_TEXT_ALIGN_RIGHT,
        Font.CR_RED);
        
    }
}

It works fine with the default smallfont... 

 

Files : testFont.rar @ufile.io (free anonymous file share website)

Share this post


Link to post

seems that "Font.GetFont("infofont")" works....

HUDFont myfont = HUDFont.Create(Font.GetFont("infofont"));

Share this post


Link to post

Is there a way to scale the font in doom on draw? Without scaling the actual images?

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×