4 * Copyright (C) 2011-2012 by Werner Lemberg.
6 * This file is part of the ttfautohint library, and may only be used,
7 * modified, and distributed under the terms given in `COPYING'. By
8 * continuing to use, modify, or distribute this file you indicate that you
9 * have read `COPYING' and understand and accept it fully.
11 * The file `COPYING' mentioned in the previous paragraph is distributed
12 * with the ttfautohint library.
20 TA_font_file_read(FONT
* font
,
23 fseek(in_file
, 0, SEEK_END
);
24 font
->in_len
= ftell(in_file
);
25 fseek(in_file
, 0, SEEK_SET
);
27 /* a valid TTF can never be that small */
28 if (font
->in_len
< 100)
29 return FT_Err_Invalid_Argument
;
31 font
->in_buf
= (FT_Byte
*)malloc(font
->in_len
);
33 return FT_Err_Out_Of_Memory
;
35 if (fread(font
->in_buf
, 1, font
->in_len
, in_file
) != font
->in_len
)
36 return FT_Err_Invalid_Stream_Read
;
43 TA_font_file_write(FONT
* font
,
46 if (fwrite(font
->out_buf
, 1, font
->out_len
, out_file
) != font
->out_len
)
47 return TA_Err_Invalid_Stream_Write
;