about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ccharter.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/ccharter.c b/ccharter.c
index f475a27..184ea81 100644
--- a/ccharter.c
+++ b/ccharter.c
@@ -4,10 +4,10 @@
 #define WIDTH 50
 #define HEIGHT 60
 int main(int argc, char **argv) {
-		printf("<svg width=\"65px\" height=\"75px\" "
+		printf("<svg width=\"65px\" height=\"85px\" "
 			"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 55 75\" "
+			"style=\"stroke-width:2; stroke:black; text-anchor:middle;\" "
+			"viewBox=\"-5 -25 55 85\" "
 			">"
 		);
 		int fretsCount = strlen(argv[1]);
@@ -33,8 +33,8 @@ int main(int argc, char **argv) {
 		}
 	
 		// label
-		printf("<text x=\"%d\" y=\"%d\" style=\"stroke-width:0; text-anchor:middle;\">%s</text>\n",
-		    0 + 50/2, 0 - 5, argv[2]
+		printf("<text x=\"%d\" y=\"%d\" style=\"stroke-width:0;\">%s</text>\n",
+		    0 + 50/2, -15, argv[2]
 		);
 	
 		// If any dots are after 4, adjust the root to be the lowest non-zero fret
@@ -62,17 +62,15 @@ int main(int argc, char **argv) {
 		// dots
 	
 		for (j=0; j < fretsCount; j++) {
-	
-			// TODO: Write the O or X if it is open or muted.
-			//ctx.alignText = "left";
-			//ctx.fillText(chord.frets.charAt(j), origin.x + (i * props.width / (fretsCount - 1)), origin.y + props.height + 12);
-
 			if (argv[1][j] > '0' && argv[1][j] <= '9') {
 				printf("<circle cx=\"%d\" cy=\"%d\" r=\"3\"/>\n",
-				    (j * WIDTH) / (fretsCount - 1), (HEIGHT/4) * (argv[1][j] - '0') - baseFret - 7
+					(j * WIDTH) / (fretsCount - 1), (HEIGHT/4) * (argv[1][j] - '0') - baseFret - 7
+				);
+			} else {
+				printf("<text x=\"%d\" y=\"%d\" stroke-width=\"0\">%c</text>\n",
+					(j * WIDTH) / (fretsCount - 1),-2,argv[1][j]
 				);
 			}
-			i++;
 		}
 	
 		// base fret indicator