Index: work/util/ttf2lht/drv_poly.c =================================================================== --- work/util/ttf2lht/drv_poly.c (revision 18945) +++ work/util/ttf2lht/drv_poly.c (revision 18946) @@ -15,7 +15,16 @@ return; pcb_poly_contour_pre(s->curr, pcb_true); - APPEND(s->pls, s->curr); + + if (s->curr->Flags.orient) { + pcb_poly_contour_inv(s->curr); + APPEND(s->neg, s->curr); + } + else { + pcb_poly_contour_inv(s->curr); + APPEND(s->pos, s->curr); + } + s->curr = NULL; } @@ -55,6 +64,19 @@ drv_approx_comment = NULL; } +static void emit(pcb_pline_t *pl, void *user_data) +{ + poly_stroke_t *s = (poly_stroke_t *)user_data; + pcb_coord_t n, i; + pcb_vnode_t *v; + + n = pl->Count; + for(i = 0, v = &pl->head; i < n; v = v->next, i++) { + printf("line %d %d %d %d\n", v->point[0], v->point[1], v->next->point[0], v->next->point[1]); + } + +} + void stroke_poly_finish(stroke_t *s_) { poly_stroke_t *s = (poly_stroke_t *)s_; @@ -63,12 +85,24 @@ pline_close(s); pcb_polyarea_init(&s->pa); - for(pl = s->pls; pl != NULL; pl = next) { + for(pl = s->pos; pl != NULL; pl = next) { next = pl->next; pl->next = NULL; if (!pcb_polyarea_contour_include(&s->pa, pl)) fprintf(stderr, "Failed to include positive outline\n"); } + + for(pl = s->neg; pl != NULL; pl = next) { + next = pl->next; + pl->next = NULL; + if (!pcb_polyarea_contour_include(&s->pa, pl)) + fprintf(stderr, "Failed to include negative outline\n"); + } + + if (!pcb_poly_valid(&s->pa)) + fprintf(stderr, "Invalid outlines\n"); + else + r_NoHolesPolygonDicer(&s->pa, emit, s); } void stroke_poly_uninit(stroke_t *s_) Index: work/util/ttf2lht/drv_poly.h =================================================================== --- work/util/ttf2lht/drv_poly.h (revision 18945) +++ work/util/ttf2lht/drv_poly.h (revision 18946) @@ -8,7 +8,7 @@ /* polylines used while loading the outline */ pcb_pline_t *curr; - pcb_pline_t *pls; + pcb_pline_t *pos, *neg; /* the resulting polyarea */ pcb_polyarea_t pa;