RLE compressor

Project here.
Pic of the RLE compressor block:


Pretty simple, isn't it?

I'm going to, as the name of the project ("rle font") suggests, make a pen-drawn font with this.


Explanation of RLE compression:
Basically, it turns runs of n items of type t into two parts: t then n. (Some RLE compressors use the other order, n t)

So:

yreiwuyryyrwieyyiywuyyyywiueyryuyuywiiiiryiiuyyiiiieyiyiruyri

turns into

"y"x1 "r"x1 "e"x1 "i"x1 "w"x1 "u"x1 "y"x1 "r"x1 "y"x2 "r"x1 "w"x1 "i"x1 "e"x1 "y"x2 "i"x1 "y"x1 "w"x1 "u"x1 "y"x4 "w"x1 "i"x1 "u"x1 "e"x1 "y"x1 "r"x1 "y"x1 "u"x1 "y"x1 "u"x1 "y"x1 "w"x1 "i"x4 "r"x1 "y"x1 "i"x2 "u"x1 "y"x2 "i"x4 "e"x1 "y"x1 "i"x1 "y"x1 "i"x1 "r"x1 "u"x1 "y"x1 "r"x1 "i"x1

and this:

010101010100010010010000100010010111010101000010000100010100000011111111110101111101010010001000010100010010

turns into this:

"0"x1 "1"x1 "0"x1 "1"x1 "0"x1 "1"x1 "0"x1 "1"x1 "0"x1 "1"x1 "0"x3 "1"x1 "0"x2 "1"x1 "0"x2 "1"x1 "0"x4 "1"x1 "0"x3 "1"x1 "0"x2 "1"x1 "0"x1 "1"x3 "0"x1 "1"x1 "0"x1 "1"x1 "0"x1 "1"x1 "0"x4 "1"x1 "0"x4 "1"x1 "0"x3 "1"x1 "0"x1 "1"x1 "0"x6 "1"x10 "0"x1 "1"x1 "0"x1 "1"x5 "0"x1 "1"x1 "0"x1 "1"x1 "0"x2 "1"x1 "0"x3 "1"x1 "0"x4 "1"x1 "0"x1 "1"x1 "0"x3 "1"x1 "0"x2 "1"x1 "0"x1

and, more reasonably, this:

0000010000101111111111111000000000000000000001001011111111111110110111111111101011101000100000000000000000000010101011111111111111111111111111111111111111110000000000000000000000000000000000000000

turns into this:

"0"x5 "1"x1 "0"x4 "1"x1 "0"x1 "1"x13 "0"x20 "1"x1 "0"x2 "1"x1 "0"x1 "1"x13 "0"x1 "1"x2 "0"x1 "1"x10 "0"x1 "1"x1 "0"x1 "1"x3 "0"x1 "1"x1 "0"x3 "1"x1 "0"x21 "1"x1 "0"x1 "1"x1 "0"x1 "1"x1 "0"x1 "1"x40 "0"x40

Cool. Font as in a collection of costumes, or are you going to make an actual ttf or Postscript font file?

Excuse my lack of knowledge- what is an RLE compressor?

Run Length Encoding

It's a means of compressing data

e.g if you had a string "123455555556789", you could encode it as "12345x76789" which is shorter

There are many means of encoding - the above is just an invented simple example

RLE works well with long sequences of identical values - performs badly with random data

Therefore, great for cartoons, not great for nature photos.

It performs better on random data than hyperuniform data, though.

I'll add an explanation to the topic.

Neither. It's something like this:

  1. You have a font list like this:

    This has an "A" character of bits:
01110
10001
10001
10001
11111
10001
10001
10001
10001
00000
00000
00000
00000

(It's not that good on here because the 0s and 1s are taller than they are wide)
It then RLE-compresses the rows into this:

0x1 1x3 0x1
1x1 0x3 1x1
1x1 0x3 1x1
1x1 0x3 1x1
1x5
1x1 0x3 1x1
1x1 0x3 1x1
1x1 0x3 1x1
1x1 0x3 1x1
0x5
0x5
0x5
0x5

which is then flattened:

0x1
1x3
0x1
1x1
0x3
1x1
1x1
0x3
1x1
1x1
0x3
1x1
1x5
1x1
0x3
1x1
1x1
0x3
1x1
1x1
0x3
1x1
1x1
0x3
1x1
0x5
0x5
0x5
0x5

The first item of the font list is the width of each character in pixels.