Log In  

Cart #px3_font-0 | 2020-11-27 | Code ▽ | Embed ▽ | No License
4

oh woe is me, my letters are large and my text is readable...
but what if...

introducing the

THREE PX FONT!

that's right! you too could have a handy dandy function for drawing
compact text that fits perfectly on the screen, unlike pico-8's 3*5 font,
which is 32 by 12.33333333...

gross! get that recurring fraction out of here! all i need is 32 chars
by 32 chars!

for the low low cost of however many sprites you are willing to sacrifice,
and however many tokens this thing is, you too can have a pleasant print
the fits (screen wise) anywhere!

just take the following stuff (its customisable, so the character set can be
whittled or widened for whatever you're up to.

free of charge, there is another function (made by yours truly) that
allows you away to use spr() on any sprite scale, but if you don't need it
it can be probably squished into there? i don't know.

anyway, i'm done. its the worlds problem now!

[128x8]

prid={x=0,y=0}
local fontd=" 0123456789abcdefghijklmnopqrstuvwxyz()[]{},=-+*/.#_!:'?"
getlet={}
for i,c in pairs(split(fontd,"")) do
 getlet["c"..c]=i
end

function pri(st,x,y,c1,c2)
 st=tostr(st)
 if(c2)pal(7,c1)pal(6,c2)
 x=x or prid.x
 y=y or prid.y
 local ix=x
 for ch=1,#st do
  if sub(st,ch,ch)==" " then
   x+=4
  elseif sub(st,ch,ch)=="𝘯" then
   x=ix
   y+=4
  else
   scspr(
   (getlet["c"..sub(st,ch,ch)] or 0)-2,
   x,y,3,3)
   x+=4
  end
 end
 prid.x,prid.y=ix,y+4
end

--regular sprite function but you
--choose how wide each sprite is
function scspr(i,x,y,w,h)
 sspr(i%(128\w)*w,i\(128\h)*h,w,h,x,y)
end
P#84770 2020-11-27 22:03

nice work!

P#84772 2020-11-27 22:17

@queequeg thanks!

P#84776 2020-11-27 22:23

tiny boiii

P#92829 2021-05-31 01:38
:: luizpf

nice work

P#92836 2021-05-31 11:47

[Please log in to post a comment]

Follow Lexaloffle:        
Generated 2021-10-21 21:01:20 | 0.029s | Q:23