view nuklear_ui/sfnt.h @ 1637:95880d947257

Fix for VRAM byte write order broke VDP FIFO testing ROM results. This change cleans up VRAM writes and fixes the regression while preserving the correct VRAM byte write order
author Michael Pavone <pavone@retrodev.com>
date Sun, 11 Nov 2018 22:39:29 -0800
parents 4f6e8acd7b6a
children 369a52e302e2
line wrap: on
line source

#ifndef SFNT_H_
#define SFNT_H_

#include <stdint.h>
enum {
	CONTAINER_TTF,
	CONTAINER_TTC,
	CONTAINER_DFONT
};

enum {
	SFNT_COPYRIGHT,
	SFNT_FAMILY,
	SFNT_SUBFAMILY,
	SFNT_SUBFAMILY_UNIQUE,
	SFNT_FULL_NAME,
	SFNT_VERSION,
	SFNT_POSTSCRIPT,
	//TODO: add the rest of the name IDs
};

typedef struct sfnt_container sfnt_container;
typedef struct {
	uint8_t        *data;
	sfnt_container *container;
	uint32_t       offset;
	uint16_t       num_entries;
} sfnt_table;

struct sfnt_container {
	uint8_t    *blob;
	sfnt_table *tables;
	uint32_t   size;
	uint8_t    num_fonts;
	uint8_t    container_type;
};

sfnt_container *load_sfnt(uint8_t *buffer, uint32_t size);
char *sfnt_name(sfnt_table *sfnt, uint16_t name_type);
uint8_t *sfnt_flatten(sfnt_table *sfnt, uint32_t *size_out);
sfnt_table *sfnt_subfamily_by_names(sfnt_container *sfnt, const char **names);
void sfnt_free(sfnt_container *sfnt);

#endif // SFNT_H_