<commit_before># nanofont3x4

The world's smallest readable 3x4 font with readable lowercase!  Includes:

* Upper case (3x3) plus 1 pixel leading (hence the name `3x4` for honesty),
* Lower case (some are 2x2!)
* All ASCII symbols

# Practicality

I know what you're thinking .. how the hell is this font, especially the lowercase 2x2 glyphs, even practical??

Once the novelty wears off a "practical" example would be rendering "in-game book pages" that don't look like complete gibberish, or an "accurate print preview" with real text instead of blurry placeholder pixels that don't even look close to being the glyphs scaled down.

# Motivation

Why?

Why even attempt to do the "impossible" task of creating the worlds smallest readable lowercase font? First, what the heck does it even mean to say _"world's smallest font?"_  This is, as far as I know as of July 2015, the only font that has readable 2x2 lowercase glyphs.  Please let me know if you find another one!

Just how small of a font size can we go? 3x3? Yes, these have been done for upper case. See the References at the end.

What about 2x2? Can we even design readable lowercase glyphs that can even fit into a 2x2 grid?  Also, what is the minimal leading? How does leading effect readability?

The short answer to motivation is: _To answer the unknown._

The long answer is: Partially for the challenge, but mostly because only by pushing a craft to its **maximum limits** does it force oneself to take a step back and _really_ analyze what the goal is, and think laterally on how it might even be possible.  What _is_ the _"essence"_ of a glyph?  What makes a tiny glyph _readable_ anyways?  What makes an 'a' an 'a', an 'e' an 'e', or an 's' an 's' when you only have 3x3 or 2x2 pixels to work with?

Since there are no "extraneous" pixels to "fallback" onto then **every** pixel becomes that much more important.  Even a 1 pixel mistakes really stands out.  It was this quest for self discovery and understanding this _"Tao of Typography"_ that this project was born.

# Uppercase 3x3

A 3x3 uppercase has been "solved" or "known" for quite sometime as I mentioned above. This seemed like a good place to start.

If we start with a 3x3 uppercase font then does that imply that the lowercase glyph must be focused around a 2x2 cell?  Let's find out!

# Lowercase and 2x2

A 2x2 grid has 2^4 = 16 permutations.  That's only 16 choices for 26 lowercase letters!  In actuality readability is the most important goal so the following lowercase glyphs are not 2x2:

        `b`     `d`     `f` `g`
    `h`     `j` `k` `l` `m` `n`
        `p` `q`         `t` `u`
    `v` `w`     `y`    

That leaves these 9 glyphs to fit inside a 2x2 cell.

* a
* c
* e
* i
* o
* r
* s
* x
* z

