Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(5 edits) (+2)

I find myself wanting to make alternate sizes of the same font or use an existing font to build off of for something entirely new.

I find it efficient to copy the source font, increase the height and then drop the baseline of all glyphs and then edit each glyph as needed.

To accommodate adjusting the baseline of the entire font, I made two buttons that translate all glyphs up and down.

on click do
 f:currfont[]
 i:0
 while i<96
  f[i]:f[i].translate[(0,1) 1]
  i:i+1
 end
 view[]
end

I’m unsure if using a while loop is the best way to access all the glyphs of the current font, but this script seems to work fine. (Font glyphs must range from 0 to 95 though.)

I hope some find this feature useful.

And please let me know if there is a better way to translate an entire font.

(1 edit) (+2)

A slightly simpler equivalent would be to use an "each" loop:

each i in range 96
 f[i]:f[i].translate[0,1 1]
end

If "f" were a list of Images, it would be possible to use ".." notation to manipulate every element in-place in the same way:

f..translate[0,1 1]

But this notation cannot be applied to an Interface type like a Font to implicitly iterate over every glyph. Alas!

(+2)

That is so much nicer to read!

on click do
 f:currfont[]
 each i in range 96
  f[i]:f[i].translate[0,1 1]
 end
 view[]
end

Thank you!

(+2)

If you haven't seen it previously, Learn Lil in 10 Minutes is a fast-paced overview of most of Lil's features targeted at folks who already have some exposure to other programming languages.