Move functions related to TTC creation into separate file.
[ttfautohint.git] / src / tamaxp.c
blob67649d99bf5a5983e23cc085a57396b6a766dd13
1 /* tamaxp.c */
3 /*
4 * Copyright (C) 2011 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.
16 #include "ta.h"
19 FT_Error
20 TA_sfnt_update_maxp_table(SFNT* sfnt,
21 FONT* font)
23 SFNT_Table* maxp_table = &font->tables[sfnt->maxp_idx];
24 FT_Byte* buf = maxp_table->buf;
27 if (maxp_table->processed)
28 return TA_Err_Ok;
30 if (maxp_table->len != MAXP_LEN)
31 return FT_Err_Invalid_Table;
33 buf[MAXP_MAX_ZONES_OFFSET] = 0;
34 buf[MAXP_MAX_ZONES_OFFSET + 1] = 2;
35 buf[MAXP_MAX_TWILIGHT_POINTS_OFFSET] = HIGH(sfnt->max_twilight_points);
36 buf[MAXP_MAX_TWILIGHT_POINTS_OFFSET + 1] = LOW(sfnt->max_twilight_points);
37 buf[MAXP_MAX_STORAGE_OFFSET] = HIGH(sfnt->max_storage);
38 buf[MAXP_MAX_STORAGE_OFFSET + 1] = LOW(sfnt->max_storage);
39 buf[MAXP_MAX_FUNCTION_DEFS_OFFSET] = 0;
40 buf[MAXP_MAX_FUNCTION_DEFS_OFFSET + 1] = NUM_FDEFS;
41 buf[MAXP_MAX_INSTRUCTION_DEFS_OFFSET] = 0;
42 buf[MAXP_MAX_INSTRUCTION_DEFS_OFFSET + 1] = 0;
43 buf[MAXP_MAX_STACK_ELEMENTS_OFFSET] = HIGH(sfnt->max_stack_elements);
44 buf[MAXP_MAX_STACK_ELEMENTS_OFFSET + 1] = LOW(sfnt->max_stack_elements);
45 buf[MAXP_MAX_INSTRUCTIONS_OFFSET] = HIGH(sfnt->max_instructions);
46 buf[MAXP_MAX_INSTRUCTIONS_OFFSET + 1] = LOW(sfnt->max_instructions);
48 maxp_table->checksum = TA_table_compute_checksum(maxp_table->buf,
49 maxp_table->len);
50 maxp_table->processed = 1;
52 return TA_Err_Ok;
55 /* end of tamaxp.c */