News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Variable Width Font (VWF)  (Read 9092 times)

wyndcrosser

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Variable Width Font (VWF)
« on: March 12, 2013, 05:44:02 pm »
Hello,

I'm looking to incorporate this into my neo geo pocket color rom translations. However, I'm a little lost. I've read through examples like below, but I think I need something of an over-all clarification of what VWF does, if anyone would like to break it down for me. I'll continue doing my own research, but any assistance would be great.

http://www.romhacking.net/documents/245/

thanks

Wynd

Gideon Zhi

  • IRC Staff
  • Hero Member
  • *****
  • Posts: 3520
    • View Profile
    • Aeon Genesis
Re: Variable Width Font (VWF)
« Reply #1 on: March 12, 2013, 08:04:03 pm »
To understand what exactly a VWF does, you need to understand how bitplane graphics work. At the most basic 1bpp (monochrome) level, take a byte and think about it as binary. A 1 denotes a pixel displayed, a 0 denotes a pixel transparent. As such, you can get eight pixels per byte (eight bits per pixel.) Stack eight of 'em together, and you get an 8x8 tile. So something like...

Code: [Select]
00000000
00011000
00100100
00111100
00100100
00100100
00100100
00000000

... voila! A crudely-drawn A.

Of course, when you think of tiles, you're generally stuck with a rigid 8x8, 8x16, 16x16 structure. As such, we need an actual picture or bitmap of our text in RAM. So instead of storing the entire alphabet/tileset in RAM or VRAM, you store a picture of the text you want to display. You can use arithmetic and logical shifts to move bits around in your font tile (thus shifting it to the left or right, depending on how your code is written), then you use a binary AND operation to merge your tile with the bitmap. You have to keep track of the previous character's shift value, though, so you know where to put the new tile and how many shifts you need to do.

Tomato

  • Sr. Member
  • ****
  • Posts: 306
    • View Profile
    • Legends of Localization
Re: Variable Width Font (VWF)
« Reply #2 on: March 13, 2013, 01:27:55 pm »
I don't know if it'll help or not in this case, but I sometimes went into detail about this sort of thing while working on Mother 3. Here's an example of trying to explain how VWFs sort of work: http://mother3.fobby.net/blog/2008/03/29/welcome-to-text-welding-102/

Gideon Zhi

  • IRC Staff
  • Hero Member
  • *****
  • Posts: 3520
    • View Profile
    • Aeon Genesis
Re: Variable Width Font (VWF)
« Reply #3 on: March 13, 2013, 02:09:12 pm »
I don't know if it'll help or not in this case, but I sometimes went into detail about this sort of thing while working on Mother 3. Here's an example of trying to explain how VWFs sort of work: http://mother3.fobby.net/blog/2008/03/29/welcome-to-text-welding-102/

Yeah, read this. It's basically what I was trying to say only a hell of a lot clearer.

wyndcrosser

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: Variable Width Font (VWF)
« Reply #4 on: March 15, 2013, 04:41:14 pm »
Thanks for responding, I'll look through it.

I'm having a hell of a time making Biomotor Unitron 2 make sense, when I'm limited on space.

Pikachumanson

  • Hero Member
  • *****
  • Posts: 607
    • View Profile
Re: Variable Width Font (VWF)
« Reply #5 on: March 15, 2013, 04:42:50 pm »
Would a MTE routine work on a Neo Geo Pocket game?

KingMike

  • Forum Moderator
  • Hero Member
  • *****
  • Posts: 6934
  • *sigh* A changed avatar. Big deal.
    • View Profile
Re: Variable Width Font (VWF)
« Reply #6 on: March 15, 2013, 08:05:04 pm »
I'm sure the NGP can handle MTE. ;)

Now whether it can feasibly be created and inserted with available tools is a different question. :)
"My watch says 30 chickens" Google, 2018

Pennywise

  • Hero Member
  • *****
  • Posts: 2259
  • I'm curious
    • View Profile
    • Yojimbo's Translations
Re: Variable Width Font (VWF)
« Reply #7 on: March 17, 2013, 07:23:14 pm »
Would a MTE routine work on a Neo Geo Pocket game?

All hack concepts are universal. The only thing that makes them different are the limitations of the system and the ASM involved. Even something like a VWF can be done on the NES depending whether or not a game has VRAM.

Thanks for responding, I'll look through it.

I'm having a hell of a time making Biomotor Unitron 2 make sense, when I'm limited on space.

A hacker's best friend is expansion or compression. It makes dealing with space restrictions relatively trivial. I would recommend looking at some technical docs to see what is possible and what's not especially for something like expansion.

Also if you're dealing with space restrictions with the text, you probably won't be able to do a VWF. The extra code and data will need extra space of its own that the game just doesn't have the room for currently.
« Last Edit: March 17, 2013, 07:29:43 pm by Pennywise »

