Sorry it's taking a while for the font support. It turned out that Shift-JIS encoded strings uses both single-byte and double-byte fonts, traditionally halfwidth and fullwidth characters, and I'd implemented it to use a single fontx2 font. I just need to fix the alignment calculations based on the character type and that will be done.
The FontStudio support is coming along much easier, as I just needed to convert UTF-8 characters into an array of U+xxxx index numbers and use those to look up each character's spacing & kerning information for alignment. I should have the ps2sdk changes done by tomorrow barring any complications.
Since the font support does most of the work needed to support translations, that actually checks off implementing translation support for the new UI since UTF-8 or Shift-JIS encoded textfiles can be used.
Thanks for taking the time to do proper SJIS font support. I know the Japanese will appreciate having it when your emulators are translated.
Originally Posted by ragnarok2040
The dev community is also in debt to you for making fontx support more understandable to those who wouldn't otherwise implement it since their language doesn't require it.
I have not been successful in recruiting anyone to make a font that has all the PS2 custom fonts, but hope to find one soon. Hopefully your implementation will inspire someone to do this, maybe even me:chinscrat
I've got fontx2 support all done. For some reason, if I copied ShiftJIS characters to the clipboard, my various editors kept converting it to unicode. This jwpce editor really helped, as I could paste unicode or ShiftJIS characters and make sure they were converted to, or stayed as, ShiftJIS encoded characters.
For apps that support FontStudio, it should be pretty easy to make a new bitmap/ini by reusing unused UTF+xxxx characters for PS2-only characters. I've tried fontforge with wfontx, to try and convert an outline font to bitmap font to fontx2, in order to control the quality of the output, but it doesn't work. It seems wfontx converts outline fonts to fontx2 directly, and doesn't seem to support converting from bitmap fonts. At least, none of the formats I've tried, except for bitmap TTF, and then nothing showed up.
I need to go out and do some yard work before it rains, and then I can finish up the FontStudio support. I uploaded the FontStudio editor, as it seems the page for it is down.
Hexed myself, :D. Ran into a problem with the font texture being corrupted. It had me stumped for a bit, but I managed to track it down to a weird issue where compiling and linking in the object file containing the texture prior to the object file with main() caused it to be corrupted. Switching the order of the objects around fixed it. Probably some sort of alignment issue. It helped me fix an issue with the 2d textured strip primitive while I was debugging the problem, though, :D.
I've managed to get the font working. The kerning information works pretty well. Newlines, center alignment, and right alignment are still giving me some trouble, but I should be able to fix that relatively soon. Scaling should work pretty well, since all the character information can just be multiplied with the same factor.
The screenshot shows some double byte characters mixed in with some single byte characters. My parsing function supports up to four byte characters, but FontStudio only supports up to three byte characters UTF+FFFF so anything above that won't show. Any characters that aren't in the texture will get replaced with UTF+FFFD, which is the replacement character.
Help with loading roms
*Sorry. Disregard this post.
All finished, :D.
Scaling works pretty well, as well as alpha blending/transparency/alignment. I've added the fontx2/fontstudio implementations as libfont in ps2sdk, and I'm converting my font test program into a sample to show how to use it. All that's left is to make a patch with some instructions and get it committed, but I'll do that after I get some sleep, heh.
Now I can finally get back to working on the new GUI and FCEUX/Snes9x, *_*.
Great news! It were some months of hard work, but I'm sure it will pay off.
I'm curious to see how we'll use the new video system instead of current gsKit and if I can disable that scaling filter, so the pixels in my game actually look like pixels ;)
Woah wait a sec... All this work lately wasn't directly on the emulator? Just for the stuff that will let it run? Damn...
That's great news! I'm looking forward for a nice update on FCEUX and Snes9x. ;)
Here's the patch for ps2sdk:
Remove this file before/after patching:
:/, ps2dev.org quit working on me, so I have to wait until I can post the instructions to update the official repository.
Added a dma_tags.h header for easy dmachains
Now supports normal/chain/ucab normal/ucab chain/fast waits
Redesigned to be more efficient
Supports UCAB & SPR packets
New 2d primitives including outline/circle primitives
3d primitive start/end system, similar to OpenGL's Begin()/End() blocks
Texture uploading support, including 8-bit or 4-bit textures
Drawing Environment headers and settings are now defined
Proper setting of the GS read circuits/output circuits
Flicker filter support for single high-resolution framebuffers
Scales small framebuffers for modes with large resolutions
Vsync handler support
Vram handling support
Supports FONTX2 type fonts and printing in ASCII(JISX201) or Shift-JIS
Supports FontStudio 4.1 bitmap fonts with kerning information with support of Unicode strings up to U+FFEF (U+FFF0,U+FFF1,U+FFF2 are reserved for the implementation)
New QWORD type in tamtypes.h, used for packing 128-bit data
Separated the GIF/GS registers
Added new vifcode/VIF register headers
Fixed the timer registers to be u32* not u64*
All of the samples for libmpeg/libdraw/libgraph have been updated
A new libfont sample has been added
I've fixed all the compiler warnings and added a bugfix here or there
The work was both for the new GUI and for the emulators. Snes9x, specifically, needed fine-tuned access to the framebuffers to support the various display modes with double-buffering. Translations are easier to support, now, as it just needs a font texture/ini file for your region and a translation file in UTF8 or ShiftJIS. The majority of the changes, not including new implementations, were from separating out the interdependencies/conflicts. E.g. changing a framebuffer attribute caused problems with the read circuits, or changing a packet's data and being unable to send it via the DMAC.