• entries
707
1173
• views
434138

# GameFontLib

80 views

I finally got script-fonts working right. The problem was that I'm a moron lol. I can't even really seem to say it without sound dumb lol. Pretty much, I was in the mindset that I was calculating the width of the string when what I really wanted to do was calculate the right boundary (the right side of the very last character in the string.) After working a total of around 6 hours on this problem, I switched mindsets and had it working in less than 5 minutes. All I really had to add was four lines of code (well, two lines in two different places.) When I've reached the end of the line or the end of the string, I had to add what was left over of the last character (I iterate the string, adding the x-advance values and then when I reach a new line or the end of the string, I add the width of the last character minus it's x-advance to the total width.)

Kerning doesn't seem to be working right either. When I leave kerning out, my output looks almost exactly as the font does in MS office, but when I add kerning, the pairs with kerning overlap or are too far apart. I sent Andreas an email, so I'm leaving it out until then.

So, at the moment I've got alignment completely finished, script-style fonts supported, multiple pages working, batching half-finished (still need to get an index-buffer in there), and viewport-based rendering.

Formatting to break words isn't in yet (other than newlines), but I'll get that done tomorrow or Monday. I'm trying to decide how I want to do the color system. At the moment I've got a table system in place (the system has a table with 10 nodes in it which can be changed at anytime.) To change the color in the string you'd just use $[0-9] and it'd change the color of the next word to the color in the corresponding table index. The problem with that is that very limited (only 10 colors.) I had thoughts of reimplementing my old system (where you could specify RGB values), but that puts more strain on scripters (you'd have to make sure your colors stay consistent for key-word highlighting.) nerd_boy recommended changing it to${#} and that would allow pretty much an unlimited number of colors. I could also allow strings then, so instead of making sure that every character is colored using $(51) and that nothing changes that color, you could use$(CharNameColor). The problem there is that it's very ugly. For example:
Welcome back to my shop, $(CharNameColor)Malykai! And there's also the problem with phrases. For example, you might have a character mention Donny's House. To do that with the current system would require: The artifact can be found at$(PlaceNameColor)Donny's $(PlaceNameColor)House. As a small aside, I just realised that my current system would recognize the apostraphe as punctuation and revert back to the default color; so the 's' wouldn't be highlighted. Not very...efficient or wanted. I've had thoughts of implementing an HTML like tag system. That would fix the above problem (I'd just have and ), but is more bloated and just as ugly. The reason I'm using the system I am is that is simple and doesn't stick out like a sore thumb: The artifact can be found at$1Donny's 1House. I don't know though; I'll think about it. I'm off to bed though, I was going to head there two hours ago. My to-do list grew by one, but I'm down to three items: * Get kerning, formatting, & alignment in. * Decide on a coloring system. * Get scaling in. * Get clipping in. * Decide whether or not I want shadow support. Answer is: nope. * Get an index-buffer involved in the batching. * Add functions so that I can react to lost devices and device resets. * Add viewport support * Add methods to retrieve character set information and glyphs. One of things I have on my maybe list is a loader plugin system. That way it could be used to load any font (not just the ones generated from my tool that uses the files generated by AngelCode's bitmap font generator.) Technically, one could write a loader plugin that does all of the generating on-load and doesn't even need an external tool. But, as I said, that's on the maybe list and if I decided to do it, it'd be later down the road. Once the above items are done, I'm moving on to the prototypes.  Another idea, I could expand the current system. Keep it like the old, but adding support for A-Z. So, you can use[0-9,A-Z] to specify the color and you could use certain characters for things. For example, $C could be used to color names and$P could be used to color places.

I could then add support for $< and$> for phrase. For example:
The $IGoblet can be found at$!'Goblet' would be colored with whatever color is stored in C(ending at the space) and then "Donny's House" would be colored with whatever color is stored in P.Still not "pretty" (especially with characters right next to eachother), but adds more flexibility and fixes the phrases problem.Any comments/suggestions? 
 0 Sign in to follow this   Followers 0 
 Previous entry GameFontLib Next entry GameFontLib is finished...for now. 0 Comments Recommended Comments There are no comments to display. 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 Sign in with Microsoft Sign in with Facebook Sign in with Twitter Sign in with Google 
 GameDev Unboxed 0 Indie Marketing For N00bs: Lesson 6 - External Help Is Not A Cop-Out By Jesse "Chime" Collins 1 Indie Marketing For N00bs: Lesson 5 - Marketing Ain't Free By Jesse "Chime" Collins 3 Dr. Steamlove or: How I Learned To Stop Worrying And Love The Review Bomb By Jesse "Chime" Collins View more Blog Entries GameDev Challenges - January 2018 (Missile Command) By GoliathForge in The Achilles Journal    3 Seven Tips for Starting Game Developers By Ruslan Sibgatullin in Share what I've learned    8 The Rework Begins By riuthamus in Valley of Crescent Mountain    2 Porting Static:IT - Part 2- Engine Differences By EDI in A Keyboard and the Truth    0 A Windows Store Story By Endurion in New New Things    2 Popular Now 25 Rip internet 2017-12-14 By Finalspace Started Wednesday at 11:37 AM 11 Any idea on this boss mechanism? By Jomissle Started Wednesday at 02:32 AM 10 Handles replacing pointers using indices By matt77hias Started Tuesday at 10:54 AM 16 Issues with creative conflict for small unpaid team By steelstrung Started Tuesday at 05:31 AM 14 Where Do I Start? By Joseph Perez Started Tuesday at 05:10 AM GDNet Discord Chat All Activity Home Blogs Beals Software GameFontLib