-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
254 lines (251 loc) · 14 KB
/
index.html
File metadata and controls
254 lines (251 loc) · 14 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="An online tool for generating C/C++ character or image byte arrays for dot matrix style OLED or LCD displays.">
<link rel="icon" href="favicon.png">
<title>Dot Matrix Tool - LCD Font Generator</title>
<link href="https://fonts.googleapis.com/css2?family=Roboto+Mono:wght@400;500&display=swap" rel="stylesheet">
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
<link href="cover.css" rel="stylesheet">
<script src="https://www.google-analytics.com/analytics.js" async></script>
<script>
window.ga=window.ga||function(){(ga.q=ga.q||[]).push(arguments)};ga.l=+new Date;
ga('create', 'UA-276334-9', 'auto');
ga('send', 'pageview');
</script>
</head>
<body>
<nav class="navbar navbar-dark bg-dark fixed-top">
<div class="container">
<a class="navbar-brand" href="#">Dot Matrix Tool</a>
<div class="ml-auto">
<div class="btn-group" role="group">
<button type="button" class="btn btn-outline-light btn-sm" id="langEn">English</button>
<button type="button" class="btn btn-outline-light btn-sm" id="langZh">中文</button>
</div>
</div>
</div>
</nav>
<div class="site-wrapper">
<div class="site-wrapper-inner">
<div class="container">
<div class="text-center mt-5">
<p class="text-muted">Left mouse button to draw. Right mouse button (or Ctrl+Left) to erase.</p>
<div class="my-4"></div>
<div id="_grid" oncontextmenu="return false;"></div>
<div class="my-3"></div>
<div class="row justify-content-center mb-3">
<div class="col-auto">
<button type="button" class="btn btn-outline-secondary btn-sm" id="generateButton">Generate</button>
</div>
<div class="col-auto">
<button type="button" class="btn btn-outline-secondary btn-sm" id="clearButton">Clear</button>
</div>
<div class="col-auto">
<button type="button" class="btn btn-outline-secondary btn-sm" id="saveButton">Save</button>
</div>
<div class="col-auto">
<label class="btn btn-outline-secondary btn-sm" for="loadInput">Load
<input type="file" id="loadInput" accept=".json" style="display: none;">
</label>
</div>
<div class="col-auto">
<button type="button" class="btn btn-outline-secondary btn-sm" id="importButton">Import</button>
</div>
<div class="col-auto">
<button type="button" class="btn btn-outline-secondary btn-sm" id="textInputButton">文本输入</button>
</div>
<div class="col-auto">
<button type="button" class="btn btn-outline-secondary btn-sm" id="exportJsonButton">导出JSON</button>
</div>
<div class="col-auto">
<button type="button" class="btn btn-outline-secondary btn-sm" id="exportCodeButton">导出代码</button>
</div>
</div>
<div class="row justify-content-center mb-3">
<div class="col-auto">
<div class="dropdown" id="byteDropDiv">
<button class="btn btn-outline-secondary btn-sm dropdown-toggle" type="button" id="byteDrop" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Byte Order: Column + Row <span class="caret"></span>
</button>
<div class="dropdown-menu" aria-labelledby="byteDrop">
<a class="dropdown-item" href="#">Byte Order: Row Major</a>
<a class="dropdown-item" href="#">Byte Order: Column Major</a>
<a class="dropdown-item" href="#">Byte Order: Column + Row</a>
</div>
</div>
</div>
<div class="col-auto">
<div class="dropdown" id="endianDropDiv">
<button class="btn btn-outline-secondary btn-sm dropdown-toggle" type="button" id="endianDrop" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Big Endian <span class="caret"></span>
</button>
<div class="dropdown-menu" aria-labelledby="endianDrop">
<a class="dropdown-item" href="#">Big Endian</a>
<a class="dropdown-item" href="#">Little Endian</a>
</div>
</div>
</div>
</div>
<div class="row justify-content-center mb-3">
<div class="col-auto">
<label for="widthInput">Width:</label>
<input type="number" id="widthInput" class="form-control form-control-sm d-inline-block" min="1" max="128" value="16" style="width: 100px;">
</div>
<div class="col-auto">
<label for="heightInput">Height:</label>
<input type="number" id="heightInput" class="form-control form-control-sm d-inline-block" min="1" max="128" value="16" style="width: 100px;">
</div>
</div>
<div class="my-3"></div>
<div id="_summary" class="text-muted"></div>
<div class="my-3"></div>
<div style="overflow-x: auto;">
<textarea id="_output" class="form-control" style="width: 100%; height: 200px;"></textarea>
</div>
</div>
</div>
</div>
</div>
<!-- Text Input Modal Dialog -->
<div class="modal fade" id="textInputModal" tabindex="-1" role="dialog" aria-labelledby="textInputModalLabel">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="textInputModalLabel">文本输入</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<div class="form-group">
<label for="textInputArea">输入文本:</label>
<textarea class="form-control" id="textInputArea" rows="4"></textarea>
</div>
<div class="form-row">
<div class="form-group col-md-6">
<label for="fontSizeSelect">字体大小:</label>
<select class="form-control" id="fontSizeSelect">
<option value="7x6">7×6 像素</option>
<option value="12x8">12×8 像素</option>
</select>
</div>
<div class="form-group col-md-6">
<label>文本对齐方式:</label>
<div class="form-check">
<input class="form-check-input" type="radio" name="textAlignment" id="alignLeft" value="left" checked>
<label class="form-check-label" for="alignLeft">
左对齐 (Left)
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="textAlignment" id="alignCenter" value="center">
<label class="form-check-label" for="alignCenter">
居中对齐 (Center)
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="radio" name="textAlignment" id="alignRight" value="right">
<label class="form-check-label" for="alignRight">
右对齐 (Right)
</label>
</div>
<small class="form-text text-muted">控制文本在点阵中的水平对齐方式:左侧对齐、居中对齐或右侧对齐</small>
</div>
</div>
<!-- 字体来源切换 -->
<div class="form-row">
<div class="form-group col-md-12">
<label id="labelFontSource">字体来源:</label>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="textSource" id="sourceEmbedded" value="embedded" checked>
<label class="form-check-label" for="sourceEmbedded">内置位图字体</label>
</div>
<div class="form-check form-check-inline">
<input class="form-check-input" type="radio" name="textSource" id="sourceSystem" value="system">
<label class="form-check-label" for="sourceSystem">系统字体</label>
</div>
</div>
</div>
<!-- 系统字体控件(默认隐藏) -->
<div id="systemFontControls" class="form-row" style="display: none;">
<div class="form-group col-md-6">
<label for="systemFontFamily">字体:</label>
<select class="form-control" id="systemFontFamily">
<option value="Courier New, Courier, monospace">Courier New</option>
<option value="Consolas, monospace">Consolas</option>
<option value="Monaco, monospace">Monaco</option>
<option value="Arial, Helvetica, sans-serif">Arial</option>
<option value="Times New Roman, Times, serif">Times New Roman</option>
<option value="Verdana, Geneva, sans-serif">Verdana</option>
<option value="'Microsoft YaHei','微软雅黑','Segoe UI',Arial,sans-serif">Microsoft YaHei / 微软雅黑</option>
<option value="SimSun,'宋体',NSimSun,serif">SimSun / 宋体</option>
<option value="KaiTi,'楷体',KaiTi_GB2312,serif">KaiTi / 楷体</option>
<option value="FangSong,'仿宋',STFangsong,serif">FangSong / 仿宋</option>
<option value="'PingFang SC','Hiragino Sans GB','Microsoft YaHei',Arial,sans-serif">PingFang SC / 苹方</option>
<option value="'Noto Sans SC','Microsoft YaHei','PingFang SC','Hiragino Sans GB',Arial,sans-serif">Noto Sans SC / 思源黑体</option>
<option value="'Microsoft JhengHei','微軟正黑體','Segoe UI',Arial,sans-serif">Microsoft JhengHei / 微軟正黑體</option>
<option value="monospace">monospace</option>
</select>
<small id="hintSystemFontFamily" class="form-text text-muted">选择系统中已安装的字体(不存在将回退)</small>
</div>
<div class="form-group col-md-6">
<label for="systemFontCustom">自定义字体族(可选):</label>
<input type="text" class="form-control" id="systemFontCustom" placeholder="例如: 'Courier New', 'SimSun', 'Microsoft YaHei'">
<small id="hintSystemFontCustom" class="form-text text-muted">留空则使用上面的选择项</small>
</div>
<div class="form-group col-md-3">
<label for="systemFontSize">字号(px):</label>
<input type="number" class="form-control" id="systemFontSize" value="12" min="6" max="128">
</div>
<div class="form-group col-md-3">
<label for="systemFontThreshold">阈值(0-255):</label>
<input type="range" class="form-control-range" id="systemFontThreshold" min="0" max="255" value="128">
<small id="hintSystemFontThreshold" class="form-text text-muted">越小越粗,越大越细</small>
</div>
</div>
<div id="textPositionControls" class="form-row">
<div class="form-group col-md-6">
<label for="textOffsetX">X位置 (水平偏移):</label>
<input type="number" class="form-control" id="textOffsetX" value="0" min="0">
<small class="form-text text-muted">文本在网格中的水平起始位置</small>
</div>
<div class="form-group col-md-6">
<label for="textOffsetY">Y位置 (垂直偏移):</label>
<input type="number" class="form-control" id="textOffsetY" value="0" min="0">
<small class="form-text text-muted">文本在网格中的垂直起始位置</small>
</div>
</div>
<div class="form-group">
<div class="form-check">
<input class="form-check-input" type="checkbox" id="mergeWithExisting" checked>
<label class="form-check-label" for="mergeWithExisting" id="labelMerge">
与现有内容合并
</label>
</div>
<small class="form-text text-muted" id="hintMerge">勾选时文本会与网格中现有内容合并,取消勾选时会替换现有内容</small>
</div>
<div class="form-group">
<label>预览:</label>
<div id="textPreviewArea" class="border p-2" style="min-height: 100px; background-color: #f8f9fa; overflow: auto;">
<div id="textPreviewContent" style="font-family: monospace; white-space: pre; text-align: left;"></div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">取消</button>
<button type="button" class="btn btn-primary" id="applyTextButton">应用</button>
</div>
</div>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.bundle.min.js"></script>
<script src="embedded-fonts.js"></script>
<script src="language.js"></script>
<script src="app.js"></script>
</body>
</html>