#ifndef _ANOD_COMPILED_FONT_H_
#define _ANOD_COMPILED_FONT_H_

#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#ifdef __cplusplus
extern "C" {
#endif

#define INPUT(type) type
#define OUTPUT(type) type*

// error type
#define ACFONT_NOT_FOUND -1
#define ACFONT_INVALID -2
#define ACFONT_READ_EOF -3
#define ACFONT_NOT_SUPPORT -4
#define ACFONT_MEM_EMPTY -5

typedef int                 acf_error_t;
typedef void *              acf_canvas_t;
typedef void *              acf_callerdata_t;
typedef uint16_t            acf_position_t;
typedef uint16_t            acf_rectedge_t;
typedef uint8_t             acf_color_t;
typedef const char *        acf_text_t;
typedef uint16_t            acf_counter_t;

typedef void (*acf_visitor_t)(
    INPUT(acf_callerdata_t) some_data_provided_by_caller,
    INPUT(acf_position_t)   position_x_of_canvas, 
    INPUT(acf_position_t)   position_y_of_canvas, 
    INPUT(acf_color_t)      color_in_position_xy_of_canvas
);

extern acf_error_t acf_initialize(
    INPUT(acf_text_t)       filename_of_acf_font
);

extern acf_canvas_t acf_get_canvas(
    INPUT(acf_rectedge_t)   width_in_pixel_of_canvas, 
    INPUT(acf_text_t)       text_painting_in_utf8, 
    
    OUTPUT(acf_rectedge_t)  using_width_in_pixel_of_canvas, 
    OUTPUT(acf_counter_t)   rendered_char_counting, 
    OUTPUT(acf_text_t)      text_not_rendered_in_utf8
);

extern void acf_recycle(
    INPUT(acf_canvas_t)     canvas_should_free;
);

extern acf_canvas_t acf_use_canvas(
    INPUT(acf_canvas_t)     canvas_should_use, 
    INPUT(acf_visitor_t)    pixel_visitor_for_canvas,
    INPUT(acf_callerdata_t) some_data_from_caller
);

#undef INPUT
#undef OUTPUT

#ifdef __cplusplus
}
#endif

#endif //_ANOD_COMPILED_FONT_H_
