diff --git a/sch2fig/lib.c b/sch2fig/lib.c index 7ace055..cb098b3 100644 --- a/sch2fig/lib.c +++ b/sch2fig/lib.c @@ -131,22 +131,22 @@ static void draw_pin(const struct comp *comp, const struct pin_obj *pin, switch (pin->orient) { case 'U': - dy = pin->length; + dy = 1; rot = 90; hor = text_min; break; case 'D': - dy = -pin->length; + dy = -1; rot = 90; hor = text_max; break; case 'R': - dx = pin->length; + dx = 1; rot = 0; hor = text_min; break; case 'L': - dx = -pin->length; + dx = -1; rot = 0; hor = text_max; break; @@ -155,14 +155,17 @@ static void draw_pin(const struct comp *comp, const struct pin_obj *pin, } x[0] = mx(pin->x, pin->y, m); y[0] = my(pin->x, pin->y, m); - x[1] = mx(pin->x + dx, pin->y + dy, m); - y[1] = my(pin->x + dx, pin->y + dy, m); + x[1] = mx(pin->x + dx * pin->length, pin->y + dy * pin->length, m); + y[1] = my(pin->x + dx * pin->length, pin->y + dy * pin->length, m); fig_poly(2, x, y, COLOR_COMP_DWG, LAYER_COMP_DWG); + dx *= pin->length + comp->name_offset; + dy *= pin->length + comp->name_offset; + struct text txt = { .s = pin->name, - .x = mx(pin->x + dx + comp->name_offset, pin->y + dy, m), - .y = my(pin->x + dx + comp->name_offset, pin->y + dy, m), + .x = mx(pin->x + dx, pin->y + dy, m), + .y = my(pin->x + dx, pin->y + dy, m), .size = pin->name_size, .rot = rot, .hor = hor, @@ -186,6 +189,7 @@ static void draw_text(const struct text_obj *text, int m[6]) .hor = text_mid, .vert = text_mid, }; + text_fig(&txt, COLOR_COMP_DWG, WIDTH_COMP_DWG); }