-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
295 lines (274 loc) · 20.8 KB
/
index.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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
<!DOCTYPE html>
<html lang="pt-BR" data-theme="light">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SpriteType - SpriteFont Generator</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<header class="app-header">
<a href="#" class="logo">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M4 3h16a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1z"/>
<path d="M9 8h6m-6 4h6m-6 4h6"/>
</svg>
SpriteType
</a>
<div class="header-actions">
<button class="theme-toggle margin-right-10" id="themeToggle">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-sun">
<circle cx="12" cy="12" r="4"/>
<path d="M12 2v2"/><path d="M12 20v2"/>
<path d="m4.93 4.93 1.41 1.41"/>
<path d="m17.66 17.66 1.41 1.41"/>
<path d="M2 12h2"/>
<path d="M20 12h2"/>
<path d="m6.34 17.66-1.41 1.41"/>
<path d="m19.07 4.93-1.41 1.41"/>
</svg>
</button>
<button class="btn btn-primary margin-right-10" id="download">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-download">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
<polyline points="7 10 12 15 17 10"/>
<line x1="12" x2="12" y1="15" y2="3"/>
</svg>
Export
</button>
<button class="btn btn-secondary menu-toggle" id="menuToggle">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M3 12h18M3 6h18M3 18h18"/>
</svg>
</button>
</header>
<main class="main-container">
<aside class="sidebar-left" id="sidebarLeft">
<div class="section">
<h2 class="section-title">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-book-type">
<path d="M10 13h4"/>
<path d="M12 6v7"/>
<path d="M16 8V6H8v2"/>
<path d="M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20"/>
</svg>
Font
</h2>
<div class="input-group">
<label class="input-label" for="fontFile">Font Upload</label>
<div class="upload-area" id="dropZone">
<input type="file" id="fontFile" accept=".ttf,.otf" class="file-input">
<div class="upload-content" id="uploadDefault">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/>
<polyline points="17 8 12 3 7 8"/>
<line x1="12" y1="3" x2="12" y2="15"/>
</svg>
<p>Drag your font here</p>
<span>or <button type="button" class="browse-btn">choose a file</button></span>
<span class="file-types">Supported formats: .ttf, .otf</span>
</div>
<div class="upload-content upload-success" id="uploadSuccess" style="display: none;">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M20 6L9 17l-5-5"/>
</svg>
<p class="file-name">file.ttf</p>
<button type="button" class="browse-btn">Choose another file</button>
</div>
</div>
</div>
<div class="input-group">
<label class="input-label">or Select a System Font</label>
<div class="select-wrapper">
<select id="systemFonts" class="input">
<option value="">Choose a font...</option>
</select>
<svg class="select-arrow" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M6 9l6 6 6-6"/>
</svg>
</div>
</div>
</div>
<div class="section">
<h2 class="section-title">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-pen-line">
<path d="m18 5-2.414-2.414A2 2 0 0 0 14.172 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2"/>
<path d="M21.378 12.626a1 1 0 0 0-3.004-3.004l-4.01 4.012a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506z"/>
<path d="M8 18h1"/>
</svg>
Caracteres
</h2>
<textarea id="characters" class="input" rows="7">ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789.,;:?!-_~#"'&()[]|`\/@°+=*$£€<>%ÁáÂâÀàÅåÃãÄäÆæÉéÊêÈèËëÍíÎîÌìÏïÓóÔôÒòÕõÖöÚúÛûùÙÜüÇçÑñÝý¿</textarea>
</div>
</aside>
<div class="content">
<div class="toolbar">
<div class="dimensions">
<span class="dimension-item"><a>W: </a> <span id="charWidth">0</span></span>
<span class="dimension-item"><a>H: </a> <span id="charHeight">0</span></span>
</div>
<div class="zoom-controls">
<button class="btn btn-secondary" id="zoomOut">-</button>
<span id="zoomLevel">100%</span>
<button class="btn btn-secondary" id="zoomIn">+</button>
</div>
</div>
<div class="preview-container fade-in">
<canvas id="previewCanvas"></canvas>
</div>
</div>
<aside class="sidebar-right" id="sidebarRight">
<div class="section">
<h2 class="section-title">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-settings">
<path d="M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z"/>
<circle cx="12" cy="12" r="3"/>
</svg>
Settings
</h2>
<label class="checkbox-group" for="showGrid">
<span class="toggle-switch">
<input type="checkbox" id="showGrid" checked class="checkbox">
<span class="toggle-slider"></span>
</span>
Show Grid
</label>
<div class="input-group" id="gridControls" style="display: none;">
<label class="input-label">Grid Color</label>
<div class="color-input">
<input type="color" id="gridColor" value="#000000">
<input type="range" id="gridOpacity" min="1" max="100" value="50" class="input">
<span id="gridOpacityValue">50%</span>
</div>
</div>
<div class="input-group">
<label class="input-label" for="fontSize">Font Size</label>
<input type="number" id="fontSize" value="32" min="8" max="256" class="input">
</div>
<div class="input-group">
<label class="input-label">Padding</label>
<div class="padding-grid">
<input type="number" id="paddingTop" value="4" min="0" max="64" class="input" placeholder="Top">
<input type="number" id="paddingRight" value="4" min="0" max="64" class="input" placeholder="Right">
<input type="number" id="paddingBottom" value="4" min="0" max="64" class="input" placeholder="Bottom">
<input type="number" id="paddingLeft" value="4" min="0" max="64" class="input" placeholder="Left">
</div>
<label class="checkbox-group" for="lockProportion">
<span class="toggle-switch">
<input type="checkbox" id="lockProportion" checked class="checkbox">
<span class="toggle-slider"></span>
</span>
Keep ratio
</label>
</div>
</div>
<div class="section">
<h2 class="section-title">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-swatch-book">
<path d="M11 17a4 4 0 0 1-8 0V5a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2Z"/>
<path d="M16.7 13H19a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H7"/>
<path d="M 7 17h.01"/>
<path d="m11 8 2.3-2.3a2.4 2.4 0 0 1 3.404.004L18.6 7.6a2.4 2.4 0 0 1 .026 3.434L9.9 19.8"/>
</svg>
Appearance
</h2>
<div class="input-group">
<label class="input-label">Text Color</label>
<div class="color-input">
<input type="color" id="textColor" value="#000000">
<span id="textColorHex">#000000</span>
</div>
</div>
<label class="checkbox-group" for="transparentBg">
<span class="toggle-switch">
<input type="checkbox" id="transparentBg" checked class="checkbox">
<span class="toggle-slider"></span>
</span>
Transparent
</label>
</div>
</div>
</div>
</div>
</aside>
</main>
<script src="js/script.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jszip/3.10.1/jszip.min.js"></script>
<!-- Modal de exportação -->
<div id="exportModal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h2>Export SpriteFont</h2>
<button class="close-modal">×</button>
</div>
<div class="modal-body">
<div class="export-options">
<div class="export-option" data-format="png">
<div class="export-icon">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="3" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-image">
<rect width="18" height="18" x="3" y="3" rx="2" ry="2"/>
<circle cx="9" cy="9" r="2"/>
<path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21"/>
</svg>
</div>
<div class="export-info">
<h3>PNG Image</h3>
<p>Image for use in games</p>
</div>
</div>
<div class="export-option" data-format="json">
<div class="export-icon">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-braces">
<path d="M8 3H7a2 2 0 0 0-2 2v5a2 2 0 0 1-2 2 2 2 0 0 1 2 2v5c0 1.1.9 2 2 2h1"/>
<path d="M16 21h1a2 2 0 0 0 2-2v-5c0-1.1.9-2 2-2a2 2 0 0 1-2-2V5a2 2 0 0 0-2-2h-1"/>
</svg>
</div>
<div class="export-info">
<h3>JSON <span>in test</span></h3>
<p>Data for general implementation</p>
</div>
</div>
<div class="export-option" data-format="construct2">
<div class="export-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1993.45 2016.93" fill="currentColor" stroke="none">
<path d="M1578.76,415.32c-111.65,111.25-223.52,222.6-334.83,334.31-40.95,32.33-69.23-.64-103.45-19.54-233.19-128.78-511.19,66.21-470.63,328.7,33.2,214.79,271.51,334.23,464.63,232.06,34.55-18.28,64.79-54.45,106.24-25.32,140.74,137.6,278.81,278.28,418.45,417.14,36.05,49.56-.51,77.88-36.48,107.39-51.62,42.35-111.05,81.75-170.37,112.49-27.82,14.42-53.62,31.62-84.9,13.89-20.14-11.41-21.16-23.4-29.58-42.38-71.63-161.55-302.87-105.51-295.38,66.49.87,20.03,4.89,29.6-6.15,48.74-18.99,32.93-50.96,27.76-83.27,26.69-123.7-4.08-242.29-28.96-356.28-76.5-20.81-8.68-60.85-23.47-73.43-41.52-28.48-40.87,7.67-68.55,18.69-106.11,41.55-141.71-120.69-254.28-239.06-166.1-13.22,9.85-23.71,24.9-39.09,30.88-49.3,19.18-75.6-28.31-99.75-62.14-71.71-100.44-128.23-220.03-157.43-340.33-6.23-25.66-13.04-46.81,4.34-70.26,20.46-27.6,58.08-21.29,88.61-34.33,130.08-55.56,120.23-245.75-15.15-287.05-19.67-6-42.42-4.43-59.4-15.56-41.27-27.06-20.53-78.2-9.58-116.35,33.73-117.5,90.89-232.73,165.02-329.73,13.98-18.29,25.92-37.94,50.16-42.79,42.01-8.4,56.58,26.28,88.14,44.2,123.16,69.95,266.22-48.48,221.37-182.39-10.95-32.7-38.37-51.89-22.63-89.67,10.45-25.07,38.32-34.21,61.47-44.48C689.39,36.82,811.14,8.1,932.02,1.94c37.07-1.89,87.34-10.02,106.67,30.34,10.4,21.72,2.46,41.41,3.77,64.2,8.8,152.37,216.89,197.89,288.07,63.1,12.53-23.72,12.54-46.5,39.93-60.02,26.78-13.22,46.98-2.04,70.86,9.85,57.32,28.54,114.98,66.09,165.35,105.51,15.62,12.22,52.66,39.89,60.69,56.25,11.75,23.94,5.63,47.87-11.14,67.17-22.62,26.02-52.68,52.29-77.46,76.98Z"/>
<path d="M1501.93,606.34c77.41-77.25,154.88-154.61,232.21-232.06,40.29-21.68,62.17,32.89,49.18,65.17-7.77,19.31-21.34,24.23-36.48,35.49-133.94,99.56-35.57,311.22,127.26,272.19,28.72-6.88,47.52-18.62,74.96,3.97,22.05,18.15,27.36,69.26,31.8,97.13,18.48,115.96,16.72,240.11-6.14,355.34-5.42,27.32-8.39,55.89-35.99,69.96-31.19,15.89-58.29-5.23-90.09-7.21-137.69-8.58-217.84,153.61-124.99,255.93,24.67,27.18,64.33,34.89,64.11,78.61-.15,29.19-26.81,63.38-56.62,39.84l-444.77-444.78c-26.62-31.96-7.16-58.62,3.04-90.96,19.86-62.95,19.33-131.37-.75-194.19-9.69-30.3-27-52.13-6.29-83.72,71.11-75.42,146.14-147.45,219.57-220.71ZM1456.3,1131.92v52.47h258.87v-70.47l-1.5-1.5h-136.43c-.62-2.36.6-1.69,1.28-2.29,62.41-55.14,150.9-125.73,125.15-221.6-23.92-89.07-130.14-97.07-203.36-67.44-14.46,5.85-27.21,13.72-39.97,22.55l23.96,61.88,24.95-15.51c93.61-44.31,148.88,20.16,85.39,105.38-37.79,50.73-94.1,91.43-138.35,136.52Z"/>
</svg>
</div>
<div class="export-info">
<h3>Construct 2 <span>in test</span></h3>
<p>Data formatted for Construct 2</p>
</div>
</div>
<div class="export-option" data-format="construct3">
<div class="export-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1638.53 1676.92" fill="currentColor" stroke="none">
<path class="cls-1" d="M1544.23,1245.93l-197.4-113.97-198.39-114.54c-10.63-6.14-24.16-2.97-30.99,7.24-60.16,89.95-162.66,149.18-278.99,149.18-124.12,0-232.5-67.43-290.5-167.66-28.55-49.34-44.89-106.62-44.89-167.72,0-184.34,149.27-335.38,335.38-335.38,116.33,0,218.84,59.23,278.99,149.18,6.81,10.19,20.37,13.36,30.99,7.24l198.39-114.54,197.4-113.97c11.37-6.56,15.06-21.25,8.17-32.42C1404.71,159.39,1140.2,0,838.46,0S257.2,168.58,112.21,419.16C40.85,542.5,0,685.71,0,838.46c0,460.85,373.17,838.46,838.46,838.46,301.74,0,566.25-159.39,713.93-398.56,6.89-11.16,3.19-25.86-8.17-32.42ZM349.64,1120.71c.34-.22.69-.44,1.05-.64-.36.21-.71.42-1.05.64Z"/>
<path class="cls-1" d="M1568.66,627.26l-295.93,170.86c-30.93,17.86-30.93,62.82,0,80.68l295.93,170.86c30.98,17.89,69.87-4.57,69.87-40.34v-341.71c0-35.77-38.89-58.23-69.87-40.34ZM1545.37,928.63l-156.19-90.18,156.19-90.18v180.35Z"/>
</svg>
</div>
<div class="export-info">
<h3>Construct 3 <span>beta</span></h3>
<p>Formatted data for Construct 3</p>
</div>
</div>
<div class="export-option" data-format="godot">
<div class="export-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 799.87 754.4" fill="currentColor" stroke="none">
<path d="M318.65,0c-36.45,8.2-72.65,19.52-106.65,36.6.78,29.95,2.73,58.6,6.65,87.63-13.15,8.48-26.95,15.75-39.2,25.65-12.5,9.5-25.25,18.75-36.6,29.95-22.65-14.85-46.47-28.9-71.22-41.28C45.05,167.08,20.32,197.93,0,232.43c15.23,24.75,31.25,47.78,48.45,69.8h.4v211.85c.4,0,.78,0,1.17.12l129.95,12.5c6.77.65,12.1,6.13,12.5,13.02l4.02,57.3,113.27,8.07,7.82-52.87c1.05-6.9,6.9-11.98,13.8-11.98h137.1c6.9,0,12.75,5.07,13.8,11.98l7.82,52.87,113.28-8.07,4.02-57.3c.4-6.9,5.73-12.38,12.62-13.02l129.82-12.5c.4,0,.78-.12,1.18-.12v-211.85h.52c17.2-21.88,33.07-45.05,48.3-69.8-20.17-34.5-45.05-65.37-71.62-93.88-24.6,12.37-48.58,26.43-71.23,41.28-11.32-11.2-23.95-20.45-36.45-29.95-12.38-9.9-26.18-17.2-39.32-25.65,3.9-29.03,5.85-57.67,6.65-87.63-33.85-17.05-70.05-28.37-106.65-36.6-14.58,24.6-27.87,51.17-39.45,77.07-13.8-2.22-27.72-3.12-41.52-3.25h-.65c-13.8.13-27.73,1.05-41.53,3.25-11.6-25.9-24.87-52.47-39.58-77.07h.13ZM215.9,310.15c43.23,0,78.25,35.15,78.25,78.38s-35.03,78.25-78.25,78.25-78.25-35.03-78.25-78.25,35.03-78.38,78.25-78.38ZM584.15,310.15c43.23,0,78.25,35.15,78.25,78.38s-35.03,78.25-78.25,78.25-78.25-35.03-78.25-78.25,35.03-78.38,78.25-78.38h0ZM223.32,341.28c-28.65,0-51.95,23.18-51.95,51.95s23.3,51.82,51.95,51.82,52.08-23.18,52.08-51.82-23.3-51.95-52.08-51.95ZM576.6,341.28c-28.65,0-51.95,23.18-51.95,51.95s23.3,51.82,51.95,51.82,51.95-23.18,51.95-51.82-23.18-51.95-51.95-51.95ZM400.02,356.38c13.92,0,25.25,10.15,25.25,22.78v72.13c0,12.62-11.32,22.92-25.25,22.92s-25.25-10.27-25.25-22.92v-72.13c0-12.63,11.33-22.78,25.25-22.78ZM48.72,542.05c0,12.62.12,26.3.12,29.02,0,123.45,156.5,182.68,350.9,183.33h.52c194.4-.65,350.78-59.9,350.78-183.33,0-2.72.12-16.4.25-29.02l-116.8,11.32-4.02,57.67c-.52,6.9-6,12.5-12.9,12.9l-139.45,9.9c-6.77,0-12.75-4.95-13.8-11.85l-7.95-53.9h-112.9l-7.95,53.9c-1.05,7.15-7.42,12.38-14.85,11.85l-138.28-9.9c-6.9-.52-12.5-6-13.02-12.9l-3.9-57.67-116.8-11.2.05-.12Z"/>
</svg>
</div>
<div class="export-info">
<h3>Godot <span>in test</span></h3>
<p>Bitmap font for Godot Engine</p>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>