This repository has been archived by the owner on Mar 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
advanced.html
156 lines (130 loc) · 6.48 KB
/
advanced.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
<!DOCTYPE html>
<html lang="en">
<head>
<title>TuringFonts - How to create a custom font</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<link rel="icon" type="image/png" href="img/logo.ico"/>
<link rel="stylesheet" href="lib/bootstrap/css/bootstrap.min.css" />
<link rel="stylesheet" href="lib/bootstrap/css/bootstrap-darkly.min.css" />
<script type="text/javascript" src="lib/jquery/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="lib/bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="lib/angular/angular-1.3.15.min.js"></script>
<link rel="stylesheet" href="lib/highlights/styles/tomorrow-night.css" />
<script type="text/javascript" src="lib/highlights/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script type="text/javascript" src="lib/slidorion/jquery.easing.js"></script>
<script type="text/javascript" src="lib/slidorion/jquery.slidorion.min.js"></script>
<link rel="stylesheet" href="lib/slidorion/slidorion.css" />
<link href='http://fonts.googleapis.com/css?family=Source+Code+Pro' rel='stylesheet' type='text/css'>
<style type="text/css">
h1, h2, h3, h2 a, h2 a:hover {
font-family: 'Source Code Pro';
color: #88f;
}
h1 {
margin-top: 0;
}
div.content {
padding: 5px;
}
p, li {
font-size: 16px;
font-family: Verdana;
}
h2 a, h2 a:hover {
text-decoration: none;
}
input, textarea, select {
color: white;
background-color: #333;
border: 1px solid darkgray;
}
span.alpha {
color: #ffa;
}
div.output {
border: 1px solid darkgray;
padding: 3px;
color: #aff;
}
pre {
padding: 0;
}
</style>
<script type="text/javascript">
$(document).ready(function(){
$('div.slidorion').slidorion({
speed: 1000,
interval: 8000
});
});
</script>
</head>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="index.html"><img alt="" title="TuringFonts" src="img/logo-24.png"></a>
<a class="navbar-brand" href="index.html">TuringFonts</a>
</div>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-left">
<li><a href="index.html">Getting started</a></li>
<li><a href="advanced.html">Advanced topics</a></li>
<li><a href="encoder.html">Encoder</a></li>
</ul>
</div>
</div>
</nav>
<div class="content col-md-8 col-md-offset-2">
<h1>How to create a Turing font</h1>
<p>If you want to use your own substitution method and/or another font (different that the ones provided in the <a href="index.html#downloads">Downloads</a> section)
you will need to create your own Turing's font.</p>
<p>The first thing that you need to do is to define your <em>plain text alphabet</em> and your <em>cipher text alphabet</em>, which define which letters are going to be substituted and with which values.</p>
<p>For example, in ROT13 the plain text alphabet is "abcdefghijklmnopqrstuvwxyz" and the cipher text alphabet is "nopqrstuvwxyzabcdefghijklm", indicating that the letter 'A' is going to be substituted by 'N', the letter 'B' by 'O', etc.</p>
<p>The next thing to do is to define a font that inverses the substitutions. For example, if ROT13 is used, the font must indicate to draw an 'A' when the letter 'N' is found, draw a 'B' when encountering an 'O', etc.</p>
<p>One way to do this is to use scripting capabilities of the application <a href="http://fontforge.github.io/">FontForge</a>.</p>
<h2>Using FontForge</h2>
<p>In order to use FontForge to create a Turing font, first must you replace, in the following script, the path of the font to modify, the alphabets that you want to use and (optionally) the name of the new font.</p>
<pre><code class="python"># Load module
import fontforge
# Get the font to be modified
myFont = fontforge.open("C:\MyFonts\Arial.ttf")
# Define the text and plain alphabets to use
plain = "abcdefghijklmnopqrstuvwxyz"
cipher = "zyxwvutsrqponmlkjihgfedcba"
# Define the name of the new font.
newFontName = myFont.fontname + "-" + cipher
# Create a font to use as auxiliar variable
temporal = fontforge.font()
	
# Change the order of the letters
plain = plain + plain.upper()
cipher = cipher + cipher.upper()
for i in range(len(plain)):
myFont.selection.select( plain[i] )
myFont.copy()
temporal.selection.select( cipher[i] )
temporal.paste()
# Copy back the letters in the auxiliar font to the original font.
temporal.selection.select(("ranges",None),"a","z")
myFont.selection.select(("ranges",None),"a","z")
temporal.copy()
myFont.paste()
temporal.selection.select(("ranges",None),"A","Z")
myFont.selection.select(("ranges",None),"A","Z")
temporal.copy()
myFont.paste()
# Save new font
myFont.fontname = newFontName
myFont.familyname = newFontName
myFont.fullname = newFontName
myFont.save(newFontName + ".sfd")
temporal.close()</code></pre>
<p>Then you execute this script in FontForge, by selecting the option <strong>File</strong> and then <strong>Execute script...</strong></p>
<p>After a few seconds, the font is going to be generated and you are going to be able to exported to TTF or any other format supported by the application.</p>
</div>
<a href="https://github.com/jfmdev/TuringFonts" target="_blank"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/52760788cde945287fbb584134c4cbc2bc36f904/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f77686974655f6666666666662e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_white_ffffff.png"></a>
</body>
</html>