FT_Error TA_sfnt_build_prep_table(SFNT* sfnt, FONT* font) { FT_Error error; SFNT_Table* glyf_table = &font->tables[sfnt->glyf_idx]; glyf_Data* data = (glyf_Data*)glyf_table->data; FT_Byte* prep_buf; FT_ULong prep_len; error = TA_sfnt_add_table_info(sfnt); if (error) goto Exit; /* `glyf', `cvt', `fpgm', and `prep' are always used in parallel */ if (glyf_table->processed) { sfnt->table_infos[sfnt->num_table_infos - 1] = data->prep_idx; goto Exit; } error = TA_table_build_prep(&prep_buf, &prep_len, sfnt, font); if (error) goto Exit; #if 0 /* ttfautohint's bytecode in `fpgm' is larger */ /* than the bytecode in `prep'; */ /* this commented out code here is just for completeness */ if (prep_len > sfnt->max_instructions) sfnt->max_instructions = prep_len; #endif /* in case of success, `prep_buf' gets linked */ /* and is eventually freed in `TA_font_unload' */ error = TA_font_add_table(font, &sfnt->table_infos[sfnt->num_table_infos - 1], TTAG_prep, prep_len, prep_buf); if (error) free(prep_buf); else data->prep_idx = sfnt->table_infos[sfnt->num_table_infos - 1]; Exit: return error; }
FT_Error TA_sfnt_build_prep_table(SFNT* sfnt, FONT* font) { FT_Error error; FT_Byte* prep_buf; FT_ULong prep_len; error = TA_sfnt_add_table_info(sfnt); if (error) return error; error = TA_table_build_prep(&prep_buf, &prep_len, font); if (error) return error; #if 0 /* ttfautohint's bytecode in `fpgm' is larger */ /* than the bytecode in `prep'; */ /* this commented out code here is just for completeness */ if (prep_len > sfnt->max_instructions) sfnt->max_instructions = prep_len; #endif /* in case of success, `prep_buf' gets linked */ /* and is eventually freed in `TA_font_unload' */ error = TA_font_add_table(font, &sfnt->table_infos[sfnt->num_table_infos - 1], TTAG_prep, prep_len, prep_buf); if (error) { free(prep_buf); return error; } return FT_Err_Ok; }