cancel
Showing results for 
Search instead for 
Did you mean: 

Changing the font size

aatif
Associate II
Posted on December 30, 2014 at 22:41

I am working on my final year project and i have to change font of my display on LCD..

Only available fonts in library are 4

Font16x24

Font12x12

Font8x12

Font8x8

i thought of creating my own font files but could not understand how these asciis are written

const uint16_t ASCII8x8_Table [] = {

    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

    0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x40,

    0xa0, 0xa0, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00,

    0x00, 0x24, 0x24, 0xfe, 0x48, 0xfc, 0x48, 0x48,

    0x38, 0x54, 0x50, 0x38, 0x14, 0x14, 0x54, 0x38,

    0x44, 0xa8, 0xa8, 0x50, 0x14, 0x1a, 0x2a, 0x24,

    0x10, 0x28, 0x28, 0x10, 0x74, 0x4c, 0x4c, 0x30,

    0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,

    0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08,

    0x10, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10,

    0x00, 0x00, 0x24, 0x18, 0x3c, 0x18, 0x24, 0x00,

    0x00, 0x00, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x00,

    0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x10,

    0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00,

    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18,

    0x08, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, 0x20,

    0x18, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x18,

    0x08, 0x18, 0x28, 0x08, 0x08, 0x08, 0x08, 0x08,

    0x38, 0x44, 0x00, 0x04, 0x08, 0x10, 0x20, 0x7c,

    0x18, 0x24, 0x04, 0x18, 0x04, 0x04, 0x24, 0x18,

    0x04, 0x0c, 0x14, 0x24, 0x44, 0x7e, 0x04, 0x04,

    0x3c, 0x20, 0x20, 0x38, 0x04, 0x04, 0x24, 0x18,

    0x18, 0x24, 0x20, 0x38, 0x24, 0x24, 0x24, 0x18,

    0x3c, 0x04, 0x08, 0x08, 0x08, 0x10, 0x10, 0x10,

    0x18, 0x24, 0x24, 0x18, 0x24, 0x24, 0x24, 0x18,

    0x18, 0x24, 0x24, 0x24, 0x1c, 0x04, 0x24, 0x18,

    0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00,

    0x00, 0x00, 0x08, 0x00, 0x00, 0x08, 0x10, 0x00,

    0x00, 0x00, 0x04, 0x18, 0x20, 0x18, 0x04, 0x00,

    0x00, 0x00, 0x00, 0x3c, 0x00, 0x3c, 0x00, 0x00,

    0x00, 0x00, 0x20, 0x18, 0x04, 0x18, 0x20, 0x00,

    0x18, 0x24, 0x04, 0x08, 0x10, 0x10, 0x00, 0x10,

    0x3c, 0x42, 0x99, 0xa5, 0xa5, 0x9d, 0x42, 0x38,

    0x38, 0x44, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x44,

    0x78, 0x44, 0x44, 0x78, 0x44, 0x44, 0x44, 0x78,

    0x1c, 0x22, 0x42, 0x40, 0x40, 0x42, 0x22, 0x1c,

    0x70, 0x48, 0x44, 0x44, 0x44, 0x44, 0x48, 0x70,

    0x7c, 0x40, 0x40, 0x7c, 0x40, 0x40, 0x40, 0x7c,

    0x3c, 0x20, 0x20, 0x38, 0x20, 0x20, 0x20, 0x20,

    0x1c, 0x22, 0x42, 0x40, 0x4e, 0x42, 0x22, 0x1c,

    0x44, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x44, 0x44,

    0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,

    0x04, 0x04, 0x04, 0x04, 0x04, 0x24, 0x24, 0x18,

    0x44, 0x48, 0x50, 0x70, 0x50, 0x48, 0x48, 0x44,

    0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x3c,

    0x82, 0xc6, 0xc6, 0xaa, 0xaa, 0xaa, 0xaa, 0x92,

    0x42, 0x62, 0x52, 0x52, 0x4a, 0x4a, 0x46, 0x42,

    0x18, 0x24, 0x42, 0x42, 0x42, 0x42, 0x24, 0x18,

    0x78, 0x44, 0x44, 0x44, 0x78, 0x40, 0x40, 0x40,

    0x18, 0x24, 0x42, 0x42, 0x42, 0x42, 0x2c, 0x1a,

    0x78, 0x44, 0x44, 0x78, 0x50, 0x48, 0x44, 0x42,

    0x38, 0x44, 0x40, 0x38, 0x04, 0x44, 0x44, 0x38,

    0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,

    0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x24, 0x18,

    0x44, 0x44, 0x28, 0x28, 0x28, 0x28, 0x28, 0x10,

    0x92, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x44,

    0x42, 0x24, 0x24, 0x18, 0x18, 0x24, 0x24, 0x42,

    0x44, 0x28, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10,

    0x7c, 0x04, 0x08, 0x10, 0x10, 0x20, 0x40, 0x7c,

    0x1c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1c,

    0x10, 0x10, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04,

    0x1c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x1c,

    0x10, 0x28, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00,

    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,

    0x20, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,

    0x00, 0x00, 0x18, 0x04, 0x1c, 0x24, 0x24, 0x1c,

    0x20, 0x20, 0x28, 0x34, 0x24, 0x24, 0x34, 0x28,

    0x00, 0x00, 0x18, 0x24, 0x20, 0x20, 0x24, 0x18,

    0x04, 0x04, 0x14, 0x2c, 0x24, 0x24, 0x2c, 0x14,

    0x00, 0x00, 0x18, 0x24, 0x3c, 0x20, 0x24, 0x18,

    0x00, 0x18, 0x10, 0x10, 0x18, 0x10, 0x10, 0x10,

    0x00, 0x18, 0x24, 0x24, 0x18, 0x04, 0x24, 0x18,

    0x20, 0x20, 0x28, 0x34, 0x24, 0x24, 0x24, 0x24,

    0x10, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,

    0x08, 0x00, 0x08, 0x08, 0x08, 0x08, 0x28, 0x10,

    0x20, 0x20, 0x24, 0x28, 0x30, 0x28, 0x24, 0x24,

    0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,

    0x00, 0x00, 0xa6, 0xda, 0x92, 0x92, 0x92, 0x92,

    0x00, 0x00, 0x28, 0x34, 0x24, 0x24, 0x24, 0x24,

    0x00, 0x00, 0x18, 0x24, 0x24, 0x24, 0x24, 0x18,

    0x00, 0x28, 0x34, 0x24, 0x38, 0x20, 0x20, 0x20,

    0x00, 0x14, 0x2c, 0x24, 0x1c, 0x04, 0x04, 0x04,

    0x00, 0x00, 0x2c, 0x30, 0x20, 0x20, 0x20, 0x20,

    0x00, 0x00, 0x18, 0x24, 0x10, 0x08, 0x24, 0x18,

    0x00, 0x10, 0x38, 0x10, 0x10, 0x10, 0x10, 0x18,

    0x00, 0x00, 0x24, 0x24, 0x24, 0x24, 0x2c, 0x14,

    0x00, 0x00, 0x44, 0x44, 0x28, 0x28, 0x28, 0x10,

    0x00, 0x00, 0x92, 0xaa, 0xaa, 0xaa, 0xaa, 0x44,

    0x00, 0x00, 0x44, 0x28, 0x10, 0x10, 0x28, 0x44,

    0x00, 0x28, 0x28, 0x28, 0x10, 0x10, 0x10, 0x10,

    0x00, 0x00, 0x3c, 0x04, 0x08, 0x10, 0x20, 0x3c,

    0x00, 0x08, 0x10, 0x10, 0x20, 0x10, 0x10, 0x08,

    0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10,

    0x00, 0x10, 0x08, 0x08, 0x04, 0x08, 0x08, 0x10,

    0x00, 0x00, 0x00, 0x60, 0x92, 0x0c, 0x00, 0x00,

    0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff};

 so somebody please guide me so that i cld proceed..

