efficient program to spit out SVG for guitar/uke chord frett diagram
SVG: Show title by adjusting viewBox
Zach DeCook 2020-12-26
parent eca943d · commit 7ab3bc0
-rw-r--r--ccharter.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ccharter.c b/ccharter.c
index 7887447..bb4c786 100644
--- a/ccharter.c
+++ b/ccharter.c
@@ -1,7 +1,12 @@
#include <stdio.h>
#include <string.h>
int main(int argc, char **argv) {
- printf("<svg width=\"50px\" height=\"60px\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" overflow=\"visible\" style=\"stroke-width:2; stroke:black;\">");
+ printf("<svg width=\"60px\" height=\"75px\" "
+ "version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" overflow=\"visible\" "
+ "style=\"stroke-width:2; stroke:black;\" "
+ "viewBox=\"-5 -15 50 75\" "
+ ">"
+ );
int fretsCount = strlen(argv[1]);
//var origin = { x: 0, y: 0};
@@ -25,7 +30,7 @@ int main(int argc, char **argv) {
}
// label
- printf("<text x=\"%d\" y=\"%d\">%s</text>",
+ printf("<text x=\"%d\" y=\"%d\" style=\"stroke-width:0; text-anchor:middle;\">%s</text>",
0 + 50/2, 0 - 5, argv[2]
);