Post Reply 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PSP Font Auto-Generate from TTF
02-28-2014, 06:10 PM (This post was last modified: 03-02-2014 08:30 PM by Bighead.)
Post: #1
PSP Font Auto-Generate from TTF
I'm a little surprised I haven't seen anything like this yet. I'm sure some have heard of the program ttf2pgf which converts TTF fonts to the PGF format that PSP uses, but its usage is cumbersome to say the least and not very user friendly. It's pretty simple to convert a single font to a single PGF, but creating a whole set is not so easy. I also found a program called CTFtool GUI but I honestly did not care for it, and the functionality of it is limited in comparison.

Anyway, to the point: I have created a batch script for ttf2pgf that generates the entire set in one go, and allows easy configuration to manipulate all the options that the program offers. To use it, copy the font to the folder and run "GenerateFontSet.bat". It will scan for "font.ttf" or you can specify your own name. The rest of the options will present themselves. You can alter the height, horizontal scale, shadows, etc.. of the font, and it will output the set to a "font" folder that is ready to be copied to a PSP or the PPSSPP emulator.

Some combinations will cause ttf2pgf to fail, and not all the fonts will be generated. This seems to happen when the height and spacing are too small and collide in some manner. Generally though, I have tested it with over a dozen fonts and countless combinations and it seems to work well. I am referring to it as ttf2pgf+ because of the added functionality (although I take no actual credit for the program itself).

ttf2pgf+ - Download it Here!

The program came with a file "mkfontset" that I honestly had no idea how to use or even what language it was in. The batch is based off that file. I have also included a more up-to-date version of cygwin1.dll that seems to have sped up the conversion process by about 75% than the version included with the program. I am also including a screenshot of it in action.

For those who are just looking for a nice font to replace the bulky PPSSPP font, you can try this one based on the free font "Union". All the text actually fits on the screen in Lunar, and it doesn't look too bad on Dissidia either.

Download Union font for PSP - Font Webpage - Not sure what language it is in.

Script Edits:
v2: Modified the default values. The first batch of fonts I tested with were bulky so smaller values worked better than the original defaults.
v3: If a "font" folder is found it will now ask if you want to delete it before entering a bunch of options. Also outputs a log file of the last set of options used.
v4: Height section is now "Size" because it also affects the width. Horizontal spacing for large and small fonts can now be changed independently of each other.

I don't think it can get much better than it is now. It would require editing the source for ttf2pfg and fixing it so it properly generates small fonts which is beyond me. Small fonts are basically being generated as large fonts. Read the 4th post to learn more. I found it on the web so I'm offering a download link if anyone wants to take a stab at it, although I'm not really sure if its actually the same program or version. - ttf2pgf source code

Attached File(s) Thumbnail(s)
Find all posts by this user
Quote this message in a reply
02-28-2014, 06:42 PM
Post: #2
RE: PSP Font Auto-Generate from TTF
This is interesting. I think it should be in Development though, since it pertains to PPSSPP.

Catch me if you can't catch me if you can't Cats are nice.
Visit this user's website Find all posts by this user
Quote this message in a reply
02-28-2014, 09:20 PM
Post: #3
RE: PSP Font Auto-Generate from TTF
It looks promising (looking forward to test this!)

ASRock Fatal1ty Z97 Killer | Intel i7-4790k @ 4.0GHz | 2x4GB DDR3 1600MHz | EVGA GTX 1070 | Windows 10 Pro x64
Find all posts by this user
Quote this message in a reply
03-01-2014, 04:43 PM (This post was last modified: 03-01-2014 05:01 PM by Bighead.)
Post: #4
RE: PSP Font Auto-Generate from TTF
So I've been digging into the font issue with PPSSPP, and even on the real PSP because custom fonts are doing the same thing. TL;DR, I don't have a solution, but I do have a hypothesis: small fonts are not being created at the correct resolution with current pgf tools. This is purely speculation, so if throughout my post it seems like I know what I'm talking about, I don't.

First, I figured it would be nice to have a table of all of Sony's default fonts. I created this using the problematic game Lunar: Silver Star Story.

Sony's fonts are created for the PSP, and aren't even available to purchase. Even if it was available as a commercial font, expect it to cost anywhere between $40-$100+. This is basically a guarantee that downloading or redistributing these fonts is an act of piracy.

Lunar by default looks for ltn12.pgf before all other fonts. If it doesn't find it, it falls back to ltn4.pgf for some strange reason. Fonts ltn0-ltn7 are all "large" fonts, so you would think it would look for a smaller font between ltn8-ltn15. If it fails to find both ltn12 and ltn4, then it cries mercy and starts counting up from 0 trying to find the next available font.

My next instinct was to compare the size of my custom font ltn12 to Sony's. At the save warning screen, everything looks okay for the most part. Lunar uses only "small" fonts throughout the entire game. Dissidia is using "large" fonts, which do not seem to have an issue. For the most part, large fonts are entirely unaffected, they just need to be created at a font size that looks good, which is not the actual size.

I then compared them in game, to both Sony's fonts and and their appearance on the save warning screen. The problem was immediately recognizable, it seems that the fonts are being upscaled to some degree, especially on the Y axis (they look much taller).