8 REPLIES 8
aatif
Associate II
Posted on January 02, 2015 at 17:15

Sir please elaborate the example you gave.. I couldnot get it..

i have font 12x12 code so if i have to transform it eg 0xAC4 to 24x24 what should i do..??

Thanks for replying

Posted on January 02, 2015 at 18:10

You need to think of the pixels represented as binary

0xAC4

1010 1100 0100

11001100 11110000 00110000 ; Double up bits in row, and repeat

11001100 11110000 00110000

0xCCF030

0xCCF030

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
aatif
Associate II
Posted on January 03, 2015 at 01:11

Thank you clive..

i am really grateful..

Now I have to bold letters but in library there is no function of bold..

so can u help me with the routine of bolding the letters..

How should i BOLD..??

Posted on January 03, 2015 at 03:21

You could try doing an overlaid print where the second printing is one pixel shifted to the right, or right-one, down-one

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
aatif
Associate II
Posted on January 03, 2015 at 15:47

Thank you very much.. 🙂

Posted on December 30, 2014 at 23:08

i thought of creating my own font files but could not understand how these asciis are written

Ok, but what part exactly don't you understand? What character is which line? What bits are? How binary works? How bit maps are used to generate images? Who made the table/array? Take the line 0x00, 0x00, 0x24, 0x18, 0x3c, 0x18, 0x24, 0x00,

0x00 -> --------
0x00 -> --------
0x24 -> --#--#--
0x18 -> ---##---
0x3C -> --####--
0x18 -> ---##---
0x24 -> --#--#--
0x00 -> --------

This is the representation of the '*' character.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
aatif
Associate II
Posted on December 31, 2014 at 09:56

eg in 16x24 font these are binaries for '}' character

0x0000, 0x0060, 0x00C0, 0x01C0, 0x0180, 0x0180, 0x0180, 0x0180,

         0x0180, 0x0300, 0x0300, 0x0600, 0x0300, 0x0100, 0x0180, 0x0180,

         0x0180, 0x0180, 0x0180, 0x0180, 0x00C0, 0x0060, 0x0000, 0x0000,

in 12x12

0x0000,0x0000,0x0000,0x0000,0x7400,0x5800,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,

in 8x12

0x00,0x00,0x00,0x00,0x00,0x00,0xe8,0xb0,0x00,0x00,0x00,0x00,

in 8x8

0x00, 0x00, 0x00, 0x60, 0x92, 0x0c, 0x00, 0x00,

now i want my own font size of lets say 24x24 so i dont understand how to change these binaries.

I understand what does eg 0x60 means as you mentioned in the line.

Thanks for replying.. 🙂

Posted on December 31, 2014 at 13:21

I think only the first example is the '{' character.

You'd have to create your own bit map descriptions, likely 24 x 32-bit vectors, and adapt the unpacking code if it only supports widths up to 16-bits.

If you have a 12x12 font you could do a quick conversion of that where you double the bits in each line, and repeat each line twice.

ie 0x555 -> 0x333333,0x333333

You might also be able to find some tools that will take Microsoft TrueType fonts and convert them to bitmap format in C arrays.
Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..