Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3x5 (or small) font #192

Closed
gfwilliams opened this issue Jan 23, 2014 · 1 comment
Closed

3x5 (or small) font #192

gfwilliams opened this issue Jan 23, 2014 · 1 comment

Comments

@gfwilliams
Copy link
Member

8x8 is a bit big for the smaller displays, and it also takes up more flash than a smaller font.

I did actually start on a 3x5. You can have some fun with the preprocessor to allow you to pack everything in quite nicely:

#define ___ 0
#define __X 1
#define _X_ 2
#define _XX 3
#define X__ 4
#define X_X 5
#define XX_ 6
#define XXX 7
#define PACK_5_TO_16(A,B,C,D,E) ((A) | (B<<3) | (C<<6) | (D<<9) | (E<<12))
 // 48

const unsigned short LCDFONT_3_5[10] = {

    PACK_5_TO_16( XXX , _X_ , XXX , XX_ , X_X ), // 01234
    PACK_5_TO_16( X_X , XX_ , __X , __X , X_X ),
    PACK_5_TO_16( X_X , _X_ , _X_ , XX_ , XXX ),
    PACK_5_TO_16( X_X , _X_ , X__ , __X , __X ),
    PACK_5_TO_16( XXX , XXX , XXX , XX_ , __X ),
                      ,     ,     ,     ,
    PACK_5_TO_16( XXX , XXX , XXX , XXX , XXX ), // 56789
    PACK_5_TO_16( X__ , X__ , __X , X_X , X_X ),
    PACK_5_TO_16( XXX , XXX , _X_ , XXX , XXX ),
    PACK_5_TO_16( __X , X_X , _X_ , X_X , __X ),
    PACK_5_TO_16( XXX , XXX , _X_ , XXX , XXX )

};

Potentially a variable width font would make more sense if we're going for 5 pixels high though.

@gfwilliams
Copy link
Member Author

Fixed. Used 4x6 - still almost 1/2 the ROM and it looks better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant