Index: trunk/src/obj_text.c =================================================================== --- trunk/src/obj_text.c (revision 19580) +++ trunk/src/obj_text.c (revision 19581) @@ -1244,6 +1244,22 @@ pcb_trace("font change %d\n", argv[1].d.i); } +pcb_bool pcb_text_old_direction(int *dir_out, double rot) +{ + double r; + + r = fmod(rot, 90.0); + + if (dir_out != NULL) { + int d = pcb_round(rot / 90); + if (d < 0) + d += 4; + *dir_out = d; + } + + return (r <= 0.5); +} + void pcb_text_init(void) { pcb_event_bind(PCB_EVENT_FONT_CHANGED, pcb_text_font_chg, NULL, text_cookie); Index: trunk/src/obj_text.h =================================================================== --- trunk/src/obj_text.h (revision 19580) +++ trunk/src/obj_text.h (revision 19581) @@ -76,6 +76,10 @@ directly under data - useful e.g. on parent attr change */ void pcb_text_dyn_bbox_update(pcb_data_t *data); +/* Return the old direction value (n*90 deg rotation) for text rotation value. + Returns false if has a rounding error greater than 0.5 deg */ +pcb_bool pcb_text_old_direction(int *dir_out, double rot); + /* hash and eq */ int pcb_text_eq(const pcb_host_trans_t *tr1, const pcb_text_t *t1, const pcb_host_trans_t *tr2, const pcb_text_t *t2); unsigned int pcb_text_hash(const pcb_host_trans_t *tr, const pcb_text_t *t);