Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
78357e1
black
herbowicz Feb 1, 2018
99bd9f1
beautify
herbowicz Mar 15, 2018
8530afd
Change bg to light for Hacktoberfestg 2024
herbowicz Oct 30, 2024
c833cc0
Merge pull request #2 from herbowicz/Hacktoberfest2024
herbowicz Oct 30, 2024
929757f
sample text in README
herbowicz Oct 31, 2024
3a3bc85
Merge pull request #3 from herbowicz/Hacktoberfest2024
herbowicz Oct 31, 2024
f8aed5e
proper head and style file
herbowicz Oct 31, 2024
f7080cd
Merge pull request #4 from herbowicz/Hacktoberfest2024
herbowicz Oct 31, 2024
ae359ee
updated README file
herbowicz Oct 31, 2024
cdddac7
feat: styling README title
herbowicz Oct 31, 2024
7f5be2b
Merge pull request #5 from herbowicz/Hacktoberfest2024
herbowicz Oct 31, 2024
b1563d6
Merge pull request #6 from herbowicz/Hacktoberfest2024
herbowicz Oct 31, 2024
7ed716b
imporved README using AI
herbowicz Oct 31, 2024
a465c81
Merge pull request #7 from herbowicz/Hacktoberfest2024
herbowicz Oct 31, 2024
891e295
feat: add missing pic
herbowicz Oct 31, 2024
1779d9a
Merge pull request #8 from herbowicz/Hacktoberfest2024
herbowicz Oct 31, 2024
a0788db
feat: fix
herbowicz Oct 31, 2024
684d567
Merge pull request #9 from herbowicz/Hacktoberfest2024
herbowicz Oct 31, 2024
c8c4138
feat: letters and numbers sample pic
herbowicz Oct 31, 2024
5612efa
Merge pull request #10 from herbowicz/Hacktoberfest2024
herbowicz Oct 31, 2024
831da3d
styl: 12-Bit
herbowicz Oct 31, 2024
ce6bc0d
Merge pull request #11 from herbowicz/Hacktoberfest2024
herbowicz Oct 31, 2024
2d742f3
diff font widths
herbowicz Nov 4, 2024
782bdea
Merge pull request #12 from herbowicz/Hacktoberfest2024
herbowicz Nov 4, 2024
c440c9c
js file
herbowicz Nov 4, 2024
7021a81
Merge pull request #13 from herbowicz/Hacktoberfest2024
herbowicz Nov 4, 2024
88d075c
AI improvements and fixes
herbowicz Nov 22, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 66 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,69 @@
# 12 Lines
12 Lines Font utilizes a 3-column-3-row grid as start and end points for 6 vertical and 6 horizontal segments of lines that are allowed to join these points in the shortest way possible.
# 12-Bit
12-Bit font utilizes a 3-column-3-row grid as start and end points for 6 vertical and 6 horizontal segments of lines that are allowed to join these points in the shortest way possible.
With this concept in mind, out of 2^12 = 4096 signs available, only some were carefully chosen to represent all large and small characters of the standard Latin alphabet. Enjoy!

