Index: plugins/io_eeschema/read.c =================================================================== --- plugins/io_eeschema/read.c (revision 11305) +++ plugins/io_eeschema/read.c (revision 11306) @@ -101,6 +101,7 @@ float page_top_margin; float page_bottom_margin; csch_cgrp_t* titleblock; + csch_coord_t font_height; struct cache_sym_s* cur_libsym; struct cache_sym_s* cur_libsym0; /* unit of the current libsym */ @@ -269,6 +270,36 @@ return xf; } +static csch_coord_t eeschema_get_font_height(read_ctx_t* const ctx) +{ + csch_text_t* text; + + if(ctx->font_height!=0) + { + return ctx->font_height; + } + + text = csch_text_alloc(ctx->sheet, &ctx->sheet->direct, + csch_oid_new(ctx->sheet, &ctx->sheet->direct)); + + text->hdr.stroke_name = csch_comm_str(ctx->sheet, "sym-decor", 1); + + text->spec_rot = 90; + text->text = (char*)"Mj"; + + /* update to get bbox ready */ + csch_text_update(ctx->sheet, text, 1); + + TODO("this is somehow different for vertical/horizontal texts (originally from: glob_label2.kicad_sch)"); + ctx->font_height = text->hdr.bbox.x2 - text->hdr.bbox.x1; + + text->text = NULL; + + csch_text_free(text); + + return ctx->font_height; +} + static csch_text_t* eeschema_find_attr_text(read_ctx_t* const ctx, csch_cgrp_t* const grp, const char* const str) { Index: plugins/io_eeschema/read_render.c =================================================================== --- plugins/io_eeschema/read_render.c (revision 11305) +++ plugins/io_eeschema/read_render.c (revision 11306) @@ -638,25 +638,9 @@ return -1; } - { - char* const old_text = text->text; - const double old_rot = text->spec_rot; - text->spec_rot = 90; + font_height = eeschema_get_font_height(ctx); + dbg_printf(" font_height = %u\n", (unsigned int)font_height); - text->text = (char*)"Mj"; - - /* update to get bbox ready */ - csch_text_update(ctx->sheet, text, 1); - - TODO("this is somehow different for vertical/horizontal texts, see glob_label2.kicad_sch"); - font_height = text->hdr.bbox.x2 - text->hdr.bbox.x1; - TODO("cache this value!"); - dbg_printf(" font_height = %u\n", (unsigned int)font_height); - - text->spec_rot = old_rot; - text->text = old_text; - } - /* update the object first to get access to bbox */ csch_text_update(ctx->sheet, text, 1);