diff --git a/tools/decoupe-voiture/patterns/classic_complete_48x48.json b/tools/decoupe-voiture/patterns/classic_complete_48x48.json index e839f6f..1c8b0a4 100644 --- a/tools/decoupe-voiture/patterns/classic_complete_48x48.json +++ b/tools/decoupe-voiture/patterns/classic_complete_48x48.json @@ -6,12 +6,20 @@ "copyRects": [ - { "from": "62+240*0,224-(240-62)x168", "to": "288*0,0" }, - { "from": "62+240*1,224-(240-62)x168", "to": "288*1,0" }, - { "from": "62+240*1,224-(240-62)x168", "to": "288*2,0" }, - { "from": "62+240*1,224-(240-62)x168", "to": "288*3,0" }, - { "from": "62+240*1,224-(240-62)x168", "to": "288*4,0" }, - { "from": "62+240*1,224-(240-62)x168", "to": "288*5,0" } + { "from": "32+240*0,224 -- (240-31) x 168", "to": "288*0-14,34 -- 288 x 240" }, + { "from": "32+240*1,224 -- (240-31) x 168", "to": "288*1-14,34 -- 288 x 240" }, + { "from": "32+240*2,224 -- (240-31) x 168", "to": "288*2-14,34 -- 288 x 240" }, + { "from": "32+240*3,224 -- (240-31) x 168", "to": "288*3-14,34 -- 288 x 240" }, + { "from": "32+240*4,224 -- (240-31) x 168", "to": "288*4-14,34 -- 288 x 240" }, + { "from": "32+240*5,224 -- (240-31) x 168", "to": "288*5-14,34 -- 288 x 240" }, + + + { "from": "2016+240*0,222 -- 214 x130", "to": "288*0+14,240+11 -- 288 x 240" }, + { "from": "2016+240*1,222 -- 214 x130", "to": "288*1+12,240+11 -- 288 x 240" }, + { "from": "2016+240*2,222 -- 214 x130", "to": "288*2+12,240+11 -- 288 x 240" }, + { "from": "2016+240*3,222 -- 214 x130", "to": "288*3+12,240+11 -- 288 x 240" }, + { "from": "2016+240*4,222 -- 214 x130", "to": "288*4+12,240+11 -- 288 x 240" }, + { "from": "2016+240*5,222 -- (214-25)x130", "to": "288*5+ 0,240+11 -- 288 x 240" }, ] } \ No newline at end of file diff --git a/tools/decoupe-voiture/source/main.d b/tools/decoupe-voiture/source/main.d index 3db23bf..dce6e7c 100644 --- a/tools/decoupe-voiture/source/main.d +++ b/tools/decoupe-voiture/source/main.d @@ -164,7 +164,7 @@ void processFile(string inputPath, string outputPath, string pattern) if (from.size != to.size) throw new Exception(format("rectangle size mismatch for key: %s", tr)); - writefln("DEBUG: copy %s to %s", from, to); + //writefln("DEBUG: copy %s to %s", from, to); copyRect(from, to); } @@ -238,7 +238,7 @@ Rect parseRect(JSONValue parent, Rect parseRect(string r, Size defaultSize) { r = strip(r); - int mPos = cast(int) r.indexOf("-"); + int mPos = cast(int) r.indexOf("--"); Size size; Point pos; @@ -250,8 +250,9 @@ Rect parseRect(string r, Size defaultSize) } else { + // U+2014 is 3 bytes long pos = parsePoint(r[0..mPos], defaultSize); - size = parseSize(r[mPos+1..$], defaultSize); + size = parseSize(r[mPos+2..$], defaultSize); } return Rect(pos, size); @@ -260,6 +261,7 @@ Rect parseRect(string r, Size defaultSize) int parseIntegerExpression(string source, Size defaultSize) { + source = strip(source); auto e = compileExpression!int(source); //e["TX"] = defaultSize.w; //e["TY"] = defaultSize.h;