Sony's fonts don't seem to care they are being upscaled, this is most likely because they are created at a lower pixel resolution. It is probably the fault of all current PGF tools, they are most likely creating all fonts, both large and small, at equal resolutions. This creates a lot of wasted space. And this wasted space is also getting upscaled creating even more waste.

To verify my assumptions, I renamed Sony's ltn0.pgf to ltn12.pgf, loaded up Lunar, and it has the same exact issue as all small fonts that are generated with current programs. Basically, only large fonts are being generated by ttf2pgf. Small fonts generated just have a smaller font size than large fonts, but the actual size is the same. And for all I know, the large font size could be incorrect as well. Sony's large font protrudes the text box slightly less than generated custom fonts, but only a very small margin.

So the Conclusion: current pgf font tools suck, so there is no way we'll have custom "small" fonts that scale correctly no matter what the face is. They do not account for small fonts, and there is no configurable options to control the output size. Adjusting how "tall" the fonts are does not seem to affect the output, the resolution is most likely fixed whether they are large or small fonts.

There is very little information on the web for the PGF format, there are very little tools, no viewers, editors, etc, and there only seems to be one official tool called libPGF that fails to decode the generated font images. I'm going to continue hunting on the web because there has to be more information than what I currently found, or at least something out there that can correct the aspect ratio of small fonts or at least generate the fonts at the proper size (which I'm not even sure what that is yet).

EDIT: I almost forgot, what this means for the tool I included is that you may want to generate ltn0-7 with different horizontal spacing than ltn8-15. Using a value of 0.25-0.50 can account for some of the "waste" between the fonts, but currently the batch applies the same spacing value to both the large and the (fake) small fonts. I ran out of time for the moment, but I'll update it later so smaller fonts can have a separate spacing value in one run.
Find all posts by this user
Quote this message in a reply
03-01-2014, 06:14 PM
Post: #5
RE: PSP Font Auto-Generate from TTF
(02-28-2014 06:10 PM)Bighead Wrote:  I'm a little surprised

i clicked on your post cause i had problem with fonts few months ago and i fixed it by finding someone fonts for psp via google (and used them for ppsspp)

but i reply to you cause im BATch file user (alot)
i use them to make program save settings run semi portable or even
integrate with system shell menu

and so by accident i found this

its nothing that will help you but could be nice to an eye
this program converts bat file to exe + you can add an icon to it
i think it would be nice if you made such a complex bat script to make it have cool looking icon

i know its strange but i make icons to all my bat files (which i convert to exe)
and all i can do i share my knowledge to you even so it wont help any 1 but will be just nice little add-on

other link you would want to use is

this site converts png to icon
so you could go to google type font icon and choose to search images
and than just save icon you like as image convert it to png with even paint (unless its not png already) and compile it with bat to exe converter

this is absolutely useless but if you like it i could even create icon for you if you have some good idea

here are few icons i made for other programs
[Image: gT41S5j.png]

and looks allot better than default bat icon Wink

Try AntiMicro graphical program used to map keyboard keys and mouse controls to a gamepad/controller.
Find all posts by this user
Quote this message in a reply
03-02-2014, 07:37 PM
Post: #6
RE: PSP Font Auto-Generate from TTF
Although I don't condemn for downloading the fonts since it's essentially no different than me using the fonts that I dumped from my friend's PSP, the point of generating custom fonts is to use any font instead of just being limited to Sony's boring font. Or, replacing the oversized fonts currently supplied with PPSSPP, because their "small" font size/spacing causes text to run off the screen. This batch can be helpful for those who don't want to risk downloading fonts and don't have access to a PSP to dump them. And custom fonts work well for the most part, except when games use small fonts which is a fault with ttf2pgf. And as much as I want to, I don't have the knowledge or skills to fix it.

Also, thanks for sharing the bat2exe info. I was actually aware of this program but I never used it much myself. I'm not one who cares that much about the appearance, just whether or not it gets job done. Most scripts I share online I leave them as batch files so anyone can edit and modify it to fit their needs, or improve on it or offer suggestions because I'm not exactly an expert.
Find all posts by this user
Quote this message in a reply
07-24-2020, 12:55 AM
Post: #7
RE: PSP Font Auto-Generate from TTF
So I've been trying to create custom fonts to replace the fonts within the Final Fantasy 3 ISO (Using the DS font, as it looks so much better). But everytime I use the ISO with replaced font, PPSSPP would just crash. So I decided to make a bmp dump of the replaced font along with the original font to make a comparison. Seems like the generated font is bigger in height than the original.
Also, there are actually 3 pgf files within the ISO, "font_8.pgf", "font_12.pgf" & "font_14.pgf".
Anyone has ideas on how to fix the issue? I've been Googling around and can't seem to find much info on pgf editing.
Find all posts by this user
Quote this message in a reply
10-26-2020, 11:42 AM
Post: #8
RE: PSP Font Auto-Generate from TTF
I can't find the "PGF generator or converter" for ltn0.pgf~ltn15.pgf.

I modified & convert only jpn0.pgf.
But,"ltn1.pgf~ltn15.pgf" can't convert by my using application.

Some PSP games need the appropriate font files.

This file which becomes a solved start is needed.
Find all posts by this user
Quote this message in a reply
Post Reply 

Forum Jump: