4 * Copyright (C) 2011-2022 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_sfnt_update_hmtx_table(SFNT
* sfnt
,
23 SFNT_Table
* hmtx_table
;
29 if (sfnt
->hmtx_idx
== MISSING
)
32 hmtx_table
= &font
->tables
[sfnt
->hmtx_idx
];
34 if (hmtx_table
->processed
)
37 /* the metrics of the added composite element doesn't matter; */
38 /* for this reason, we simply append two zero bytes, */
39 /* indicating a zero value in the `leftSideBearing' array */
40 /* (this works because we don't increase the `numberOfHMetrics' field) */
43 /* make the allocated buffer length a multiple of 4 */
44 buf_len
= (hmtx_table
->len
+ 3) & ~3U;
45 buf_new
= (FT_Byte
*)realloc(hmtx_table
->buf
, buf_len
);
49 return FT_Err_Out_Of_Memory
;
52 /* pad end of buffer with zeros */
53 for (i
= hmtx_table
->len
- 2; i
< buf_len
; i
++)
56 hmtx_table
->buf
= buf_new
;
57 hmtx_table
->checksum
= TA_table_compute_checksum(hmtx_table
->buf
,
59 hmtx_table
->processed
= 1;