-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.html
1220 lines (1211 loc) · 56.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
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset=utf-8 />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>3DWriter</title>
<meta name="Description" content="Create perfect cursive handwriting using your 3DPrinter and a pen.">
<meta name="Keywords" content="pen printer,3dwriter,3d writer,3d printer pen,handwriting printer,3d printer,handwriting,cards,birthday,christmas,hershey,hershey font,handwritten,makenitso, maken it so,gcode">
<meta name="Author" content="Chris Mitchell">
<link rel="stylesheet" href="//use.fontawesome.com/releases/v5.8.2/css/all.css" integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
<link rel="stylesheet" href="//stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="//code.jquery.com/jquery-3.3.1.min.js" integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT" crossorigin="anonymous"></script>
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.min.js" crossorigin="anonymous"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="//stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
<link rel="stylesheet" href="//use.fontawesome.com/releases/v5.8.2/css/all.css" integrity="sha384-oS3vJWv+0UjzBfQzYUhtDYW+Pj2yciDJxpsK1OYPAYjqT085Qq/1cq5FLXAZQ7Ay" crossorigin="anonymous">
<script src="hershey.h.js" crossorigin="anonymous"></script>
<script src="bootbox.js" crossorigin="anonymous"></script>
<link rel="stylesheet" href="main.css">
<script async src="//www.googletagmanager.com/gtag/js?id=UA-140898484-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-140898484-1');
</script>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark">
<a class="navbar-brand" href="">3DWriter.io</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">File</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="#" onclick="project_open()">Open project</a>
<a class="dropdown-item" href="#" onclick="project_save()">Save project</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#" onclick="load_background()">Load background image</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Fonts</a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#fontabout">About fonts</a>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#user_fonts">User submitted fonts</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#" onclick="start_font_editor()">Font editor</a>
</div>
</li>
<li class="nav-item active">
<a class="nav-link" href="#" data-toggle="modal" data-target="#help">Help</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#" data-toggle="modal" data-target="#about">About</a>
</li>
<li>
<div class="ui-avatar">
<img src="">
</div>
</li>
</ul>
<form class="form-inline my-2 my-lg-0" action="//www.paypal.com/cgi-bin/webscr" method="post" target="_BLANK">
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="hosted_button_id" value="GF23DFGB6KMFA" />
<input type="image" src="donate.png" border="0" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Donate with PayPal button" />
<img alt="" border="0" src="//www.paypal.com/en_AU/i/scr/pixel.gif" width="1" height="1" />
</form>
</div>
</nav>
<div style="display:none;" id="tb_stash">
<div class="text_block dib" style="width:100%; gff:570px;position:relative; padding:4px;">
<div class="my_btn font_selection" title="Font" onclick="tb_conf(this, 'font')">
<i class="fas fa-font"></i>
<div class="content" data-val="scripts">scripts</div>
</div>
<div class="my_btn font-size" title="Font size" onclick="tb_conf(this, 'size')">
<i class="fas fa-text-height"></i>
<div class="content" data-val="12">12mm</div>
</div>
<div class="my_btn" title="Align left" onclick="tb_conf(this, 'left')">
<i class="fas fa-align-left"></i>
</div><div class="my_btn" title="Align center" style="margin-left: -1px;" onclick="tb_conf(this, 'center')">
<i class="fas fa-align-center"></i>
</div><div class="my_btn" title="Align right" style="margin-left: -1px;" onclick="tb_conf(this, 'right')">
<i class="fas fa-align-right"></i>
</div>
<div class="my_btn letter_Spacing" title="Letter spacing" onclick="tb_conf(this, 'letspac')">
<img src="letter_spacing.png" style="height:16px;width:16px;">
<div class="content" data-val="0">0 mm</div>
</div>
<div class="my_btn line_spacing" title="Line spacing" onclick="tb_conf(this, 'linspac')">
<img src="line_spacing.png" style="height:16px;width:16px;">
<div class="content" data-val="0">0 mm</div>
</div>
<div class="my_btn line_angle" title="Text rotation" onclick="tb_conf(this, 'linang')">
<img src="angle.png" style="height:16px;width:16px;">
<div class="content" data-val="0">0 deg</div>
</div>
<div style="width:55px;" class="txt_x_div adv_ctrl" >
X<small> mm</small><br>
<input type="text" class="txt_x" size=3 value="1" onkeyup="render_preview()">
</div>
<div style="width:55px;" class="txt_y_div adv_ctrl">
Y<small> mm</small><br>
<input type="text" class="txt_y" size=3 value="0" onkeyup="render_preview()">
</div>
<div class="dib my_btn" style="position:absolute;right:5px;top:3px;background-color:white;" onclick="text_block_remove(this);">
<Span class="fa fa-times dib" style="cursor:pointer;color:red;width:18px; height:18px;line-height:18px;text-align:center;"></span><br>
</div>
<br>
<div class="txt_txt_div dib" style="width:100%;margin-top:2px;">
<textarea class="txt_txt" rows="" cols="" placeholder="Write your text here" style="width:100%;height:80px;" onkeyup="render_preview()"></textarea>
</div>
<input type="text" id="txt_user_font_data" hidden>
<input type="text" id="txt_block_width" hidden>
<input type="text" id="txt_block_height" hidden>
</div>
</div>
<section class="content_section main_app">
<div class="container-fluid">
<div class="row">
<div class="col-sm-4">
<div class="panel-group" id="accordion">
<div class = "panel panel-default">
<div class = "panel-heading"><br>
<h4 class="panel-title">
<a data-toggle="collapse" class="accordion-toggle" href="#harware_setup" style="text-decoration:none;padding:4px; color:#333;">Hardware setup</a>
</h4>
</div>
<div id="harware_setup" class="panel-collapse collapse">
<table>
<tr>
<td width=110><label>Bed</label></td>
<td>X <small>mm</small></td>
<td>Y <small>mm</small></td>
</tr>
<tr>
<td></td>
<td><input type="text" id="set_bed_x" size=3 value="235" onchange="render_preview()"></td>
<td><input type="text" id="set_bed_y" size=3 value="235" onchange="render_preview()"></td>
</tr>
</table>
<table>
<tr>
<td width=110><label>Pen offset</label></td>
<td>X <small>mm</small></td>
<td>Y <small>mm</small></td>
</tr>
<tr>
<td></td>
<td><input type="text" id="set_pen_offset_x" size=3 value="0" onchange="render_preview()"></td>
<td><input type="text" id="set_pen_offset_y" size=3 value="30" onchange="render_preview()"></td>
</tr>
</table>
<table>
<tr>
<td width=110><label>Pen</label></td>
<td>Up <small>mm</small></td>
<td>Down <small>mm</small></td>
</tr>
<tr>
<td></td>
<td><input type="text" id="set_pen_up" size=3 value="15"></td>
<td><input type="text" id="set_pen_down" size=3 value="13.2"></td>
</tr>
</table>
<table>
<tr>
<td width=110><label>Travel speed</label></td>
<td><input type="text" id="set_travel_speed" size=4 value="100"></td>
<td><small>mm/sec</small></td>
</tr>
<tr>
<td><label>Draw speed</label></td>
<td><input type="text" id="set_draw_speed" size=4 value="30"></td>
<td><small>mm/sec</small></td>
</tr>
</table>
<table>
<tr>
<td width=110><label>Home</label></td>
<td><input type="checkbox" id="set_home_x" checked value="on"> X</td>
<td><input type="checkbox" id="set_home_y" checked value="on"> Y</td>
<td><input type="checkbox" id="set_home_z" checked value="on"> Z</td>
</tr>
</table>
<table>
<tr>
<td width=110><label>Dry Run</label></td>
<td colspan=3><input type="checkbox" id="set_dry_run" value="on"> <Small>Pen stays up</small></td>
</tr>
</table>
<table>
<tr>
<td width=110><label>Advanced</label></td>
<td colspan=3><input type="checkbox" id="set_adv_mode" value="on" onchange="set_adv(this.checked);"> <Small>show more options</small></td>
</tr>
</table>
</div>
</div>
</div>
<h4 class = "panel-title" style="text-decoration:none;padding:4px; color:#333;margin-top:20px;">
<input type="button" value=" Add a text block " onclick="new_text_block()" class="btn btn-success btn-sm" style="float:right;">
Your text
</h4>
<div class="text_blocks"></div>
<br>
<br>
Notes<br>
<small><i>5/06/2019: Text rotation is a little buggy and has been limited to 10 degrees.</i></small>
</div>
<div class="col-lg-8" style="border-left:1px solid #ccc;">
<div class="row" style="width:100%;max-width:800px;">
<div class="col-md-4 preview_controls" style="line-height: 60px;">
<span style="font-size:16pt; font-weight:500;line-height: 60px;text-decoration:none;color:#333;padding-left:22px;">Drawing preview</h4>
</div>
<div class="col-md-3" style="line-height: 60px;font-size:13pt;">
<div class="scale">
Scale: <select id="set_preview_scale" onchange="setting_update(this);">
<option value="1">1x</option>
<option value="2">2x</option>
<option value="3" selected>3x</option>
<option value="4">4x</option>
</select>
</div>
</div>
<div class="col-md-2" style="line-height: 60px;padding-top:5px;text-align:center;">
<!-- i class="fas fa-file-upload" style="font-size:16pt;cursor:pointer;" title="Load background image"></i -->
</div>
<div class="col-md-3 render_controls" style="line-height:60px;">
<input type="button" value=" Download GCode " onclick="render_gcode()" class="btn btn-warning" style="margin-right:45px;">
</div>
</div>
<div class="canvas_div">
<div class="dib" style="padding-left:20px;padding-bottom:20px;position:relative;">
<div class="ui_origin_x"></div><div class="ui_origin_y"></div><div class="ui_x-axis">X axis <span class="fa fa-arrow-right"></span></div><div class="ui_y-axis">Y axis <span class="fa fa-arrow-right"></span></div>
<canvas class="grid" id="preview_canvas"></canvas>
</div>
<div class="oob_text"><strong>Warning:</strong> Pen went outside of print area</div>
</div>
</div>
</div>
</div>
</section>
<section class="content_section font_edit_app bg_grad">
<div class="container-fluid">
<div class="row">
<div class="col-sm-4">
<div class="panel-group" id="accordion">
<div class = "panel panel-default">
<div class="panel-heading"><br>
<table>
<tr>
<td><h4 class="panel-title">Font editor</h4></td>
<td><input type="button" value=" Close " onclick="end_font_editor()" style="margin-left:40px;"></td>
</tr>
</table>
<i>The font editor will be here soon.</i>
</div>
</div>
</div>
</div>
</div>
</div>
</section>
<input type="file" id="project_upload_input" onchange="handle_upload(this.files)" style="display:none;" accept=".3dw">
<input type="file" id="imageLoader" name="imageLoader" style="display:none;">
<div class=" option_font" style="background-color:white !important">
<div class="font_menu"></div>
</div>
<div class="option_box option_size">
<div class="option_size_opt opt_5" onclick="tb_conf_click(this, 'size', 5);">5 mm</div>
<div class="option_size_opt opt_6" onclick="tb_conf_click(this, 'size', 6);">6 mm</div>
<div class="option_size_opt opt_7" onclick="tb_conf_click(this, 'size', 7);">7 mm</div>
<div class="option_size_opt opt_8" onclick="tb_conf_click(this, 'size', 8);">8 mm</div>
<div class="option_size_opt opt_10" onclick="tb_conf_click(this, 'size', 10);">10 mm</div>
<div class="option_size_opt opt_12" onclick="tb_conf_click(this, 'size', 12);">12 mm</div>
<div class="option_size_opt opt_14" onclick="tb_conf_click(this, 'size', 14);">14 mm</div>
<div class="option_size_opt opt_16" onclick="tb_conf_click(this, 'size', 16);">16 mm</div>
<div class="option_size_opt opt_18" onclick="tb_conf_click(this, 'size', 18);">18 mm</div>
<div class="option_size_opt opt_20" onclick="tb_conf_click(this, 'size', 20);">20 mm</div>
<div class="option_size_opt opt_22" onclick="tb_conf_click(this, 'size', 22);">22 mm</div>
<div class="option_size_opt opt_30" onclick="tb_conf_click(this, 'size', 30);">30 mm</div>
</div>
<div class="option_box option_letspac" style="padding:5px;">
<input type="text" class="option_letspac_txt" value="0" size=3 onkeydown="tb_conf_key(event, this);"> mm <input type="button" value=" OK " onclick="tb_conf_click(this, 'letspac', this.value)" class="btn btn-xs btn-info">
</div>
<div class="option_box option_linspac" style="padding:5px;">
<input type="text" class="option_linspac_txt" value="0" size=3 onkeydown="tb_conf_key(event, this);"> mm <input type="button" value=" OK " onclick="tb_conf_click(this, 'linspac', this.value)" class="btn btn-xs btn-info">
</div>
<div class="option_box option_linang" style="padding:5px;">
<input type="text" class="option_linang_txt" value="0" size=3 onkeydown="tb_conf_key(event, this);"> deg <input type="button" value=" OK " onclick="tb_conf_click(this, 'linang', this.value)" class="btn btn-xs btn-info">
</div>
<div class="modal fade" id="fontabout">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Fonts</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<p>The fonts used in the project are a derivitive of the <a href="https://en.wikipedia.org/wiki/Hershey_fonts" target="_BLANK">HERSHEY fonts</a>.</p>
<p>
These are NOT regular font files, Other fonts like the ones your computer use will not work here.<br>The original files are almost cryptic in nature and impossible to work with.<br>
<div class="dib dark">
<div style="padding:2px;"> The Hershey file format...for example</div>
<img src="hershey_format.png" style="margin:2px;padding:3px;">
</div><br>
So i have converted them to an easier structure for use here.<br>
</p>
<p>
All of the original Hershey fonts are available for use.
</p>
<p>
<strong>Font editor</strong><br>
<font color=red>28-05-2019 This is a work in progress</font><br>
Please check back here or on github for up to date information</font><br>
When the font editor is complete you can sign in using a google account and will be able to create & edit fonts as well as choose other user generated fonts that they have allowed for use.<br>
<br>
Until this <font color=red>RED</font> message above goes away, using the font editor will likely be a dissapointing adventure.<br>
<br>
The font editor is a complex bit of code and until i'm satisfied that you will be able to use it reliably and not lose your work i suggest avoiding it.
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="about">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">About 3D Writer</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<p>This website enables you to create written pages of text using your 3D Printer just by strapping a pen to it.</p>
<p>The easiest way to attach a pen is by using a few rubber bands. Perhaps printing a <A href="https://www.thingiverse.com/thing:2044609" target="_BLANK">pen holder</a> attachment would be appropriate</p>
<p><strong>Note:</strong> The GCode files generated by this site have only been tested on a Tevo Flash which is a cartesian style printer (Like the Prusa or Creality CR-10). If you have a delta please let me know if this works for you (perhaps there is an issue with my origin not being centered).<br>
<b>Use at your own risk;</b> I am not to be held liable for damages incured during the use of this software, my recomendation is to use Pronterface to preview your 3DWriter GCode files prior to printing and keep you finger on the OFF switch for the first few prints.</p>
<p>
<img src="youtube.png"><br>Here's some YouTube videos of the original software doing it's thing. This version is much the same except there's no program to download, just use it for whatever you want, whenever you like.<br>
Watch the original video from 2017 <a href="https://youtu.be/yK_YGwMRR40" target="_BLANK">Here on youTube</a><br>
The updated version that supports <a href="https://youtu.be/_dHTEbX50wU" target="_BLANK">laser engraving</a><br>
Or watch it write <a href="https://youtu.be/7aUX_X2yCqU" target="_BLANK">some xmas cards</a><br>
</p>
<p>
Original code on <A href="https://github.com/boy1dr/3DWriter" target="_BLANK">GitHub</a><br>
This right here is a brand new version of 3DWriter writen in HTML5/JavaScript.<br>It's free to use and always will be.
</p>
<p>
Check out my <a href="http://youtube.com.au/c/maken_it_so" target="_BLANK">YouTube channel</a> for lots of nerdy/fun projects.
</p>
<hr>
<strong>Privacy</strong><br>
This site does not need or use any of your personal details for any reason.
<hr>
<p>
If you like this site please consider donating some monies to help keep it maintained and hosted, even if it's only a couple of dollars.<br>
<center><form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_BLANK">
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="hosted_button_id" value="GF23DFGB6KMFA" />
<input type="image" src="https://www.paypalobjects.com/en_AU/i/btn/btn_donateCC_LG.gif" border="0" name="submit" title="PayPal - The safer, easier way to pay online!" alt="Donate with PayPal button" />
<img alt="" border="0" src="https://www.paypal.com/en_AU/i/scr/pixel.gif" width="1" height="1" />
</form></center>
Cheers,
Chris.
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="user_fonts">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">User fonts</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<p>This feature is not yet ready for use<p>
<p>See "About fonts" for more information.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="font_editor">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Font editor</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<p>This feature is not yet ready for use<p>
<p>See "About fonts" for more information.</p>
<p>If you came here from "About fonts", I told you this would be disappointing.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<div class="modal fade" id="help">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Help!</h4>
<button type="button" class="close" data-dismiss="modal">×</button>
</div>
<div class="modal-body">
<iframe width="560" height="315" src="https://www.youtube.com/embed/hTI48P-svIQ" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe><br>
<p>
<strong>The short version</strong><br>
Be sure to check the settings in "hardware setup" to make sure they match your printer...especially the bed X & Y measurements.<br>
If you have an older/home made printer that doesn't go so fast reduce the travel & draw speeds.
</p>
<p>
Once your pen is attached to your printer, use its inbuilt move functions to find the appropriate pen up & down heights.
</p>
<strong>Writting text</strong><br>
<p>
Find the "Welcome to 3d Writer!" textbox on the left of the screen and write your text there.<br>
You can position your text by dragging it around in the preview window.<br>
<table>
<tr>
<td><strong>Font:</strong></td><td>The style of the written text. Choose from the "Simple fonts" section if you are not sure.</td>
</tr>
<tr>
<td><strong>Letter height:</strong></td><td>How big your written text will be, in millimeters.</td></tr>
</tr>
<tr>
<td><strong>Letter Spacing: </strong></td><td>How far apart the letters are.</td>
</tr>
<tr>
<td><strong>Line spacing:</strong></td><td>The gap between the lines. it's OK to use a negative number here.</td>
</tr>
</table>
<p>If you want more than 1 block of text, click the green "Add text block" button to add more.</p>
<p>
When you are hapy with the print preview, click the yellow "Download GCode" button and save it. Load the file in to your printer as you would normally and print it.<br>
I suggest having a piece of paper clipped to your printbed using binder clips (as seen in the videos on the About page).
</p>
<p>
<strong>Project Save/Open</strong><br>
You may save your current settings and text blocks by clicking File > Save.<br>
And open it up again by clicking File > Open<br>
<i>Note: This is a HTML5 application and does not use a server backend. Nothing you upload to this page leaves your computer</i>
</p>
<p>
<strong>Background image</strong>
<p>
If you are writing on a birthday card then you can take a photo of it on your printer bed and load it as a background in 3DWriter.<br>
This is so you can get all the text alignments right.
</p>
<p>The size of your background image must match your printers X & Y dimensions as pixels.</p>
<p>
For example...<br>
If you have a 200mm x 200mm print bed, the background image should be 200x200 pixels.<br>
The background image uses the scale value above the drawing preview.<br>
<i>Note: You are only uploading to this HTML page, the background image never leaves your computer.</i>
</p>
</p>
<p>
Please read the instructions on the Github page before making contact.
</p>
</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<script>
var canvas;
var GCODE_DATA = "";
var font = "";
var background_image;
var background_image_set = false;
var imageLoader = document.getElementById('imageLoader');
var curAngle = 0;
imageLoader.addEventListener('change', handleImage, false);
$(function(){
init_canvas();
init_fonts();
new_text_block("Welcome to 3D Writer !", "cursive", 1, 0 , 0, 0);
update_bed_size();
render_preview();
init_font_selection();
$("#harware_setup table td input[type=text]").on("change", function(){
setting_update( $(this) );
});
});
function init_fonts(){
font = jQuery.parseJSON(hershey);
}
function init_canvas(){
canvas = document.getElementById('preview_canvas');
canvas.width = 800;
canvas.height = 600;
}
function setting_update(obj){
var val = $(obj).val();
var id = $(obj).prop("id");
if(id=='set_bed_x' || id=='set_bed_y' || id=='set_preview_scale') update_bed_size();
render_preview();
}
function new_text_block(text = "New text", font_name = "cursive", x = null, y = null, letspace = 0, linspace = 0, size = 12){
if(x==null){
x = 1;
}
if(y==null){
y = parseFloat($(".text_block .txt_y").last().val())+20;
}
$("#tb_stash .text_block").clone().appendTo(".text_blocks");
var tb = $(".text_block").last();
$(tb).find(".txt_x").val(x);
$(tb).find(".txt_y").val(y);
$(tb).find(".txt_txt").val(text);
$(tb).find(".font-size").find(".content").html(size+"mm");
$(tb).find(".font-size").find(".content").data("val", size);
$(tb).find(".letter_Spacing").find(".content").html(letspace);
$(tb).find(".letter_Spacing").find(".content").data("val", letspace);
$(tb).find(".line_spacing").find(".content").html(linspace);
$(tb).find(".line_spacing").find(".content").data("val", linspace);
render_preview();
}
function text_block_remove(obj){
$(obj).parent().remove();
render_preview();
}
function update_bed_size(){
var mag = $("#set_preview_scale").val();
var x = $("#set_bed_x").val() * mag;
var y = $("#set_bed_y").val() * mag;
$("#preview_canvas").css({ width:x, height:y});
canvas.width = x;
canvas.height = y;
}
function set_adv(opt){
if(opt){
$(".adv_ctrl").css("display","inline-block");
}else{
$(".adv_ctrl").css("display","none");
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// FILE FUNCTIONS //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function project_open(){
$("#project_upload_input").trigger("click");
}
function handle_upload(file){
readFileIntoMemory(file[0], function(fileInfo) {
console.info("Read file " + fileInfo.name + " of size " + fileInfo.size);
var project = jQuery.parseJSON(fileInfo.content);
console.log(project);
$("#set_preview_scale").val(project.screen_scale);
$("#set_bed_x").val(project.bed_x);
$("#set_bed_y").val(project.bed_y);
$("#set_pen_offset_x").val(project.x_pen_offset);
$("#set_pen_offset_y").val(project.y_pen_offset);
$("#set_home_x").prop("checked",project.set_home_x);
$("#set_home_y").prop("checked",project.set_home_y);
$("#set_home_z").prop("checked",project.set_home_z);
$("#set_dry_run").prop("checked",project.set_dry_run);
$("#set_pen_up").val(project.penup);
$("#set_pen_down").val(project.pendown);
$("#set_travel_speed").val(project.travel_speed);
$("#set_draw_speed").val(project.draw_speed);
$(".text_blocks .text_block").remove();
for(var tb in project.textblocks){
new_text_block(project.textblocks[tb].words , project.textblocks[tb].font_name, project.textblocks[tb].position_x, project.textblocks[tb].position_y , project.textblocks[tb].letter_spacing, project.textblocks[tb].line_spacing, project.textblocks[tb].height_mm);
}
});
}
function readFileIntoMemory (file, callback) {
var reader = new FileReader();
reader.onload = function () {
callback({
name: file.name,
size: file.size,
type: file.type,
content: this.result
});
};
reader.readAsText(file);
}
function project_save(){
var screen_scale = $("#set_preview_scale").val();
var bed_x = $("#set_bed_x").val();
var bed_y = $("#set_bed_y").val();
var x_pen_offset = $("#set_pen_offset_x").val();
var y_pen_offset = $("#set_pen_offset_y").val();
var g_set_home_x = $("#set_home_x").prop("checked");
var g_set_home_y = $("#set_home_y").prop("checked");
var g_set_home_z = $("#set_home_z").prop("checked");
var g_set_dry_run = $("#set_dry_run").prop("checked");
var g_penup = $("#set_pen_up").val();
var g_pendown = $("#set_pen_down").val();
var g_travel_speed = $("#set_travel_speed").val();
var g_draw_speed = $("#set_draw_speed").val();
var output_blocks = [];
$(".text_blocks .text_block").each(function() {
var words = $(this).find(".txt_txt_div").find(".txt_txt").val();
var height_mm = $(this).find(".font-size").find(".content").data("val");
var letter_spacing = parseFloat($(this).find(".letter_Spacing").find(".content").data("val"));
var line_spacing = parseFloat($(this).find(".line_spacing").find(".content").data("val"));
var font_name = $(this).find(".font_selection").find(".content").data("val");
var position_x = parseFloat($(this).find(".txt_x_div").find(".txt_x").val());
var position_y = parseFloat($(this).find(".txt_y_div").find(".txt_y").val());
output_blocks.push({
words: words,
height_mm: height_mm,
letter_spacing: letter_spacing,
line_spacing: line_spacing,
font_name: font_name,
position_x: position_x,
position_y: position_y
});
});
var output = {
screen_scale:screen_scale,
bed_x: bed_x,
bed_y: bed_y,
x_pen_offset: x_pen_offset,
y_pen_offset: y_pen_offset,
set_home_x: g_set_home_x,
set_home_y: g_set_home_y,
set_home_z: g_set_home_z,
set_dry_run: g_set_dry_run,
penup: g_penup,
pendown: g_pendown,
travel_speed: g_travel_speed,
draw_speed: g_draw_speed,
textblocks: output_blocks
};
console.log(output);
var element = document.createElement('a');
element.setAttribute('href', 'data:text/plain;charset=utf-8,' + encodeURIComponent( JSON.stringify(output) ));
element.setAttribute('download', 'project.3dw');
element.style.display = 'none';
document.body.appendChild(element);
element.click();
document.body.removeChild(element);
}
function load_background(){
$("#imageLoader").trigger("click");
}
function handleImage(e){
var reader = new FileReader();
reader.onload = function(event){
var img = new Image();
img.onload = function(){
background_image = img;
background_image_set = true;
render_preview();
}
img.src = event.target.result;
}
reader.readAsDataURL(e.target.files[0]);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// TEXT BLOCK FUNCTIONS - START ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var option_font_obj;
var option_size_obj;
var option_letspac_obj;
var option_linspac_obj;
var option_linang_obj;
function tb_conf(obj, verb){
var pos = $( obj ).offset();
if(verb=='font'){
option_font_obj = obj;
var this_val = $(obj).find(".content").data("val");
$(".option_font").css({top:pos.top, left:pos.left}).show();
}
if(verb=='size'){
option_size_obj = obj;
var this_val = $(obj).find(".content").data("val");
$(".option_size").css({top:pos.top, left:pos.left}).show();
$(".option_size #tb_id").val();
$(".option_size_opt").css("font-weight","normal");
$(".opt_"+this_val).css("font-weight","bold");
}
if(verb=='left'){
$(obj).parent().find(".txt_x_div").find(".txt_x").val(0);
render_preview();
}
if(verb=='center'){
var this_width = $(obj).parent().find("#txt_block_width").val();
var bed_x = parseInt($("#set_bed_x").val());
$(obj).parent().find(".txt_x_div").find(".txt_x").val( (bed_x/2) - (this_width/2) );
render_preview();
}
if(verb=='right'){
var this_width = $(obj).parent().find("#txt_block_width").val();
var x_pen_offset = parseFloat($("#set_pen_offset_x").val());
var bed_x = parseInt($("#set_bed_x").val());
$(obj).parent().find(".txt_x_div").find(".txt_x").val( bed_x - this_width - x_pen_offset -2 );
render_preview();
}
if(verb=='letspac'){
option_letspac_obj = obj;
$(".option_letspac").css({top:pos.top, left:pos.left}).show().find(".option_letspac_txt").focus().select();
}
if(verb=='linspac'){
option_linspac_obj = obj;
$(".option_linspac").css({top:pos.top, left:pos.left}).show().find(".option_linspac_txt").focus().select();
}
if(verb=='linang'){
option_linang_obj = obj;
$(".option_linang").css({top:pos.top, left:pos.left}).show().find(".option_linang_txt").focus().select();
}
}
function tb_conf_key(e, obj){
if(e.key=='Enter'){
$(obj).next().trigger("click");
}
}
function tb_conf_click(obj, verb, val){
if(verb=='font'){
$(".option_font").hide();
$(option_font_obj).find(".content").html(val);
$(option_font_obj).find(".content").data("val", val);
render_preview();
}
if(verb=='size'){
$(".option_size").hide();
$(option_size_obj).find(".content").html(val+" mm");
$(option_size_obj).find(".content").data("val", val);
render_preview();
}
if(verb=='letspac'){
$(".option_letspac").hide();
var this_val = $(obj).prev().val();
$(option_letspac_obj).find(".content").html(this_val);
$(option_letspac_obj).find(".content").data("val", this_val);
render_preview();
}
if(verb=='linspac'){
$(".option_linspac").hide();
var this_val = $(obj).prev().val();
$(option_linspac_obj).find(".content").html(this_val);
$(option_linspac_obj).find(".content").data("val", this_val);
render_preview();
}
if(verb=='linang'){
$(".option_linang").hide();
var this_val = $(obj).prev().val();
if(this_val>10) this_val=10;
if(this_val<-10) this_val=-10;
$(option_linang_obj).find(".content").html(this_val);
$(option_linang_obj).find(".content").data("val", this_val);
render_preview();
}
}
function init_font_selection(){
var first = ['cursive', 'futural', 'scripts', 'timesi', 'timesr'];
$(".option_font .font_menu").append('<span class="font_menu_title">Simple fonts</span>');
for(var key in first){
var font_height = parseFloat(font[first[key]][2]);
$(".option_font .font_menu").append( '<div class="hf_div" style="height:'+(font_height+8)+'px;" onclick="tb_conf_click(this,\'font\',\''+first[key]+'\');"><label>'+first[key]+'</label><canvas class="font_sel_canvas" id="canvas_'+first[key]+'"></canvas></div>' );
render_example( first[key] );
}
$(".option_font .font_menu").append('<span class="font_menu_title">Complex fonts</span>');
for(var key in font){
if( !(key=='cursive' || key=='futural' || key=='scripts' || key=='timesi' || key=='timesr') ){
var font_height = parseFloat(font[key][2]);
$(".option_font .font_menu").append( '<div class="hf_div" style="height:'+(font_height+8)+'px;" onclick="tb_conf_click(this,\'font\',\''+key+'\');"><label>'+key+'</label><canvas class="font_sel_canvas" id="canvas_'+key+'"></canvas></div>' );
render_example( key );
}
}
}
function render_example(fname){
var words = "The quick brown fox jumps over the lazy dog";
var obj = document.getElementById("canvas_"+fname);
var fonts_real_height = parseFloat(font[fname][2]);
obj.width = 800;
obj.height = fonts_real_height+5;
var ctex = obj.getContext("2d");
ctex.clearRect(0, 0, obj.width, obj.height);
ctex.fillStyle = "#FFFFFF";
ctex.fillRect(0, 0, obj.width, obj.height);
ctex.lineWidth = 0.5;
var fwidth = 0;
var x=1;
var y=1;
var print_scale_factor=1;
for(pos=0; pos<words.length; pos++){
var this_character = words.substr(pos, 1);
var font_character = fetch_character(fname, this_character);
var coords = font_character[1].split(",");
var real_width = parseFloat(coords[0]);
for(i=2; i<(coords.length-2); i=i+4){
var x1 = ((parseFloat(coords[i+0])*print_scale_factor)+x)*1;
var y1 = ((parseFloat(coords[i+1])*print_scale_factor)+y)*1;
var x2 = ((parseFloat(coords[i+2])*print_scale_factor)+x)*1;
var y2 = ((parseFloat(coords[i+3])*print_scale_factor)+y)*1;
ctex.beginPath();
ctex.moveTo( parseInt(x1), parseInt(y1));
ctex.lineTo(parseInt(x2), parseInt(y2));
ctex.stroke();
}
x+=real_width;
}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// RENDER FUNCTIONS - START ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function out_of_bounds(){
$(".oob_text").show();
}
function fetch_character(fontname, symbol){
var characters = font[fontname][0];
for(cpos=0; cpos < characters.length; cpos++){
if(characters.substr(cpos,1)==symbol){
return font[fontname][1][cpos];
}
}
return false;
}
function write_character(obj, x, y, height, print_scale_factor, screen_scale_factor, angle = 0, width = 16){
var ctx = canvas.getContext("2d");
ctx.lineWidth = 1;
ctx.translate(0.5, 0.5);
var coords = obj;
height = parseFloat(height);
var bed_x = parseInt($("#set_bed_x").val());
var bed_y = parseInt($("#set_bed_y").val());
for(i=2; i<(obj.length-2); i=i+4){
obj[i+0] = parseFloat( obj[i+0] );
obj[i+1] = parseFloat( obj[i+1] );
obj[i+2] = parseFloat( obj[i+2] );
obj[i+3] = parseFloat( obj[i+3] );
var x1 = (obj[i+0] * print_scale_factor) + x;
var y1 = (obj[i+1] * print_scale_factor) + y;
var x2 = (obj[i+2] * print_scale_factor) + x;
var y2 = (obj[i+3] * print_scale_factor) + y;
var rotext_start = rotate(x*print_scale_factor, y*print_scale_factor, x1, y1, 0-angle); //BUG:5/06/2019: my origin is not correct.
var rotext_end = rotate(x*print_scale_factor, y*print_scale_factor, x2, y2, 0-angle); //BUG:5/06/2019: my origin is not correct.
x1 = rotext_start[0] * screen_scale_factor;
y1 = rotext_start[1] * screen_scale_factor;
x2 = rotext_end[0] * screen_scale_factor;
y2 = rotext_end[1] * screen_scale_factor;
ctx.beginPath();
ctx.moveTo( parseInt(x1), parseInt(y1));
ctx.lineTo( parseInt(x2), parseInt(y2));
ctx.stroke();
var gc_x1 = (obj[i+0] * print_scale_factor)+x;
var gc_y1 = (bed_y - y)-(obj[i+1] * print_scale_factor);
var gc_x2 = (obj[i+2] * print_scale_factor)+x;
var gc_y2 = (bed_y-y)-(obj[i+3] * print_scale_factor);
rotext_start = rotate(height * screen_scale_factor, bed_y, gc_x1, gc_y1, angle); //BUG:5/06/2019: my origin is not correct.
rotext_end = rotate(height * screen_scale_factor, bed_y, gc_x2, gc_y2, angle); //BUG:5/06/2019: myorigin is not correct.
gc_x1 = rotext_start[0];
gc_y1 = rotext_start[1];
gc_x2 = rotext_end[0];
gc_y2 = rotext_end[1];
if( gc_x1>bed_x || gc_x1<0 || gc_y1>bed_y || gc_y1<0 || gc_x2>bed_x || gc_x2<0 || gc_y2>bed_y || gc_y2<0 ){ //test if pen went out of bounds
out_of_bounds();
}
GCODE_DATA.push( [ gc_x1, gc_y1, gc_x2, gc_y2 ]);
}
ctx.translate(-0.5, -0.5);
}
function line(ctx, x1, y1, x2, y2){
ctx.beginPath();
ctx.moveTo( x1, y1 );
ctx.lineTo( x2, y2 );
ctx.stroke();
}
function rotate(cx, cy, x, y, angle) {
//Credit: https://stackoverflow.com/a/17411276
var radians = (Math.PI / 180) * angle,
cos = Math.cos(radians),
sin = Math.sin(radians),
nx = (cos * (x - cx)) + (sin * (y - cy)) + cx,
ny = (cos * (y - cy)) - (sin * (x - cx)) + cy;
return [nx, ny];
}
function render_preview(){
$(".oob_text").hide();
$(".tb_border").remove();
var screen_scale = parseInt($("#set_preview_scale").val());
var x_pen_offset = parseFloat($("#set_pen_offset_x").val());
var y_pen_offset = parseFloat($("#set_pen_offset_y").val());
var bed_x = parseInt($("#set_bed_x").val());
var bed_y = parseInt($("#set_bed_y").val());
var ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, canvas.width, canvas.height);
ctx.fillStyle = "#FFFFFF";
ctx.fillRect(0, 0, canvas.width, canvas.height);
ctx.lineWidth = 0.2;
ctx.translate(0.5, 0.5);
ctx.strokeStyle = "#7da5c8";
if(background_image_set){
var sx = background_image.width * screen_scale;
var sy = background_image.height * screen_scale;
ctx.drawImage(background_image,0,0, sx, sy);
}
for(xy=1; xy<=canvas.width; xy=xy+(10*parseFloat(screen_scale))){
ctx.beginPath();
ctx.moveTo( 0, xy);
ctx.lineTo( canvas.width, xy);
ctx.stroke();
ctx.beginPath();
ctx.moveTo( xy , 0);
ctx.lineTo( xy, canvas.height);
ctx.stroke();
}
ctx.lineWidth = 1;
ctx.strokeStyle = "#b0ceff";
line(ctx, 0, 0, bed_x*screen_scale, 0);
line(ctx, 0, bed_y*screen_scale-1, bed_x*screen_scale, bed_y*screen_scale-1);
line(ctx, 0, 0, 0, bed_y*screen_scale);
line(ctx, (bed_x*screen_scale)-1, 0, (bed_x*screen_scale)-1, (bed_y*screen_scale));
ctx.strokeStyle = "#ffcc66";
ctx.beginPath();
if(y_pen_offset>0){
ctx.moveTo( 0, y_pen_offset*screen_scale);
ctx.lineTo( canvas.width, y_pen_offset*screen_scale);
}else{
ctx.moveTo( 0, (bed_y+y_pen_offset)*screen_scale);
ctx.lineTo( canvas.width, (bed_y+y_pen_offset)*screen_scale);
}
ctx.stroke();
ctx.beginPath();
if(x_pen_offset>0){
ctx.moveTo( x_pen_offset*screen_scale, 0);
ctx.lineTo( x_pen_offset*screen_scale, canvas.height);
}else{
ctx.moveTo( (bed_x+x_pen_offset)*screen_scale, 0);
ctx.lineTo( (bed_x+x_pen_offset)*screen_scale, canvas.height);
}
ctx.stroke();
ctx.strokeStyle = "#000000";
ctx.translate(-0.5, -0.5);
ctx.lineWidth = 1;
GCODE_DATA = [];
var real_width = 0;
var block_count = 0;
var invalid_chars_count = 0;
var invalid_chars = "";
$(".text_blocks .text_block").each(function() {
var words = $(this).find(".txt_txt_div").find(".txt_txt").val();
var height_mm = $(this).find(".font-size").find(".content").data("val");
var letter_spacing = parseFloat($(this).find(".letter_Spacing").find(".content").data("val"));
var line_spacing = parseFloat($(this).find(".line_spacing").find(".content").data("val"));
var line_angle = parseFloat($(this).find(".line_angle").find(".content").data("val"));
var font_name = $(this).find(".font_selection").find(".content").data("val");
var position_x = parseFloat($(this).find(".txt_x_div").find(".txt_x").val());
var position_y = parseFloat($(this).find(".txt_y_div").find(".txt_y").val());
var x = x_pen_offset+position_x;
var y = y_pen_offset+position_y;
var original_x = x;
var original_y = y;
var block_width = 0;
var block_height = 0;
var height = (height_mm);
var real_height = 0;
var fonts_real_height = font[font_name][2];
var fwidth = 0;
for(pos=0; pos<words.length; pos++){
var this_character = words.substr(pos, 1);
if(this_character==" "){
var font_character = fetch_character(font_name, this_character);
var left_right_width = font_character[0].split("/");
var font_strokes = font_character[1].split(",");
real_width = parseFloat(font_strokes[0]);
var scaled_width = real_width * scale_factor;
x+=scaled_width;
}else if(this_character=="\n"){
y+=parseFloat(height)+line_spacing;
x=original_x;
}else{
var font_character = fetch_character(font_name, this_character);
if(font_character===false){