wyndcrosser

  • Full Member
  • ***
  • Posts: 199
    • View Profile
Re: Variable Width Font (VWF)
« Reply #8 on: March 18, 2013, 12:23:37 pm »
I don't quite understand how it works, but from what I understand I can clear out the Japanese script and use all of that space for creating the letters, similar to the guide you guys posted earlier.... I guess I don't understand how to make the game "look" for letters "here and there" instead "there". It's probably just something I'm going to have to dig through to understand.

Thanks

FinS

  • Full Member
  • ***
  • Posts: 192
    • View Profile
    • nothing much
Re: Variable Width Font (VWF)
« Reply #9 on: March 19, 2013, 04:11:39 pm »
Simply put, a normal text routine writes the pointers to the tiles containing the letters.  A vwf draws the tiles which are being pointed to which allows the letters to be scrunched together.

Gideon Zhi

  • IRC Staff
  • Hero Member
  • *****
  • Posts: 3520
    • View Profile
    • Aeon Genesis
Re: Variable Width Font (VWF)
« Reply #10 on: March 19, 2013, 08:44:46 pm »
That makes my brain hurt. Very much improper use of the word "pointer"! You're streaming the text from ROM either way; the only difference is how it's represented in VRAM.

With a tiled font, you have the entire font stored in VRAM. Each font tile is indexed along these lines. A lot of people don't understand the relationship between tiles and their hexadecimal representation... Anyway, elsewhere in VRAM, you have a tilemap, a complete index of every tile in a given layer on the screen. If you wanted to write the word "CAT" to the screen in Journey to Silius (see above) you'd write 0C 0A 1D into the tilemap, along with whatever other necessary data goes into the tilemap (palette index rotation data on the SNES, for example).

With a VWF, you're just drawing a picture of the text. You still have a regular font stored in the ROM, but it just grabs it one letter at a time, does a shift, then paints it into VRAM. It still tilemaps it - with nothing written into the tilemap, you wouldn't have anything to display - but it might write something like 00 01 02 03 for a string that, once rendered, only takes up four tiles.

Wynd, correct me if I'm wrong, but you still don't even have a grasp on text pointers, yes? In other words, you're currently limited to how long the strings are in the games you work on. Let me tell you, there are two types of "space" you need to consider when it comes to translation hacking - ROM space and screen space. Your capability to store longer strings in the game you're working on is a ROM space issue. The capability to list a word in an interface that's longer than the developers originally planned is a screen space issue. Having a VWF will make your text nice and pretty, and might help you fit "Shield of Faith" into a space that used to only accomodate eight letters, but it's not going to help you with storage at all, and it's frankly one of the more advance topics particular to our field. No disrespect, but please, learn to walk before you try to run.

"Clearing out the Japanese script" as you put it will help with your ROM space troubles, provided you know about text pointers. VWFs are really really nice to have, but are generally a nice aesthetic touch more than anything else.

Bongo`

  • Sr. Member
  • ****
  • Posts: 338
  • Hatred is an illness...I feel your pain.
    • View Profile
    • Dynamic Designs
Re: Variable Width Font (VWF)
« Reply #11 on: March 19, 2013, 09:11:00 pm »
Also if you're dealing with space restrictions with the text, you probably won't be able to do a VWF. The extra code and data will need extra space of its own that the game just doesn't have the room for currently.

  If the NGP is anywhere near flexible with ROM access as the SNES is, then do what I do
and that is use the actual Font space in ROM as code AND font data since a standard ASCII
font will not require as much space anyway. Works well if you have 24-Bit or greater "jump-ability"
in NGP asm.
R.I.P Rose Mary C. 11/20/1937 - 2/11/2007
Dynamic-Designs Over 30 years of video game experience!
Completed: Doraemon RPG, Fuzzical Fighter, Gulliver Boy, Just Breed, FEDA, Mystic Ark, Slayers ( Co-op ), Lennus-II
Current: Aretha-2 and many more...

Drakon

  • Sr. Member
  • ****
  • Posts: 277
    • View Profile
    • 16 Bit Gamer
Re: Variable Width Font (VWF)
« Reply #12 on: March 19, 2013, 09:52:35 pm »
interesting, it's like, an offset?

Gideon Zhi

  • IRC Staff
  • Hero Member
  • *****
  • Posts: 3520
    • View Profile
    • Aeon Genesis
Re: Variable Width Font (VWF)
« Reply #13 on: March 19, 2013, 10:40:25 pm »
interesting, it's like, an offset?

Nah, what he's trying to say is that since a Japanese font has so many more characters than a Roman font, you can blank out any unused characters and use the newly-empty space for the extra code required to print the vwf.

mrrichard999

  • Hero Member
  • *****
  • Posts: 686
  • So Goooood! :D
    • View Profile
    • GameFAQS Profile
Re: Variable Width Font (VWF)
« Reply #14 on: May 08, 2013, 12:08:15 pm »