From 1f9d7cae76569ece384f72755108d91060eb490a Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Thu, 6 Aug 2015 23:49:02 +0200 Subject: [PATCH] Fall back on Tile SVG in pieceImageDirectory If a -pieceImageDirectory is given, but a needed piece is not found, and -inscriptions are specified, we first fall back on a general image White/BlackTile.svg. This can then serve as a background for the various inscription glyphs, using the latter to distinguish the pieces. E.g. the Tile image could be a shogi tile, and the inscriptions an utf8 string of kanji, to create Shogi pieces on the fly. --- draw.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/draw.c b/draw.c index 40a4393..5d268f2 100644 --- a/draw.c +++ b/draw.c @@ -311,8 +311,15 @@ LoadSVG (char *dir, int color, int piece, int retry) snprintf(buf, MSG_SIZ, "%s/%s%s.svg", dir, color ? "Black" : "White", name); - if(svg || *dir && (svg = rsvg_handle_new_from_file(buf, &svgerror))) { + if(!svg && *dir) { + svg = rsvg_handle_new_from_file(buf, &svgerror); + if(!svg && *appData.inscriptions) { // if there is no piece-specific SVG, but we make inscriptions, try general background + snprintf(buf, MSG_SIZ, "%s/%sTile.svg", dir, color ? "Black" : "White"); + svg = rsvg_handle_new_from_file(buf, &svgerror); + } + } + if(svg) { rsvg_handle_get_dimensions(svg, &svg_dimensions); img = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, squareSize, squareSize); -- 1.7.0.4