This commit is contained in:
Guillaume Piolat
2025-03-22 11:57:45 +01:00
parent 37edfa3af9
commit 07604388c0
2 changed files with 19 additions and 9 deletions

View File

@@ -6,12 +6,20 @@
"copyRects": [ "copyRects": [
{ "from": "62+240*0,224-(240-62)x168", "to": "288*0,0" }, { "from": "32+240*0,224 -- (240-31) x 168", "to": "288*0-14,34 -- 288 x 240" },
{ "from": "62+240*1,224-(240-62)x168", "to": "288*1,0" }, { "from": "32+240*1,224 -- (240-31) x 168", "to": "288*1-14,34 -- 288 x 240" },
{ "from": "62+240*1,224-(240-62)x168", "to": "288*2,0" }, { "from": "32+240*2,224 -- (240-31) x 168", "to": "288*2-14,34 -- 288 x 240" },
{ "from": "62+240*1,224-(240-62)x168", "to": "288*3,0" }, { "from": "32+240*3,224 -- (240-31) x 168", "to": "288*3-14,34 -- 288 x 240" },
{ "from": "62+240*1,224-(240-62)x168", "to": "288*4,0" }, { "from": "32+240*4,224 -- (240-31) x 168", "to": "288*4-14,34 -- 288 x 240" },
{ "from": "62+240*1,224-(240-62)x168", "to": "288*5,0" } { "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" },
] ]
} }

View File

@@ -164,7 +164,7 @@ void processFile(string inputPath, string outputPath, string pattern)
if (from.size != to.size) if (from.size != to.size)
throw new Exception(format("rectangle size mismatch for key: %s", tr)); 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); copyRect(from, to);
} }
@@ -238,7 +238,7 @@ Rect parseRect(JSONValue parent,
Rect parseRect(string r, Size defaultSize) Rect parseRect(string r, Size defaultSize)
{ {
r = strip(r); r = strip(r);
int mPos = cast(int) r.indexOf("-"); int mPos = cast(int) r.indexOf("--");
Size size; Size size;
Point pos; Point pos;
@@ -250,8 +250,9 @@ Rect parseRect(string r, Size defaultSize)
} }
else else
{ {
// U+2014 is 3 bytes long
pos = parsePoint(r[0..mPos], defaultSize); pos = parsePoint(r[0..mPos], defaultSize);
size = parseSize(r[mPos+1..$], defaultSize); size = parseSize(r[mPos+2..$], defaultSize);
} }
return Rect(pos, size); return Rect(pos, size);
@@ -260,6 +261,7 @@ Rect parseRect(string r, Size defaultSize)
int parseIntegerExpression(string source, int parseIntegerExpression(string source,
Size defaultSize) Size defaultSize)
{ {
source = strip(source);
auto e = compileExpression!int(source); auto e = compileExpression!int(source);
//e["TX"] = defaultSize.w; //e["TX"] = defaultSize.w;
//e["TY"] = defaultSize.h; //e["TY"] = defaultSize.h;