[Demo](https://herbowicz.github.io/12/) (start typing, try w/caps lock too)

## Sample text
![sample text](image.png)

## Letters and numbers
![alt text](signs.png)

Different font widths can obscure readability.
![alt text](font-width.png)

## A Unique Approach to Cryptography and Design

**A novel approach to representing characters using a minimal set of lines.**

This project explores the concept of the 12-Bit font, a unique way to represent characters using a binary code and basic line segments. This approach offers exciting possibilities in cryptography, design, and other security applications.

### How it Works

1. **Character Representation:**

Each character is represented by a 12-bit binary code. Each bit corresponds to a specific line segment within a 3x3 grid.

```
[1, 1, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1] // A
[1, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1] // B
[1, 1, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0] // C
```

2. **Canvas Rendering:**

The binary code is used to determine which line segments to draw on a canvas. For example, the first bit indicates whether the top horizontal line should be drawn.

```javascript
ctx.moveTo(s+l,s+d); if (sign[at][0]) { ctx.lineTo(s*2+l,s+d); } 
ctx.moveTo(s*2+l,s+d); if (sign[at][1]) { ctx.lineTo(s*3+l,s+d); }
// ...
```

### Benefits and Applications

1. **Cryptography:**

* **Steganography:** Embed information within images or other media using the minimalist nature of the font.
* **Security Tokens:** Create unique visual patterns for security tokens or watermarks.
* **Cryptography:** Utilize the binary representation as input for cryptographic algorithms.

2. **Design:**

* **Unique Typography:** Add a distinctive aesthetic to design projects with the font's style.
* **Minimalist Design:** Align your project with minimalist design principles using the font's simplicity.
* **Interactive Art:** Create interactive art installations or digital experiences with the font.

3. **Accessibility:**

* **Simplified Character Recognition:** The reduced number of elements can make character recognition easier for certain applications, such as OCR.
* **Universal Design:** Adapt the font for various screen sizes and resolutions due to its simplicity.

### Future Directions

* **Dynamic Font Generation:** Explore techniques to generate custom fonts based on specific design constraints or security requirements.
* **Font Optimization:** Optimize the font for different rendering contexts, such as web, print, and mobile devices.
* **Security Analysis:** Conduct a thorough security analysis to identify potential vulnerabilities and strengthen the font's security properties.

The 12-Bit font offers a promising approach with potential applications in various fields. By leveraging its unique characteristics, we can unlock new possibilities for creative endeavors and security advancements.
Binary file added font-width.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
224 changes: 28 additions & 196 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,196 +1,28 @@
<!DOCTYPE HTML>
<html>
<head>
<style>
body {
margin: 0 auto;
padding: 0;
overflow: hidden;
}
div {
color: #ddd;
float: right;
}
</style>
</head>
<body>
<div>Width: <span id="width"></span> <button onclick="w++; update();">+</button> <button onclick="w--; update();">-</button> Size: <span id="size"></span> <button onclick="s++; update();">+</button> <button onclick="s--; update();">-</button></div>
<canvas id="canvas"></canvas>
<script>
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext("2d");
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;

sign = [
[1,1, 1,1, 0,0, 1,0, 0,1, 1,0], //!
[0,0, 0,0, 0,0, 1,0, 1,0, 0,0], //"
[1,1, 1,1, 1,1, 1,1, 1,1, 1,1], //#
[1,1, 1,1, 1,1, 1,0, 1,1, 0,1], //$
[0,1, 1,1, 1,0, 0,1, 1,1, 1,0], //%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c
[0,0, 1,1, 1,1, 0,1, 0,0, 1,1], //d
[1,0, 1,0, 1,1, 1,1, 1,0, 0,0], //e
[0,1, 1,1, 0,0, 0,0, 1,1, 0,0], //f
[0,1, 0,1, 1,1, 0,0, 1,0, 1,1], //g
[0,0, 1,1, 0,0, 1,1, 0,0, 0,1], //h
[0,0, 1,1, 1,1, 0,0, 0,1, 0,0], //i
[0,0, 0,0, 1,1, 0,0, 0,0, 0,1], //j
[0,0, 1,1, 0,1, 1,1, 0,1, 0,0], //k
[0,0, 0,0, 1,1, 0,1, 0,0, 0,0], //l
[0,0, 1,1, 0,0, 0,1, 0,1, 0,1], //m
[0,0, 1,1, 0,0, 0,1, 0,0, 0,1], //n
[0,0, 1,1, 1,1, 0,1, 0,0, 0,1], //o
[0,1, 0,1, 1,0, 0,0, 1,1, 1,0], //p
[1,0, 1,0, 0,1, 1,0, 1,1, 0,0], //q
[0,0, 1,1, 0,0, 0,1, 0,0, 0,0], //r
[0,0, 0,1, 1,0, 0,0, 0,1, 0,0], //s
[0,0, 1,1, 0,1, 0,0, 1,1, 0,0], //t
[0,0, 0,0, 1,1, 0,1, 0,0, 0,1], //u
[0,0, 1,0, 0,1, 0,0, 0,1, 0,1], //v
[0,0, 0,0, 1,1, 0,1, 0,1, 0,1], //w
[0,0, 1,1, 0,0, 0,1, 1,1, 1,0], //x
[0,0, 0,1, 1,1, 0,0, 1,0, 1,1], //y
[0,0, 1,0, 0,1, 0,0, 0,1, 0,0], //z
[0,1, 1,0, 0,1, 0,0, 1,1, 0,0], //{
[0,0, 0,0, 0,0, 0,0, 1,1, 0,0], //|
[1,0, 0,1, 1,0, 0,0, 1,1, 0,0], //}
[1,0, 0,1, 0,0, 1,0, 1,0, 1,0] //~
]

var s = 12; //size
var l = 0; //left
var d = 0; //down
var w = 2; //width
on = true;

var update = function(){
document.getElementById('width').innerHTML = w;
document.getElementById('size').innerHTML = s;
}
update();

var clear = function(){
ctx.clearRect(s/2+l,s/2+d,s*3,s*3);
}

var cursor = function(){
if (on) {
clear();
ctx.beginPath();
ctx.lineWidth=w;
ctx.moveTo(s+l,s*3+d);
ctx.lineTo(s*3+l,s*3+d);
ctx.stroke();
on = false;
} else {
clear();
on = true;
}
}
setInterval(cursor, 500);

document.onkeydown = function(e) {
if (e.keyCode == 8) { clear(); l -= s*3; clear();
if(l < 0) { l = 0; }
} //backspace
}
document.onkeypress = function(evt) {
evt = evt || window.event;
var charCode = evt.keyCode || evt.which;
if (charCode == 13 || l > canvas.width-s*3) { clear(); l = 0; d += s*3; return; } //enter+EOL
if (charCode == 32) { clear(); l += s*3; return; } //space

if(charCode > 260) alert('Polish letters coming soon...');
var at = charCode - 33;

clear();

ctx.beginPath(); ctx.lineWidth=w;
//horizontal lines
ctx.moveTo(s+l,s+d); if (sign[at][0]) { ctx.lineTo(s*2+l,s+d); }
ctx.moveTo(s*2+l,s+d); if (sign[at][1]) { ctx.lineTo(s*3+l,s+d); }

ctx.moveTo(s+l,s*2+d); if (sign[at][2]) { ctx.lineTo(s*2+l,s*2+d); }
ctx.moveTo(s*2+l,s*2+d); if (sign[at][3]) { ctx.lineTo(s*3+l,s*2+d); }

ctx.moveTo(s+l,s*3+d); if (sign[at][4]) { ctx.lineTo(s*2+l,s*3+d); }
ctx.moveTo(s*2+l,s*3+d); if (sign[at][5]) { ctx.lineTo(s*3+l,s*3+d); }
//vertical lines
ctx.moveTo(s+l,s+d); if (sign[at][6]) { ctx.lineTo(s+l,s*2+d); }
ctx.moveTo(s+l,s*2+d); if (sign[at][7]) { ctx.lineTo(s+l,s*3+d); }

ctx.moveTo(s*2+l,s+d); if (sign[at][8]) { ctx.lineTo(s*2+l,s*2+d); }
ctx.moveTo(s*2+l,s*2+d); if (sign[at][9]) { ctx.lineTo(s*2+l,s*3+d); }

ctx.moveTo(s*3+l,s+d); if (sign[at][10]) { ctx.lineTo(s*3+l,s*2+d); }
ctx.moveTo(s*3+l,s*2+d); if (sign[at][11]) { ctx.lineTo(s*3+l,s*3+d); }

ctx.stroke();
l += s*3;
}

</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>12-Bit</title>
<link rel="stylesheet" href="style.css">
</head>

<body>
<div id="width">
Width:
<span></span>
<button class="1">+</button>
<button class="-1">-</button>
</div>
<div id="size">
Size:
<span></span>
<button class="1">+</button>
<button class="-1">-</button>
</div>
<canvas id="canvas"></canvas>
<script src="script.js"></script>
</body>

</html>
Loading