Deleted Added
full compact
31c31
< __FBSDID("$FreeBSD: head/tools/tools/vt/fontcvt/fontcvt.c 267298 2014-06-09 20:49:13Z emaste $");
---
> __FBSDID("$FreeBSD: head/tools/tools/vt/fontcvt/fontcvt.c 267301 2014-06-09 20:52:35Z emaste $");
39a40
> #include <err.h>
47a49
> #define VFNT_MAP_NORMAL_RH 1
48a51
> #define VFNT_MAP_BOLD_RH 3
104,131d106
< if (map_idx >= VFNT_MAP_BOLD) {
< int found = 0;
< unsigned normal_map_idx = map_idx - VFNT_MAP_BOLD;
<
< TAILQ_FOREACH(mp, &maps[normal_map_idx], m_list) {
< if (mp->m_char < c)
< continue;
< else if (mp->m_char > c)
< break;
< found = 1;
<
< /*
< * No mapping is needed if it's equal to the
< * normal mapping.
< */
< if (mp->m_glyph == gl) {
< mapping_dupe++;
< return (0);
< }
< }
<
< if (!found) {
< fprintf(stderr,
< "Character %u not in normal font!\n", c);
< return (1);
< }
< }
<
150a126,152
> static int
> dedup_mapping(unsigned int map_idx)
> {
> struct mapping *mp_bold, *mp_normal, *mp_temp;
> unsigned normal_map_idx = map_idx - VFNT_MAP_BOLD;
>
> assert(map_idx == VFNT_MAP_BOLD || map_idx == VFNT_MAP_BOLD_RH);
> mp_normal = TAILQ_FIRST(&maps[normal_map_idx]);
> TAILQ_FOREACH_SAFE(mp_bold, &maps[map_idx], m_list, mp_temp) {
> while (mp_normal->m_char < mp_bold->m_char)
> mp_normal = TAILQ_NEXT(mp_normal, m_list);
> if (mp_bold->m_char != mp_normal->m_char) {
> errx(1, "Character %u not in normal font!\n",
> mp_bold->m_char);
> return (1);
> }
> if (mp_bold->m_glyph != mp_normal->m_glyph)
> continue;
>
> /* No mapping is needed if it's equal to the normal mapping. */
> TAILQ_REMOVE(&maps[map_idx], mp_bold, m_list);
> free(mp_bold);
> mapping_dupe++;
> }
> return (0);
> }
>
542a545,546
> dedup_mapping(VFNT_MAP_BOLD);
> dedup_mapping(VFNT_MAP_BOLD_RH);