Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411625 Posts in 69391 Topics- by 58447 Members - Latest Member: sinsofsven

May 11, 2024, 07:10:55 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)Creating a bitmap font for Flash
Pages: [1]
Print
Author Topic: Creating a bitmap font for Flash  (Read 2676 times)
Craig Stern
Level 10
*****


I'm not actually all that stern.


View Profile WWW
« on: January 06, 2010, 11:08:21 AM »

The artist I'm working with on my upcoming strategy RPG has created a really nice customized font set based off Trajan Pro, but with a variety of raster effects applied to the letters to make them look like they're made out of gold. He has supplied me with a .png of all characters.

There are a bunch of tutorials out there on creating a custom pixel font, but I don't want to create a genuine font--just a raster character set in one size that I can instruct Flash to use for text in specific instances.

This tutorial tells you how to embed fonts in your Flash projects, which is nice, but it says nothing about custom bitmap fonts. Ironically, although this method gives you an option called "bitmap font," selecting "bitmap font" doesn't do anything as far as letting you substitute your own raster characters. It still asks for a .ttf or .otf file.

In short: is there a way, in Flash, to use a set of raster character images as a custom font? Or am I imagining functionality that simply doesn't exist in the program?
Logged

Μarkham
Level 10
*****



View Profile WWW
« Reply #1 on: January 06, 2010, 04:35:02 PM »

Someone wrote a custom class for Flixel that allows bitmap fonts within the Flixel framework for Flash.  You could look over the code and see how it assembles text into a BitmapData object, which can then be added to the stage through normal Flash means.
Logged

ChevyRay
Guest
« Reply #2 on: January 06, 2010, 05:05:36 PM »

I've written one of these as well which I'll share publicly pretty soon. It allows for font alignment (vertical and horizontal), making text appear letter-by-letter, and both fixed-width and variable-width fonts. It's quite a pain to develop such a thing, so I figure it'll be useful for others to use, and it's done in a memory efficient manner as well.

All you have to do is feed the bitmap font to it, and tell it whether you want it to be fixed width or not. If so, it'll automatically snap to the width of each of the characters, and you can specify horizontal and vertical spacing parameters as well.

It's sort of integrated a bit into my game library at the moment, but can easily be pulled out. I was thinking of doing so and creating one that can be integrated with Flixel for people to use, since an all-purpose class doesn't (?) seem to be that popular or available at the moment.

EDIT: I'm trying to write it into an extended Bitmap class right now so it'll be able to be used by general Flash users, give me a bit and I'll see if I can get one working and then I'll post it for you guys...
« Last Edit: January 06, 2010, 05:24:25 PM by ChevyRay » Logged
Craig Stern
Level 10
*****


I'm not actually all that stern.


View Profile WWW
« Reply #3 on: January 06, 2010, 10:37:21 PM »

Awesome--I look forward to it. Smiley
Logged

ChevyRay
Guest
« Reply #4 on: January 06, 2010, 10:48:49 PM »

I got kind of sidetracked prototyping Embarrassed so sorry I won't have it today. I'll still try to write this up sometime here though, since it'll probably be useful for people.
Logged
Pages: [1]
Print
Jump to:  

Theme orange-lt created by panic