add pre and post symbol

master
Dirk Heilig 2024-05-21 18:38:59 +02:00
parent 47b647e852
commit f7b75ae627
2 changed files with 20 additions and 3 deletions

View File

@ -1,10 +1,14 @@
name="mAdEx";
name="madex";
symbolPre="";
symbolPost="";
part=3; //[1:base,2:text,3:preview]
use <./font/LiberationSans-Bold.ttf>;
use <./font/Symbola_hint.ttf>;
label_thickness= 1.5;
font = "Liberation Sans:style=Bold";
symbolFont="Symbola:style=Regular";
font_size = 12;
font_offset = 9;
$fn = 128;
@ -30,8 +34,21 @@ module tag() {
translate([30, 15, 0]) cube([20, 3, 4 + label_thickness/2]);
}
module name(str) {
translate([-9, font_offset + font_size/2, -label_thickness/2 + 0.29]) rotate(v=[1,0,0],a=180) linear_extrude(0.3) translate([15, 0])
text(str, size=font_size, font = font);
translate([-9+15, font_offset + font_size/2, -label_thickness/2 + 0.29]) rotate(v=[1,0,0],a=180) linear_extrude(0.3) {
text(symbolPre,font_size,symbolFont);
symbolPreSize=textmetrics(symbolPre,font_size,font);
echo (symbolPreSize);
translate([symbolPreSize.size[0]+symbolPreSize.advance[0],0,0]){
text(str, size=font_size, font = font);
echo(textSize);
translate([textSize.advance[0],0,0]) text(symbolPost,font_size,symbolFont);
}
textSize=textmetrics(str, size=font_size, font = font);
}
}

Binary file not shown.