2023-04-04 12:21:17 +00:00
|
|
|
//----------------------------------------------------------------------------------------------------------------------
|
2023-04-08 22:07:44 +00:00
|
|
|
// QB64-PE Font Library
|
2023-04-11 17:51:47 +00:00
|
|
|
// Powered by FreeType 2.4.12 (https://github.com/vinniefalco/FreeTypeAmalgam)
|
2023-04-04 12:21:17 +00:00
|
|
|
//----------------------------------------------------------------------------------------------------------------------
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2023-04-08 22:07:44 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#if defined(FONT_DEBUG) && FONT_DEBUG > 0
|
|
|
|
# ifdef _MSC_VER
|
|
|
|
# define FONT_DEBUG_PRINT(_fmt_, ...) fprintf(stderr, "DEBUG: %s:%d:%s(): " _fmt_ "\n", __FILE__, __LINE__, __func__, __VA_ARGS__)
|
|
|
|
# else
|
|
|
|
# define FONT_DEBUG_PRINT(_fmt_, _args_...) fprintf(stderr, "DEBUG: %s:%d:%s(): " _fmt_ "\n", __FILE__, __LINE__, __func__, ##_args_)
|
|
|
|
# endif
|
|
|
|
# define FONT_DEBUG_CHECK(_exp_) \
|
|
|
|
if (!(_exp_)) \
|
|
|
|
FONT_DEBUG_PRINT("Condition (%s) failed", #_exp_)
|
|
|
|
#else
|
|
|
|
# ifdef _MSC_VER
|
|
|
|
# define FONT_DEBUG_PRINT(_fmt_, ...) // Don't do anything in release builds
|
|
|
|
# else
|
|
|
|
# define FONT_DEBUG_PRINT(_fmt_, _args_...) // Don't do anything in release builds
|
|
|
|
# endif
|
|
|
|
# define FONT_DEBUG_CHECK(_exp_) // Don't do anything in release builds
|
|
|
|
#endif
|
|
|
|
|
2023-04-20 03:53:13 +00:00
|
|
|
#define INVALID_FONT_HANDLE 0
|
|
|
|
|
|
|
|
// Font load options
|
|
|
|
#define FONT_LOAD_DONTBLEND 8
|
|
|
|
#define FONT_LOAD_MONOSPACE 16
|
|
|
|
#define FONT_LOAD_UNICODE 32
|
|
|
|
// Font render options
|
|
|
|
#define FONT_RENDER_MONOCHROME 1
|
|
|
|
|
2023-04-19 04:00:38 +00:00
|
|
|
/// @brief CP437 to UTF-16 LUT
|
|
|
|
extern uint16_t codepage437_to_unicode16[];
|
2023-04-04 12:21:17 +00:00
|
|
|
|
2023-04-20 03:53:13 +00:00
|
|
|
uint8_t *FontLoadFileToMemory(const char *file_path_name, int32_t *out_bytes);
|
2023-04-19 02:19:02 +00:00
|
|
|
int32_t FontLoad(const uint8_t *content_original, int32_t content_bytes, int32_t default_pixel_height, int32_t which_font, int32_t options);
|
2023-04-08 22:07:44 +00:00
|
|
|
void FontFree(int32_t fh);
|
|
|
|
int32_t FontWidth(int32_t fh);
|
2023-04-19 04:00:38 +00:00
|
|
|
bool FontRenderTextUTF32(int32_t fh, const uint32_t *codepoint, int32_t codepoints, int32_t options, uint8_t **out_data, int32_t *out_x, int32_t *out_y);
|
|
|
|
bool FontRenderTextASCII(int32_t fh, const uint8_t *codepoint, int32_t codepoints, int32_t options, uint8_t **out_data, int32_t *out_x, int32_t *out_y);
|
|
|
|
int32_t FontPrintWidthUTF32(int32_t fh, const uint32_t *codepoint, int32_t codepoints);
|
2023-04-19 02:19:02 +00:00
|
|
|
int32_t FontPrintWidthASCII(int32_t fh, const uint8_t *codepoint, int32_t codepoints);
|