1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

msdfgen: Update to 1.12

This commit is contained in:
Rémi Verschelde
2025-01-09 21:16:08 +01:00
parent 24d74510e5
commit c97c7b73e6
41 changed files with 1038 additions and 363 deletions

View File

@@ -2,6 +2,8 @@
#define _CRT_SECURE_NO_WARNINGS
#include "shape-description.h"
#include <cstdlib>
namespace msdfgen {
int readCharF(FILE *input) {
@@ -25,14 +27,25 @@ int readCharS(const char **input) {
}
int readCoordF(FILE *input, Point2 &coord) {
return fscanf(input, "%lf,%lf", &coord.x, &coord.y);
return fscanf(input, "%lf , %lf", &coord.x, &coord.y);
}
int readCoordS(const char **input, Point2 &coord) {
int read = 0;
int result = sscanf(*input, "%lf,%lf%n", &coord.x, &coord.y, &read);
*input += read;
return result;
char *end = NULL;
coord.x = strtod(*input, &end);
if (end <= *input)
return 0;
*input = end;
while (**input == ' ' || **input == '\t' || **input == '\n' || **input == '\r')
++*input;
if (**input != ',')
return 1;
++*input;
coord.y = strtod(*input, &end);
if (end <= *input)
return 1;
*input = end;
return 2;
}
static bool writeCoord(FILE *output, Point2 coord) {