mirror of
https://github.com/rsheldiii/KeyV2.git
synced 2024-11-26 23:04:23 +00:00
Font can be explicitly set on a legend
... instead of using one font for all legends. Super handy for using a clear text font alongside an icon font.
This commit is contained in:
parent
ec44ef76de
commit
8fdd3dcb43
@ -1,9 +1,9 @@
|
|||||||
module keytext(text, position, font_size, depth) {
|
module keytext(text, position, font_size, font_face, depth) {
|
||||||
woffset = (top_total_key_width()/3.5) * position[0];
|
woffset = (top_total_key_width()/3.5) * position[0];
|
||||||
hoffset = (top_total_key_height()/3.5) * -position[1];
|
hoffset = (top_total_key_height()/3.5) * -position[1];
|
||||||
translate([woffset, hoffset, -depth]){
|
translate([woffset, hoffset, -depth]){
|
||||||
color($tertiary_color) linear_extrude(height=$dish_depth + depth){
|
color($tertiary_color) linear_extrude(height=$dish_depth + depth){
|
||||||
text(text=text, font=$font, size=font_size, halign="center", valign="center");
|
text(text=text, font=font_face, size=font_size, halign="center", valign="center");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -12,14 +12,14 @@ module legends(depth=0) {
|
|||||||
if (len($front_legends) > 0) {
|
if (len($front_legends) > 0) {
|
||||||
front_of_key() {
|
front_of_key() {
|
||||||
for (i=[0:len($front_legends)-1]) {
|
for (i=[0:len($front_legends)-1]) {
|
||||||
rotate([90,0,0]) keytext($front_legends[i][0], $front_legends[i][1], $front_legends[i][2], depth);
|
rotate([90,0,0]) keytext($front_legends[i][0], $front_legends[i][1], $front_legends[i][2], $front_legends[i][3], depth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (len($legends) > 0) {
|
if (len($legends) > 0) {
|
||||||
top_of_key() {
|
top_of_key() {
|
||||||
for (i=[0:len($legends)-1]) {
|
for (i=[0:len($legends)-1]) {
|
||||||
keytext($legends[i][0], $legends[i][1], $legends[i][2], depth);
|
keytext($legends[i][0], $legends[i][1], $legends[i][2], $legends[i][3], depth);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -158,15 +158,17 @@ module flat_support() {
|
|||||||
children();
|
children();
|
||||||
}
|
}
|
||||||
|
|
||||||
module legend(text, position=[0,0], size=undef) {
|
module legend(text, position=[0,0], size=undef, font=undef) {
|
||||||
font_size = size == undef ? $font_size : size;
|
font_size = size == undef ? $font_size : size;
|
||||||
$legends = [for(L=[$legends, [[text, position, font_size]]], a=L) a];
|
font_face = font == undef ? $font : font;
|
||||||
|
$legends = [for(L=[$legends, [[text, position, font_size, font_face]]], a=L) a];
|
||||||
children();
|
children();
|
||||||
}
|
}
|
||||||
|
|
||||||
module front_legend(text, position=[0,0], size=undef) {
|
module front_legend(text, position=[0,0], size=undef, font=undef) {
|
||||||
font_size = size == undef ? $font_size : size;
|
font_size = size == undef ? $font_size : size;
|
||||||
$front_legends = [for(L=[$front_legends, [[text, position, font_size]]], a=L) a];
|
font_face = font == undef ? $font : font;
|
||||||
|
$front_legends = [for(L=[$front_legends, [[text, position, font_size, font_face]]], a=L) a];
|
||||||
children();
|
children();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user