cd /news/hardware/a-4x4-pixels-font · home topics hardware article
[ARTICLE · art-11498] src=gist.github.com ↗ pub= topic=hardware verified=true sentiment=· neutral

a 4x4 pixels font

This article describes a 4x4 pixel font stored in a C++ header file called `half_font.h`. The font is defined as a 95-character array of byte values, where each character is represented by four bytes that encode its pixel pattern. The author notes that the font is "horrible" and "unreadable" due to its extremely small size.

read2 min views24 publishedApr 12, 2018

half_font.h

  This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.

Learn more about bidirectional Unicode characters

Show hidden characters
// 4x4 pixel font, horrible, unreadable :)

const int CHAR_WIDTH = 4;

const int CHAR_HEIGHT = 4;

byte halffont[95][4] = { {0,0,0,0}, //space

                         {0,0,0,0}, // !

                         {0,0,0,0}, // "

                         {0,0,0,0}, // #

                         {0,0,0,0}, // $

                         {0,0,0,0}, // %

                         {0,0,0,0}, // &

                         {0,0,0,0}, // '

                         {0x1,0x2,0x2,0x1}, // (

                         {0x2,0x1,0x1,0x2}, // )

                         {0,0,0,0}, // *

                         {0,0,0,0}, // +

                         {0,0,0x1,0x2}, // ,

                         {0,0,0x6,0}, // -

                         {0,0,0,0x2}, // .

                         {0x0,0x1,0x2,0x4}, // /

                         {0x7,0x5,0x5,0x7}, // 0

                         {0x2,0x6,0x2,0x2}, // 1

                         {0x6,0x1,0x2,0x7}, // 2

                         {0x6,0x3,0x1,0x6}, // 3

                         {0x1,0x5,0x7,0x1}, // 4

                         {0x7,0x6,0x1,0x6}, // 5

                         {0x7,0x4,0x7,0x7}, // 6

                         {0x7,0x1,0x2,0x2}, // 7

                         {0x7,0x5,0x7,0x7}, // 8

                         {0x7,0x7,0x1,0x7}, // 9

                         {0,0x2,0,0x2}, // :

                         {0,0,0,0}, // ;

                         {0,0,0,0}, // <

                         {0,0,0,0}, // =

                         {0,0,0,0}, // >

                         {0,0,0,0}, // ?

                         {0,0,0,0}, // @

                         {0x2,0x5,0x7,0x5}, // A

                         {0x6,0x6,0x5,0x6}, // B

                         {0x3,0x4,0x4,0x3}, // C

                         {0x6,0x5,0x5,0x6}, // D

                         {0x7,0x6,0x4,0x7}, // E

                         {0x7,0x4,0x6,0x4}, // F

                         {0x3,0x4,0x5,0x2}, // G

                         {0x5,0x5,0x7,0x5}, // H

                         {0x7,0x2,0x2,0x7}, // I

                         {0x1,0x1,0x5,0x2}, // J

                         {0x5,0x6,0x5,0x5}, // K

                         {0x4,0x4,0x4,0x7}, // L

                         {0x7,0x7,0x5,0x5}, // M

                         {0x5,0x7,0x7,0x5}, // N

                         {0x2,0x5,0x5,0x2}, // O

                         {0x6,0x5,0x6,0x4}, // P

                         {0x2,0x5,0x5,0x3}, // Q

                         {0x6,0x5,0x6,0x5}, // R

                         {0x3,0x6,0x1,0x6}, // S

                         {0x7,0x2,0x2,0x2}, // T

                         {0x5,0x5,0x5,0x3}, // U

                         {0x5,0x5,0x5,0x2}, // V

                         {0x5,0x5,0x7,0x7}, // W

                         {0x5,0x2,0x2,0x5}, // X

                         {0x5,0x2,0x2,0x2}, // Y

                         {0x7,0x2,0x4,0x7}, // Z

                         {0x3,0x2,0x2,0x3}, // [

                         {0,0x4,0x2,0x1}, // 

                         {0x6,0x2,0x2,0x6}, // ]

                         {0,0,0,0}, // ^

                         {0,0,0,0}, // _

                         {0,0,0,0}, // `

                         {0x2,0x5,0x7,0x5}, // a

                         {0x6,0x6,0x5,0x6}, // b

                         {0x3,0x4,0x4,0x3}, // c

                         {0x6,0x5,0x5,0x6}, // d

                         {0x7,0x6,0x4,0x7}, // e

                         {0x7,0x4,0x6,0x4}, // f

                         {0x3,0x4,0x5,0x2}, // g

                         {0x5,0x5,0x7,0x5}, // h

                         {0x7,0x2,0x2,0x7}, // i

                         {0x1,0x1,0x5,0x2}, // j

                         {0x5,0x6,0x5,0x5}, // k

                         {0x4,0x4,0x4,0x7}, // l

                         {0x7,0x7,0x5,0x5}, // m

                         {0x5,0x7,0x7,0x5}, // n

                         {0x2,0x5,0x5,0x2}, // o

                         {0x6,0x5,0x6,0x4}, // p

                         {0x2,0x5,0x5,0x3}, // q

                         {0x6,0x5,0x6,0x5}, // r

                         {0x3,0x6,0x1,0x6}, // s

                         {0x7,0x2,0x2,0x2}, // t

                         {0x5,0x5,0x5,0x3}, // u

                         {0x5,0x5,0x5,0x2}, // v

                         {0x5,0x5,0x7,0x7}, // w

                         {0x5,0x2,0x2,0x5}, // x

                         {0x5,0x2,0x2,0x2}, // y

                         {0x7,0x2,0x4,0x7}, // z

                         {0x1,0x2,0x6,0x1}, // {

                         {0x2,0x2,0x2,0x2}, // |

                         {0x4,0x2,0x3,0x4}, // }

                         {0,0,0,0}, // ~

};
── more in #hardware 4 stories · sorted by recency
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/a-4x4-pixels-font] indexed:0 read:2min 2018-04-12 ·