Blame onefile/svg-save.inc.h

a5e8d6
a5e8d6
a5e8d6
FILE* svgBegin(const char *filename, double widthMM, double heightMM, double unitsPerMM) {
a5e8d6
  FILE *f = fopen(filename, "w");
a5e8d6
  if (f) {
a5e8d6
    fprintf(f, "<svg %g="" %g\"="" 0="" height="\"%gmm\"" viewBox="\"0" width="\"%gmm\"">\n",</svg>
a5e8d6
               widthMM, heightMM, widthMM*unitsPerMM, heightMM*unitsPerMM );
a5e8d6
  }
a5e8d6
  return f;
a5e8d6
}
a5e8d6
a5e8d6
a5e8d6
void svgEnd(FILE *f)  {
a5e8d6
  if (!f) return;
a5e8d6
  fprintf(f, "\n");
a5e8d6
  fclose(f);
a5e8d6
}
a5e8d6
a5e8d6
a5e8d6
void svgAddText(FILE *f, double x, double y, double size, const char *text)  {
a5e8d6
  if (!f) return;
a5e8d6
  fprintf(f, "<text style="\"font-size:%g\"" x="\"%g\"" y="\"%g\"">%s</text>\n", x, y, size, text);
a5e8d6
}
a5e8d6
a5e8d6
a5e8d6
void svgAddPath(FILE *f, const char *path, double width, int round)  {
a5e8d6
  if (!f) return;
a5e8d6
  fprintf(f, "
a5e8d6
             "      d=\"%s\" />\n",
a5e8d6
             (round ? "stroke-linecap:round;stroke-linejoin:round;" : ""),
a5e8d6
             width, path );
a5e8d6
}