0 Favourites

Automatic font splitter

This forum is currently in read-only mode.
  • Edit: updated! Now exports alpha properly(didn't realize it didn't before)!

    New version:

    Old version:

    http://www.amirai.net/misc/fontsplitter.zip

    Here it is, the automatic font splitter. Just put the image of your font in the same directory as the .exe/.cap, and run. The image needs to be a .png named font.png with a transparent background, as it uses alpha for collision checking. It checks for letters top down column by column, so make sure you put a space between each letter or if they're too close together it might not be able to tell. Also be sure to put all of the letters horizontally.

    This sucker is open-source freeware, so distribute/use it however you like. I don't recommend modifying it much though - there were a lot of bugs to get past to get it to work.

  • Excellent! this will take a LOT of work out of using custom fonts

    resulting font has a big blank frame around it, any chance to shrink that down?

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • Excellent! this will take a LOT of work out of using custom fonts

    resulting font has a big blank frame around it, any chance to shrink that down?

    Perhaps you could use "update collision mask", but you would have to not use "grab layout" on canvas.

    We need auto-crop on image manipulator......

  • I actually tried both resizing the canvas and using the image manipulator's crop feature, and neither worked. Resizing the canvas, it ignored its new size and continued acting as if it was its original size. I tried making a bunch of instances of the canvas then picking the one that was the right size, and all the images came out blank. I tried making lots of different canvases then using a family, and it wouldn't work at all.

    This was the best i could get it to work - and since with construct you can press alt-crop in the image editor to crop all the frames in an animation, does it really matter?

    Edit: Since I couldn't control the size of the canvas, I thought it best to leave it that size in case someone wanted to make a large font.

  • It would be better for anyone who wants to load the images during runtime.

  • Hmm... a good point, but without being able to resize the canvas to contain how much is pasted to it or crop via the image manipulator, I don't know how to get it to do that.

  • wow

    that's awesome

    and that was fast

    thank you, arima

    if you're comfortable with making this a community project

    let's see if we can use this as groundwork

    and figure out the cropping thing

    along with the other features that were in the other post.

    this is good stuff though

    didn't expect it to be this far along so quicklike

  • since with construct you can press alt-crop in the image editor to crop all the frames in an animation

    O_O holy crap

  • lol - yeah, that needs to be advertised more as a feature.

    As a font splitter, I don't mind making it a community project, but I don't think it really needs to be - if the cropping feature in the image manipulator gets fixed, cropping's a cinch. All I need to do is run a loop through the image to check for the letter same way I'm checking via collisions (except checking each pixel for alpha) then crop.

    As for the other features, essentially making it a general-purpose sprite sheet splitter if I understand what you're aiming for, I'm afraid I really am too busy to put that much work into it. This was meant to be a font splitter, not a sprite sheet splitter. I made this one because the design is simple and based off of things I'd done in the past, so I was confident I could whip it up quickly. If I could think of some quick way to do it, I would consider it, but I can't atm. If anyone else wants to make a sprite sheet splitter out of this though, they can. It's not like I'm patenting the technique.

  • actually arima

    I didn't catch what you had said about the cropping shortcut

    so that pretty much covers what we need

    does it do fonts on a grid with x and y or just in a line?

  • Ah. Well, sorry I misunderstood then.

    The fonts need to be written entirely horizontally, as it checks each column of pixels for a letter. There's an example image in the .zip that shows how they need to be arranged.

  • Cool. So basically instead of splitting an image by a grid (eg. 32x32 pixels) it splits the image by 'gaps'. So when you write 'ABCDEF' etc... each letter has a gap between it and so it crops and makes an image out of it? Would it be useful if I added that functionality into the import image dialog. A 'split by gap' button?

  • What happens with fonts that intentionally have gaps in individual characters?

  • Cool. So basically instead of splitting an image by a grid (eg. 32x32 pixels) it splits the image by 'gaps'. So when you write 'ABCDEF' etc... each letter has a gap between it and so it crops and makes an image out of it? Would it be useful if I added that functionality into the import image dialog. A 'split by gap' button?

    that would be cool

    especially if you could specify the background color

    cuz most of the sprite font sheets you find out there are split up by a color, like pink, or black, while a few of them are split by 0 alpha

    also if the regular split by grid (eg. 32x32 pixels) function was visual

    so you could dial up the numbers and see a visual grid of how they were being split

    and increase and decrease the grid size until it lined up

    as of now

    you have to keep reimporting the sprites over and over if you're not sure what the grid size is

    also, if you could make the "split by gaps" handle xy stuff like this:

    <img src="http://www.algonet.se/~guld1/fonts/269.gif">

    you would be radical

  • Would it be useful if I added that functionality into the import image dialog. A 'split by gap' button?

    That, and support for importing tile maps in the image editor, has been requested a lot before, so I think it'd be good to add.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)