Previous Up Next


Text Separate (Script-Fu Script)
(Script-Fu script)

Last modified: 2000-07-03

Requires: Script-Fu, some font
Placement: <Toolbox>/Xtns/Script-Fu/Utils/Text Separate

Result
Result Image

Separate Text script has been written as an aid for game developers. Its purpose is to help convert black and white, possibly scalable (and quite sophisticated) X window fonts into something more useful in computer game (i.e. simple, dumb and fancy).

This script does not of course try to force any solution for the problem of ideal and most suitable game font format. Instead it separates the characters from the font in a way which is assumed to be easy to convert into format specific for the given game --- for example with my RAW plugin :-)).

The Text Separate script works as such: it draws each character from the specified string into separate layer in a new image with current foreground color. It makes required background, either transparent or filled with current background color. Finally it optionally applies gradient to the letter to make it nice.

All characters are aligned to common baseline and into the left. The right margin of the layer should corespond to character width. Due to a simple-minded algorithm for harvesting font informations, the right margin might be actually a bit misplaced. I will be grateful for a better algo :-). The height of all layers is the same. I hope that it allows for variable spaced font yet does not complicate the char positioning. The name of each layer is the character itself.

The whole image is trimmed to the size of the biggest layer. Needless to say, the image can contain many layers. It seems that GIMP or Script-Fu do not like it and frequently hose themselves. Or there's a bug in the script. Ahem. If you find out, please write (Don't forget to remove the '!spam-' string from the address!).

Dialog

Dialog example

  • Text (Charset): The text to be separated, aka the character set of the new font. It can't contain spaces yet. Each character should be present only once. The default text is composed of all characters from ascii #33 to #126 in the right order.
  • Font Size: Size of font in pixels to be used for the text.
  • Antialias: When checked, the rendered letters will be antialiased.
  • Font: Name of the font which will be used for the text.
  • Add to Size: Number of pixels that are added to computed ideal width and height of the character. As the ideal values are often wrong, this value can be a real saver for letters like 'A' or 'W'.
  • Use Gradient: If checked, gradient will be used over the letter color.
  • Gradient: Select the gradient for use on letters.
  • Gradient Type: Type of the gradient to use. It coresponds to the gradient types in tool options: 0 - linear, 1 - bi-linear, 2 - radial and so on.
  • Gradient Start: Position of the gradient starting point or center. Actually there are 9 possible positions: 0 - top left, 1 - top center, 2 - top right, 3 - center left and so on up to 8 - botton right. The center and right positions are relative to extents of each layer, not of the whole image.
  • Gradient Direction: Position of the gradient finishing point. The values for this fields are the same as in the Gradient Start field above.
  • Transparent Background: If checked, the character layers are made transparent, else they are filled with background color. Both options have their merits, however especially Golden gradient on black background looks really cool :-)

Note: This version is compatible with GIMP 1.1.22

Grab the source code for Gimp 1.1


Previous Up Next