Here are all 16 permutations of a 2x2 glyph cell:

    .. not usable = space
    ..

    .. not usuable = period but wrong kerning
    .x 

    .. not usable = period
    x.

    .. not usable, confused with `_`
    xx

    .x no meaning,  wrong kerning
    ..
 
    .x not usable, wrong kerning
    .x

    .x chosen as `s
    x.

    .x chosen as `a`
    xx

    x. no meaning
    ..

    x. chosen as `z`
    .x

    x. chosen as `i`
    x.

    x. chosen as `e`
    xx

    xx no meaning, 
    ..

    xx no meaning
    .x

    xx chosen as `r`
    x.

    xx chosen as `c` `o` and `x`
    xx

# Problem words

What words are difficult to read?  Believe it or not, most words are actually readable (once you get used to the font.) Since we have 3 ambigious glyphs, the troublesome words are anything with a 'co' or 'x' in it such as:

   * exercise
   * becomes
   * compliance

A quick search of frequency analysis, "frequency of letter pairs", reveals that the pairs `oo` and `co` show up often enough that they will be annoying to "decode" the context.  If we could somehow distingush between `c` and `o` I estimate we could reach ~ 99% readability.  Oh, what what 1 extra vertical pixel adds!  But alas, we'll have to settle for "mostly readable." Still, I'm happy with this considering I thought the task was (almost) impossible when I first started.

Enough already! where are the pictures? Alrighty then ...

* Texture Atlas:

<img src="https://raw.githubusercontent.com/Michaelangel007/nanofont3x4/master/pic/nanofont3x4.bmp"><commit_msg>Fixed grammar<commit_after># nanofont3x4

The world's smallest readable 3x4 font with readable lowercase!  Includes:

* Upper case (3x3) plus 1 pixel leading (hence the name `3x4` for honesty),
* Lower case (some are 2x2!)
* All ASCII symbols

# Practicality

I know what you're thinking .. how the hell is this font, especially the lowercase 2x2 glyphs, even practical??

Once the novelty wears off a "practical" example would be rendering "in-game book pages" that don't look like complete gibberish, or an "accurate print preview" with real text instead of blurry placeholder pixels that don't even look close to being the glyphs scaled down.

# Motivation

Why?

Why even attempt to do the "impossible" task of creating the worlds smallest readable lowercase font? First, what the heck does it even mean to say _"world's smallest font?"_  This is, as far as I know as of July 2015, the only font that has readable 2x2 lowercase glyphs.  Please let me know if you find another one!

Just how small of a font size can we go? 3x3? Yes, these have been done for upper case. See the References at the end.

What about 2x2? Can we even design readable lowercase glyphs that can even fit into a 2x2 grid?  Also, what is the minimal leading? How does leading effect readability?

The short answer to motivation is: _To answer the unknown._

The long answer is: Partially for the challenge, but mostly because only by pushing a craft to its **maximum limits** does it force oneself to take a step back and _really_ analyze what the goal is, and think laterally on how it might even be possible.  What _is_ the _"essence"_ of a glyph?  What makes a tiny glyph _readable_ anyways?  What makes an 'a' an 'a', an 'e' an 'e', or an 's' an 's' when you only have 3x3 or 2x2 pixels to work with?

Since there are no "extraneous" pixels to "fallback" onto then **every** pixel becomes that much more important.  Even a 1 pixel mistakes really stands out.  It was this quest for self discovery and understanding this _"Tao of Typography"_ that this project was born.

# Uppercase 3x3

A 3x3 uppercase has been "solved" or "known" for quite sometime as I mentioned above. This seemed like a good place to start.

If we start with a 3x3 uppercase font then does that imply that the lowercase glyph must be focused around a 2x2 cell?  Let's find out!

# Lowercase and 2x2

A 2x2 grid has 2^4 = 16 permutations.  That's only 16 choices for 26 lowercase letters!  In actuality readability is the most important goal so the following lowercase glyphs are not 2x2:

        `b`     `d`     `f` `g`
    `h`     `j` `k` `l` `m` `n`
        `p` `q`         `t` `u`
    `v` `w`     `y`    

That leaves these 9 glyphs to fit inside a 2x2 cell.

* a
* c
* e
* i
* o
* r
* s
* x
* z

Here are all 16 permutations of a 2x2 glyph cell:

    .. not usable = space
    ..

    .. not usuable = period but wrong kerning
    .x 

    .. not usable = period
    x.

    .. not usable, confused with `_`
    xx

    .x no meaning,  wrong kerning
    ..
 
    .x not usable, wrong kerning
    .x

    .x chosen as `s
    x.

    .x chosen as `a`
    xx

    x. no meaning
    ..

    x. chosen as `z`
    .x

    x. chosen as `i`
    x.

    x. chosen as `e`
    xx

    xx no meaning, 
    ..

    xx no meaning
    .x

    xx chosen as `r`
    x.

    xx chosen as `c` `o` and `x`
    xx

# Problem words

What words are difficult to read?  Believe it or not, most words are actually readable (once you get used to the font.) Since we have 3 ambigious glyphs, the troublesome words are anything with a 'co' or 'x' in it such as:

   * exercise
   * becomes
   * compliance

A quick search of frequency analysis, "frequency of letter pairs", reveals that the pairs `oo` and `co` show up often enough that they will be annoying to "decode" the context.  If we could somehow distingush between `c` and `o` I estimate we could reach ~ 99% readability.  Oh, what what 1 extra vertical pixel adds!  But alas, we'll have to settle for "mostly readable." Still, I'm happy with this considering I thought the task was (almost) impossible when I first started.

Enough already! Where are the pictures? Well, alrighty then without further ado ...

* Texture Atlas:

<img src="https://raw.githubusercontent.com/Michaelangel007/nanofont3x4/master/pic/nanofont3x4.bmp">
{'fraction_non_alphanumeric': 0.06812906220984215, 'fraction_numerical': 0.016248839368616527, 'mean_word_length': 3.076158940397351, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '694993', 'n_tokens_mistral': 2798, 'n_tokens_neox': 2543, 'n_words': 1400}