Index: trunk/src_plugins/export_fidocadj/fidocadj.c =================================================================== --- trunk/src_plugins/export_fidocadj/fidocadj.c (revision 19585) +++ trunk/src_plugins/export_fidocadj/fidocadj.c (revision 19586) @@ -272,9 +272,10 @@ y0 -= sy; break; }*/ +#warning textrot TODO: can we exprot rotation with %f? fprintf(f, "TY %ld %ld %ld %ld %d 1 %d * ", /* 1 = bold */ crd(x0), crd(y0), crd(glyphy), crd(glyphx), - 90*(text->Direction), fidoly); + (int)pcb_round(text->rot), fidoly); for(s = text->TextString; *s != '\0'; s++) { if (*s == ' ') fprintf(f, "++"); Index: trunk/src_plugins/export_openems/mesh.c =================================================================== --- trunk/src_plugins/export_openems/mesh.c (revision 19585) +++ trunk/src_plugins/export_openems/mesh.c (revision 19586) @@ -443,7 +443,7 @@ { aux -= PCB_MM_TO_COORD(0.6); if (dir == PCB_MESH_HORIZONTAL) - pcb_text_new(mesh->ui_layer_xy, pcb_font(PCB, 0, 0), aux, 0, 1, 75, 0, label, pcb_no_flags()); + pcb_text_new(mesh->ui_layer_xy, pcb_font(PCB, 0, 0), aux, 0, 90, 75, 0, label, pcb_no_flags()); else pcb_text_new(mesh->ui_layer_xy, pcb_font(PCB, 0, 0), 0, aux, 0, 75, 0, label, pcb_no_flags()); Index: trunk/src_plugins/io_autotrax/read.c =================================================================== --- trunk/src_plugins/io_autotrax/read.c (revision 19585) +++ trunk/src_plugins/io_autotrax/read.c (revision 19586) @@ -221,7 +221,8 @@ if (lyt & PCB_LYT_BOTTOM) Flags = pcb_flag_make(PCB_FLAG_ONSOLDER); else Flags = pcb_flag_make(0); - if (pcb_text_new(ly, pcb_font(st->pcb, 0, 1), X, Y, direction, scaling, 0, t, Flags) != 0) +#warning textrot TODO: is there a real rotation angle available? + if (pcb_text_new(ly, pcb_font(st->pcb, 0, 1), X, Y, 90.0*direction, scaling, 0, t, Flags) != 0) return 1; return -1; Index: trunk/src_plugins/io_autotrax/write.c =================================================================== --- trunk/src_plugins/io_autotrax/write.c (revision 19585) +++ trunk/src_plugins/io_autotrax/write.c (revision 19586) @@ -443,6 +443,12 @@ if (!pcb_layer_is_empty_(PCB, layer)) { /*|| (layer->name && *layer->name)) { */ local_flag = 0; textlist_foreach(&layer->Text, &it, text) { + int direction; + + if (pcb_text_old_direction(&direction, text->rot) != 0) { +#warning TODO: indicate save incompatibility + } + if (current_layer < 9) { /* copper or silk layer text */ if (in_subc) fputs("CS\r\n", ctx->f); @@ -453,13 +459,13 @@ rotation = 0; if (current_layer == 6 || current_layer == 8) /* back copper or silk */ autotrax_mirrored = 16; /* mirrored */ - if (text->Direction == 3) /*vertical down */ + if (direction == 3) /*vertical down */ rotation = 3; - else if (text->Direction == 2) /*upside down */ + else if (direction == 2) /*upside down */ rotation = 2; - else if (text->Direction == 1) /*vertical up */ + else if (direction == 1) /*vertical up */ rotation = 1; - else if (text->Direction == 0) /*normal text */ + else if (direction == 0) /*normal text */ rotation = 0; pcb_fprintf(ctx->f, "%.0ml %.0ml %.0ml %d %.0ml %d\r\n", text->X+dx, PCB->MaxHeight - (text->Y+dy), textHeight, rotation + autotrax_mirrored, strokeThickness, current_layer); Index: trunk/src_plugins/io_eagle/read.c =================================================================== --- trunk/src_plugins/io_eagle/read.c (revision 19585) +++ trunk/src_plugins/io_eagle/read.c (revision 19586) @@ -577,7 +577,8 @@ } } - pcb_text_new(ly, pcb_font(st->pcb, 0, 1), X, Y, text_direction, text_scaling, 0, text_val, text_flags); +#warning textrot TODO: check if we can just use the angle + pcb_text_new(ly, pcb_font(st->pcb, 0, 1), X, Y, 90.0*text_direction, text_scaling, 0, text_val, text_flags); return 0; } Index: trunk/src_plugins/io_kicad/read.c =================================================================== --- trunk/src_plugins/io_kicad/read.c (revision 19585) +++ trunk/src_plugins/io_kicad/read.c (revision 19586) @@ -440,7 +440,8 @@ } } - pcb_text_new(&st->pcb->Data->Layer[PCBLayer], pcb_font(st->pcb, 0, 1), X, Y, direction, scaling, 0, text, Flags); +#warning textrot TODO: check if we can just use the rotation angle + pcb_text_new(&st->pcb->Data->Layer[PCBLayer], pcb_font(st->pcb, 0, 1), X, Y, 90.0*direction, scaling, 0, text, Flags); return 0; /* create new font */ } return kicad_error(subtree, "failed to create gr_text element"); Index: trunk/src_plugins/io_kicad/write.c =================================================================== --- trunk/src_plugins/io_kicad/write.c (revision 19585) +++ trunk/src_plugins/io_kicad/write.c (revision 19586) @@ -310,7 +310,7 @@ pcb_coord_t defaultXSize; pcb_coord_t defaultYSize; pcb_coord_t strokeThickness; - int rotation; + int rotation, direction; pcb_coord_t textOffsetX; pcb_coord_t textOffsetY; pcb_coord_t halfStringWidth; @@ -337,7 +337,10 @@ if (halfStringHeight < 0) { halfStringHeight = -halfStringHeight; } - if (text->Direction == 3) { /*vertical down */ + +#warning textrot TODO: use the degrees instead of 90 deg steps + pcb_text_old_direction(&direction, text->rot); + if (direction == 3) { /*vertical down */ if (kly->lyt & PCB_LYT_BOTTOM) { /* back copper or silk */ rotation = 2700; kicadMirrored = 0; /* mirrored */ @@ -351,7 +354,7 @@ textOffsetX -= halfStringWidth; } } - else if (text->Direction == 2) { /*upside down */ + else if (direction == 2) { /*upside down */ if (kly->lyt & PCB_LYT_BOTTOM) { /* back copper or silk */ rotation = 0; kicadMirrored = 0; /* mirrored */ @@ -364,7 +367,7 @@ } textOffsetX = -halfStringWidth; } - else if (text->Direction == 1) { /*vertical up */ + else if (direction == 1) { /*vertical up */ if (kly->lyt & PCB_LYT_BOTTOM) { /* back copper or silk */ rotation = 900; kicadMirrored = 0; /* mirrored */ @@ -378,7 +381,7 @@ textOffsetX = 0; /* += halfStringWidth; */ } } - else if (text->Direction == 0) { /*normal text */ + else if (direction == 0) { /*normal text */ if (kly->lyt & PCB_LYT_BOTTOM) { /* back copper or silk */ rotation = 1800; kicadMirrored = 0; /* mirrored */ Index: trunk/src_plugins/io_kicad_legacy/write.c =================================================================== --- trunk/src_plugins/io_kicad_legacy/write.c (revision 19585) +++ trunk/src_plugins/io_kicad_legacy/write.c (revision 19586) @@ -208,6 +208,7 @@ pcb_coord_t mWidth = myfont->MaxWidth; /* kicad needs the width of the widest letter */ pcb_coord_t defaultStrokeThickness = 100 * 2540; /* use 100 mil as default 100% stroked font line thickness */ int kicadMirrored = 1; /* 1 is not mirrored, 0 is mirrored */ + int direction; pcb_coord_t defaultXSize; pcb_coord_t defaultYSize; @@ -245,7 +246,11 @@ if (halfStringHeight < 0) { halfStringHeight = -halfStringHeight; } - if (text->Direction == 3) { /*vertical down */ + +#warning code duplication with io_kicad - clean that up after fixing textrot! +#warning textrot TODO: use the angle, not n*90 deg + pcb_text_old_direction(&direction, text->rot); + if (direction == 3) { /*vertical down */ if (currentLayer == 0 || currentLayer == 20) { /* back copper or silk */ rotation = 2700; kicadMirrored = 0; /* mirrored */ @@ -259,7 +264,7 @@ textOffsetX -= halfStringWidth; } } - else if (text->Direction == 2) { /*upside down */ + else if (direction == 2) { /*upside down */ if (currentLayer == 0 || currentLayer == 20) { /* back copper or silk */ rotation = 0; kicadMirrored = 0; /* mirrored */ @@ -272,7 +277,7 @@ } textOffsetX = -halfStringWidth; } - else if (text->Direction == 1) { /*vertical up */ + else if (direction == 1) { /*vertical up */ if (currentLayer == 0 || currentLayer == 20) { /* back copper or silk */ rotation = 900; kicadMirrored = 0; /* mirrored */ @@ -286,7 +291,7 @@ textOffsetX = 0; /* += halfStringWidth; */ } } - else if (text->Direction == 0) { /*normal text */ + else if (direction == 0) { /*normal text */ if (currentLayer == 0 || currentLayer == 20) { /* back copper or silk */ rotation = 1800; kicadMirrored = 0; /* mirrored */ Index: trunk/src_plugins/io_pcb/file.c =================================================================== --- trunk/src_plugins/io_pcb/file.c (revision 19585) +++ trunk/src_plugins/io_pcb/file.c (revision 19586) @@ -436,7 +436,9 @@ if (trefdes != NULL) { rx = trefdes->X - ox; ry = trefdes->Y - oy; - rdir = trefdes->Direction; + if (!pcb_text_old_direction(&rdir, trefdes->rot)) { +#warning textrot TODO: incompatibility warning + } rscale = trefdes->Scale; } else { @@ -581,7 +583,11 @@ arc->Height, arc->Thickness, arc->Clearance, arc->StartAngle, arc->Delta, F2S(arc, PCB_OBJ_ARC)); } textlist_foreach(&layer->Text, &it, text) { - pcb_fprintf(FP, "\tText[%[0] %[0] %d %d ", text->X, text->Y, text->Direction, text->Scale); + int dir; + if (!pcb_text_old_direction(&dir, text->rot)) { +#warning textrot TODO: incompatibility warning + } + pcb_fprintf(FP, "\tText[%[0] %[0] %d %d ", text->X, text->Y, dir, text->Scale); pcb_print_quoted_string(FP, (char *) PCB_EMPTY(text->TextString)); fprintf(FP, " %s]\n", F2S(text, PCB_OBJ_TEXT)); } Index: trunk/src_plugins/io_pcb/parse_y.c =================================================================== --- trunk/src_plugins/io_pcb/parse_y.c (revision 19585) +++ trunk/src_plugins/io_pcb/parse_y.c (revision 19586) @@ -2339,7 +2339,7 @@ #line 1099 "parse_y.y" /* yacc.c:1646 */ { /* use a default scale of 100% */ - pcb_text_new(Layer,yyFont,OU ((yyvsp[-5].measure)), OU ((yyvsp[-4].measure)), (yyvsp[-3].number), 100, 0, (yyvsp[-2].string), pcb_flag_old((yyvsp[-1].integer))); + pcb_text_new(Layer,yyFont,OU ((yyvsp[-5].measure)), OU ((yyvsp[-4].measure)), (yyvsp[-3].number) * 90.0, 100, 0, (yyvsp[-2].string), pcb_flag_old((yyvsp[-1].integer))); free ((yyvsp[-2].string)); } #line 2346 "parse_y.c" /* yacc.c:1646 */ @@ -2353,11 +2353,11 @@ pcb_layer_t *lay = &yyData->Layer[yyData->LayerN + (((yyvsp[-1].integer) & PCB_FLAG_ONSOLDER) ? PCB_SOLDER_SIDE : PCB_COMPONENT_SIDE) - 2]; - pcb_text_new(lay ,yyFont, OU ((yyvsp[-6].measure)), OU ((yyvsp[-5].measure)), (yyvsp[-4].number), (yyvsp[-3].number), 0, (yyvsp[-2].string), + pcb_text_new(lay ,yyFont, OU ((yyvsp[-6].measure)), OU ((yyvsp[-5].measure)), (yyvsp[-4].number) * 90.0, (yyvsp[-3].number), 0, (yyvsp[-2].string), pcb_flag_old((yyvsp[-1].integer))); } else - pcb_text_new(Layer, yyFont, OU ((yyvsp[-6].measure)), OU ((yyvsp[-5].measure)), (yyvsp[-4].number), (yyvsp[-3].number), 0, (yyvsp[-2].string), + pcb_text_new(Layer, yyFont, OU ((yyvsp[-6].measure)), OU ((yyvsp[-5].measure)), (yyvsp[-4].number) * 90.0, (yyvsp[-3].number), 0, (yyvsp[-2].string), pcb_flag_old((yyvsp[-1].integer))); free ((yyvsp[-2].string)); } @@ -2379,10 +2379,10 @@ pcb_layer_t *lay = &yyData->Layer[yyData->LayerN + (((yyvsp[-1].flagtype).f & PCB_FLAG_ONSOLDER) ? PCB_SOLDER_SIDE : PCB_COMPONENT_SIDE) - 2]; - pcb_text_new(lay, yyFont, NU ((yyvsp[-6].measure)), NU ((yyvsp[-5].measure)), (yyvsp[-4].number), (yyvsp[-3].number), 0, (yyvsp[-2].string), (yyvsp[-1].flagtype)); + pcb_text_new(lay, yyFont, NU ((yyvsp[-6].measure)), NU ((yyvsp[-5].measure)), (yyvsp[-4].number) * 90.0, (yyvsp[-3].number), 0, (yyvsp[-2].string), (yyvsp[-1].flagtype)); } else - pcb_text_new(Layer, yyFont, NU ((yyvsp[-6].measure)), NU ((yyvsp[-5].measure)), (yyvsp[-4].number), (yyvsp[-3].number), 0, (yyvsp[-2].string), (yyvsp[-1].flagtype)); + pcb_text_new(Layer, yyFont, NU ((yyvsp[-6].measure)), NU ((yyvsp[-5].measure)), (yyvsp[-4].number) * 90.0, (yyvsp[-3].number), 0, (yyvsp[-2].string), (yyvsp[-1].flagtype)); free ((yyvsp[-2].string)); } #line 2389 "parse_y.c" /* yacc.c:1646 */ Index: trunk/src_plugins/io_pcb/parse_y.y =================================================================== --- trunk/src_plugins/io_pcb/parse_y.y (revision 19585) +++ trunk/src_plugins/io_pcb/parse_y.y (revision 19586) @@ -1098,7 +1098,7 @@ : T_TEXT '(' measure measure number STRING INTEGER ')' { /* use a default scale of 100% */ - pcb_text_new(Layer,yyFont,OU ($3), OU ($4), $5, 100, 0, $6, pcb_flag_old($7)); + pcb_text_new(Layer,yyFont,OU ($3), OU ($4), $5 * 90.0, 100, 0, $6, pcb_flag_old($7)); free ($6); } ; @@ -1112,11 +1112,11 @@ pcb_layer_t *lay = &yyData->Layer[yyData->LayerN + (($8 & PCB_FLAG_ONSOLDER) ? PCB_SOLDER_SIDE : PCB_COMPONENT_SIDE) - 2]; - pcb_text_new(lay ,yyFont, OU ($3), OU ($4), $5, $6, 0, $7, + pcb_text_new(lay ,yyFont, OU ($3), OU ($4), $5 * 90.0, $6, 0, $7, pcb_flag_old($8)); } else - pcb_text_new(Layer, yyFont, OU ($3), OU ($4), $5, $6, 0, $7, + pcb_text_new(Layer, yyFont, OU ($3), OU ($4), $5 * 90.0, $6, 0, $7, pcb_flag_old($8)); free ($7); } @@ -1137,10 +1137,10 @@ pcb_layer_t *lay = &yyData->Layer[yyData->LayerN + (($8.f & PCB_FLAG_ONSOLDER) ? PCB_SOLDER_SIDE : PCB_COMPONENT_SIDE) - 2]; - pcb_text_new(lay, yyFont, NU ($3), NU ($4), $5, $6, 0, $7, $8); + pcb_text_new(lay, yyFont, NU ($3), NU ($4), $5 * 90.0, $6, 0, $7, $8); } else - pcb_text_new(Layer, yyFont, NU ($3), NU ($4), $5, $6, 0, $7, $8); + pcb_text_new(Layer, yyFont, NU ($3), NU ($4), $5 * 90.0, $6, 0, $7, $8); free ($7); } ;