Font size

bkumanchik

  • Full Member
  • ***
    • Posts: 28
    • View Profile
Will there eventually be a smaller font? maybe a 4 x 5 (4 = 3 plus space)


Ben Rose

  • Administrator
  • Hero Member
  • *****
    • Posts: 392
    • View Profile
Hi- the answer for 'eventually' is definitely. We'd like 5x7 default, with maybe some smaller options. Right now we're testing out implementation in pure MicroPython, but it's pretty slow and we'll probably need to implement it within the firmware, so that will delay initial availability of it for testing etc- if anyone has input on that, let us know!

Thanks,
ben


acedent

  • Full Member
  • ***
    • Posts: 14
    • View Profile
@Ben - Have you looked at the arduboy2 lib for blitting fonts?
What is the bottleneck?


bkumanchik

  • Full Member
  • ***
    • Posts: 28
    • View Profile

Ben Rose

  • Administrator
  • Hero Member
  • *****
    • Posts: 392
    • View Profile
@acedent- I thought that would be a quick answer! I've been playing around with a bunch of stuff in MicroPython for the last day or two, and I think the answer is that blits with the built in FrameBuffer object are just a bit slow. It's extremely general purpose and can handle tons of use cases outside of our simple 1bpp need. The arduboy2 font section looks like a very reasonable C/C++ implementation for 1bpp, I've written(adapted?) similar stuff for TinyScreen etc. After a while, I was able to do something similar in a MicroPython Viper code block, and it actually runs faster than the built in stuff for this very specific need.. I'll see if I can get something far enough along for other people to take a look at.


CoolieCoolster

  • Full Member
  • ***
    • Posts: 30
    • View Profile
I'll have to see if I can adapt it for use with text rather than just numbers, but here's a set of functions someone wrote for me to let me use 3x5 number sprites rather than regular text for keeping score:

# Prints numbers to scoreboard
def PrintNumber(number,totalDigits,x,y):
    scoreString=str(number)
    digits=len(scoreString)
    xPos=x
    yPos=y
    zerosToAdd=totalDigits-digits
    for i in range(totalDigits):
        if i < zerosToAdd:
            PrintDigit(0,xPos,yPos)
        else:
            PrintDigit(int(scoreString[i-zerosToAdd]),xPos,yPos)
        xPos += 4

# Locates sprite data for numbers
def PrintDigit(num,x,y):
    thumby.display.blit(n[num],x,y,3,5)

Perhaps it wouldn't run as well if it had to sort through letters in addition to numbers, but it seems to work well for keeping score, at the very least.


bkumanchik

  • Full Member
  • ***
    • Posts: 28
    • View Profile

CoolieCoolster

  • Full Member
  • ***
    • Posts: 30
    • View Profile
Not quite done with it yet, but here's NanoMem (adapted from TinyMem), which uses the functions I listed to keep track of the current score and how many inputs there are left to enter.


bkumanchik

  • Full Member
  • ***
    • Posts: 28
    • View Profile

 

SMF spam blocked by CleanTalk