convttf: Switch to c99 fixed size integers for fnt file header

Change-Id: Idff55a88a9bddaec42e568cf3c3ff3f6df15ec34
This commit is contained in:
Solomon Peachy 2025-05-23 08:44:46 -04:00
parent adaae1731f
commit 2f6ecaf3c2

View file

@ -35,6 +35,7 @@
#include FT_TRUETYPE_TABLES_H #include FT_TRUETYPE_TABLES_H
#include <string.h> #include <string.h>
#include <stdint.h>
/* /*
* Set the default values used to generate a BDF font. * Set the default values used to generate a BDF font.
*/ */
@ -114,26 +115,26 @@ int trim_aa = 0; /* trim ascent actual */
int ft_load_opts = FT_LOAD_RENDER | FT_LOAD_NO_BITMAP; int ft_load_opts = FT_LOAD_RENDER | FT_LOAD_NO_BITMAP;
struct font_header_struct { struct font_header_struct {
char header[4]; /* magic number and version bytes */ uint8_t header[4]; /* magic number and version bytes */
unsigned short maxwidth; /* max width in pixels */ uint16_t maxwidth; /* max width in pixels */
unsigned short height; /* height in pixels */ uint16_t height; /* height in pixels */
unsigned short ascent; /* ascent (baseline) height */ uint16_t ascent; /* ascent (baseline) height */
unsigned short depth; /* depth 0=1-bit, 1=4-bit */ uint16_t depth; /* depth 0=1-bit, 1=4-bit */
unsigned long firstchar; /* first character in font */ uint32_t firstchar; /* first character in font */
unsigned long defaultchar; /* default character in font */ uint32_t defaultchar; /* default character in font */
unsigned long size; /* # characters in font */ uint32_t size; /* # characters in font */
unsigned long nbits; /* # bytes imagebits data in file */ /* = bits_size */ uint32_t nbits; /* # bytes imagebits data in file */ /* = bits_size */
FT_Long noffset; /* # longs offset data in file */ uint32_t noffset; /* # longs offset data in file */
FT_Long nwidth; /* # bytes width data in file */ uint32_t nwidth; /* # bytes width data in file */
}; };
struct font_struct { struct font_struct {
struct font_header_struct header; struct font_header_struct header;
unsigned char *chars_data; uint8_t *chars_data;
unsigned short *offset; uint16_t *offset;
FT_Long *offset_long; uint32_t *offset_long;
unsigned char *width; uint8_t *width;
}; };
struct ttc_table{ struct ttc_table{
@ -629,7 +630,7 @@ void convttf(char* path, char* destfile, FT_Long face_index)
unsigned char pixel_per_byte = CHAR_BIT / bit_shift; unsigned char pixel_per_byte = CHAR_BIT / bit_shift;
struct font_struct export_font; struct font_struct export_font;
char pad[] = {0,0,0,0}; char pad[] = {0,0,0,0};
int skip,i; unsigned int skip,i;
FILE *file; FILE *file;
/* Initialize engine */ /* Initialize engine */