view mrjunejune/latex_renderer.h @ 247:70f2a3dafc1c

[build] Bundle offline Tectonic runtime Co-authored-by: Copilot <[email protected]>
author MrJuneJune <me@mrjunejune.com>
date Mon, 03 Aug 2026 20:20:06 -0700
parents b8aa08503378
children b8b6e726964a
line wrap: on
line source

#ifndef MRJUNEJUNE_LATEX_RENDERER_H
#define MRJUNEJUNE_LATEX_RENDERER_H

#include <stddef.h>
#include <stdint.h>

#define LATEX_SOURCE_MAX_BYTES (64 * 1024)
#define LATEX_PDF_MAX_BYTES (4 * 1024 * 1024)

typedef enum {
  LATEX_RENDER_OK = 0,
  LATEX_RENDER_INVALID_INPUT,
  LATEX_RENDER_COMPILE_ERROR,
  LATEX_RENDER_TIMEOUT,
  LATEX_RENDER_COMPILER_UNAVAILABLE,
  LATEX_RENDER_SANDBOX_ERROR,
  LATEX_RENDER_INTERNAL_ERROR,
} Latex_Render_Status;

typedef struct {
  Latex_Render_Status status;
  uint8_t *pdf_data;
  size_t pdf_size;
  char *diagnostics;
} Latex_Render_Result;

Latex_Render_Result Latex_Render(const uint8_t *source, size_t source_size);
void Latex_Render_Result_Destroy(Latex_Render_Result *result);

#endif