| 185 | } |
| 186 | |
| 187 | bool readShapeDescription(FILE *input, Shape &output, bool *colorsSpecified) { |
| 188 | bool locColorsSpec = false; |
| 189 | output.contours.clear(); |
| 190 | output.setYAxisOrientation(MSDFGEN_Y_AXIS_DEFAULT_ORIENTATION); |
| 191 | Point2 p; |
| 192 | int result = readCoordF(input, p); |
| 193 | if (result == 2) { |
| 194 | return readContour<FILE, readCharF, readCoordF>(input, output.addContour(), &p, EOF, locColorsSpec); |
| 195 | } else if (result == 1) |
| 196 | return false; |
| 197 | else { |
| 198 | int c = readCharF(input); |
| 199 | if (c == '@') { |
| 200 | char after = '\0'; |
| 201 | if (fscanf(input, "y-%c", &after) == 1 && (after == 'u' || after == 'd')) { |
| 202 | switch (after) { |
| 203 | case 'u': |
| 204 | output.setYAxisOrientation(Y_UPWARD); |
| 205 | break; |
| 206 | case 'd': |
| 207 | output.setYAxisOrientation(Y_DOWNWARD); |
| 208 | break; |
| 209 | } |
| 210 | if (fscanf(input, after == 'u' ? "p%c" : "own%c", &after) != 1) |
| 211 | return feof(input) != 0; |
| 212 | } else if (fscanf(input, "invert-y%c", &after) == 1) |
| 213 | output.inverseYAxis = true; |
| 214 | else |
| 215 | return feof(input) != 0; |
| 216 | c = after; |
| 217 | if (c == ' ' || c == '\t' || c == '\r' || c == '\n') |
| 218 | c = readCharF(input); |
| 219 | } |
| 220 | for (; c == '{'; c = readCharF(input)) |
| 221 | if (!readContour<FILE, readCharF, readCoordF>(input, output.addContour(), NULL, '}', locColorsSpec)) |
| 222 | return false; |
| 223 | if (colorsSpecified) |
| 224 | *colorsSpecified = locColorsSpec; |
| 225 | return c == EOF && feof(input); |
| 226 | } |
| 227 | } |
| 228 | |
| 229 | bool readShapeDescription(const char *input, Shape &output, bool *colorsSpecified) { |
| 230 | bool locColorsSpec = false; |
no test coverage detected