You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Is there a better way to do multiline legends across a whole keyboard? #163
Related to issue #21. The provided example, while very helpful for understanding the basics, does not seem to scale up for generating most of a keyboard in one go.
Is there an better way to implement multiline legends in a similar way to how normal legends are generated? For example, with "dataframes" like this:
If you add another legend() entry in the call to key_profile() in layout.scad, you can get it to generate a second set of legends.
i.e. replace legend(legends ? legends[row][column] : "") with something like legend(legends ? legends[row][column] : "", [0,-1]) legend(alt_legends ? alt_legends[row][column] : "", [0,1]) and pass in an appropriately named array to the call to layout(). You also need to specify a position for each of these if you don't want them on top of each other. There are some less-hacky ways to do this, but tweaking the positions gave good results for me.
@Ashgar225 Thank you! That works great. Currently, in my layout.scad, there's a whole series of alt_legends_x. Then it would get loaded in properly as long as a corresponding alt_legends_x variable exists in keys.scad.
Would you also happen to know how the font size could be specified individually for each legend? In my keys.scad, only $font_size = x; works, but it applies to all fonts. In this documentation, there's a mention of an argument for legend(), but this does not appear to work for me.
Supplying size=4 or similar as an argument (or just as a third argument, when also providing a position) to legend() does seem to work for me, and even overrides any earlier declaration of $font_size and works with different legends on the same key. Not sure what you're running into on that one.
Also, I think your link is not quite going to the right place.
There's a good chance I've done something wrong, been very jankily copy pasting parts of code from all over the place. I'll just upload the code here, and if you (or anyone else) is free to take a look, please let me know how it could be resolved/what's the best practice.
So there's 3 files I've changed from a fresh github pull: keys.scad, layout.scad (the workaround suggested above), and skeletyl_legends.scad (frankensteined from another contributor's dactyl manuform layout. The generating/rendering is done in keys.scad.
So, currently, even with no legends() call in keys.scad, the corresponding legends still get generated.
Adding a legends() or legends(topleft_legends, size=5), etc, appear to have no effect on the generation.
(zipped because github doesn't accept .scad files) changed_files.zip
The layout functionality does too much in this repo, and I want to switch everything over to using simple_layout. This use case is a perfect example of why, here's how you'd solve this with simple_layout:
Activity
Ashgar225 commentedon Jul 14, 2022
If you add another
legend()entry in the call tokey_profile()in layout.scad, you can get it to generate a second set of legends.i.e. replace
legend(legends ? legends[row][column] : "")with something likelegend(legends ? legends[row][column] : "", [0,-1]) legend(alt_legends ? alt_legends[row][column] : "", [0,1])and pass in an appropriately named array to the call tolayout(). You also need to specify a position for each of these if you don't want them on top of each other. There are some less-hacky ways to do this, but tweaking the positions gave good results for me.mr-september commentedon Jul 16, 2022
@Ashgar225 Thank you! That works great. Currently, in my
layout.scad, there's a whole series ofalt_legends_x. Then it would get loaded in properly as long as a correspondingalt_legends_xvariable exists inkeys.scad.Would you also happen to know how the font size could be specified individually for each legend? In my
keys.scad, only$font_size = x;works, but it applies to all fonts. In this documentation, there's a mention of an argument forlegend(), but this does not appear to work for me.Ashgar225 commentedon Jul 16, 2022
Supplying
size=4or similar as an argument (or just as a third argument, when also providing a position) tolegend()does seem to work for me, and even overrides any earlier declaration of$font_sizeand works with different legends on the same key. Not sure what you're running into on that one.Also, I think your link is not quite going to the right place.
mr-september commentedon Jul 17, 2022
@Ashgar225 Oops, that was embarrassing! Fixed.
There's a good chance I've done something wrong, been very jankily copy pasting parts of code from all over the place. I'll just upload the code here, and if you (or anyone else) is free to take a look, please let me know how it could be resolved/what's the best practice.
So there's 3 files I've changed from a fresh github pull:
keys.scad,layout.scad(the workaround suggested above), andskeletyl_legends.scad(frankensteined from another contributor's dactyl manuform layout. The generating/rendering is done inkeys.scad.So, currently, even with no
legends()call inkeys.scad, the corresponding legends still get generated.Adding a
legends()orlegends(topleft_legends, size=5), etc, appear to have no effect on the generation.(zipped because github doesn't accept
.scadfiles)changed_files.zip
rsheldiii commentedon Oct 14, 2022
The layout functionality does too much in this repo, and I want to switch everything over to using
simple_layout. This use case is a perfect example of why, here's how you'd solve this withsimple_layout:mr-september commentedon Nov 7, 2022
@rsheldiii Thank you! This is indeed working and very simple to implement.
Just wondering, with
simple_layout, is there anything like a font size override? For example, to have different sizes in the different corners.