svg: improve text alignment of board coordinates - chess-puzzles - chess puzzle book generator
(HTM) git clone git://git.codemadness.org/chess-puzzles
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit 59753af31b403f30db84f07562d2614460a2d9ab
(DIR) parent 9a5e1b026219ea4a2b320c21bac8284832f852e3
(HTM) Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date: Mon, 18 Dec 2023 00:38:36 +0100
svg: improve text alignment of board coordinates
A bit hacky by hardcoding the y coordinate offset, but this works better with
gimp and ImageMagick also.
Diffstat:
M fen_to_svg.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
(DIR) diff --git a/fen_to_svg.c b/fen_to_svg.c
@@ -165,8 +165,8 @@ showboard(void)
color = highlight[y][x] ? lightsquarehi : lightsquare;
else
color = highlight[y][x] ? darksquarehi : darksquare;
- printf("<text x=\"%d\" y=\"%d\" fill=\"%s\" dominant-baseline=\"hanging\" text-anchor=\"text-top\" style=\"font-family: sans-serif; font-size: 10px\">%c</text>\n",
- (x * 45) + 37, (y * 45) + 3, color, '8' - y);
+ printf("<text x=\"%d\" y=\"%d\" fill=\"%s\" text-anchor=\"end\" style=\"font-family: sans-serif; font-size: 10px\">%c</text>\n",
+ (x + 1) * 45 - 2, (y * 45) + 10, color, '8' - y);
}
y = 7;
for (x = 0; x < 8; x++) {
@@ -174,7 +174,7 @@ showboard(void)
color = highlight[y][x] ? lightsquarehi : lightsquare;
else
color = highlight[y][x] ? darksquarehi : darksquare;
- printf("<text x=\"%d\" y=\"%d\" fill=\"%s\" dominant-baseline=\"text-bottom\" text-anchor=\"text-bottom\" style=\"font-family: sans-serif; font-size: 10px\">%c</text>\n",
+ printf("<text x=\"%d\" y=\"%d\" fill=\"%s\" text-anchor=\"start\" style=\"font-family: sans-serif; font-size: 10px\">%c</text>\n",
(x * 45) + 2, (y + 1) * 45 - 3, color, x + 'a');
}
}