draw_symbol() and draw_temp_symbol(): do not attempt to do a 2nd level @var resolution for texts as this creates more inconveniences than advantages (quoting hell)

This commit is contained in:
stefan schippers 2024-03-20 23:57:01 +01:00
parent e55c8294c2
commit 12b01e31c6
2 changed files with 15 additions and 7 deletions

View File

@ -717,9 +717,13 @@ void draw_symbol(int what,int c, int n,int layer,short tmp_flip, short rot,
}
#endif
my_strdup2(_ALLOC_ID_, &txtptr, translate(n, text.txt_ptr));
if(strchr(txtptr, '@') && !strstr(text.txt_ptr, "\\@"))
my_strdup2(_ALLOC_ID_, &txtptr, translate(n, txtptr));
dbg(1, "drawing string: str=%s prop=%s\n", txtptr, text.prop_ptr);
/* this is not done in symbol_bbox and creates inconsistencies
* between bbox calculated text and displayed ext */
/*
* if(strchr(txtptr, '@') && !strstr(text.txt_ptr, "\\@"))
* my_strdup2(_ALLOC_ID_, &txtptr, translate(n, txtptr));
*/
dbg(1, "drawing string: str=%s prop=%s\n", txtptr, text.prop_ptr ? text.prop_ptr : "NULL");
draw_string(textlayer, what, txtptr,
(text.rot + ( (flip && (text.rot & 1) ) ? rot+2 : rot) ) & 0x3,
flip^text.flip, text.hcenter, text.vcenter,
@ -886,8 +890,12 @@ void draw_temp_symbol(int what, GC gc, int n,int layer,short tmp_flip, short rot
customfont = set_text_custom_font(&text);
#endif
my_strdup2(_ALLOC_ID_, &txtptr, translate(n, text.txt_ptr));
if(strchr(txtptr, '@') && !strstr(text.txt_ptr, "\\@"))
my_strdup2(_ALLOC_ID_, &txtptr, translate(n, txtptr));
/* this is not done in symbol_bbox and creates inconsistencies
* between bbox calculated text and displayed ext */
/*
* if(strchr(txtptr, '@') && !strstr(text.txt_ptr, "\\@"))
* my_strdup2(_ALLOC_ID_, &txtptr, translate(n, txtptr));
*/
if(txtptr[0]) draw_temp_string(gc, what, txtptr,
(text.rot + ( (flip && (text.rot & 1) ) ? rot+2 : rot) ) & 0x3,
flip^text.flip, text.hcenter, text.vcenter, x0+x1, y0+y1, xscale, yscale);

View File

@ -360,9 +360,9 @@ void symbol_bbox(int i, double *x1,double *y1, double *x2, double *y2)
if(!xctx->show_hidden_texts && (text.flags & (HIDE_TEXT | HIDE_TEXT_INSTANTIATED))) continue;
sym_flip = flip;
sym_rot = rot;
/* dbg(2, "symbol_bbox(): instance %d text n: %d text str=%s\n", i,j, text.txt_ptr? text.txt_ptr:"NULL"); */
dbg(1, "symbol_bbox(): instance %d text n: %d text str=%s\n", i,j, text.txt_ptr? text.txt_ptr:"NULL");
tmp_txt = translate(i, text.txt_ptr);
/* dbg(2, "symbol_bbox(): translated text: %s\n", tmp_txt); */
dbg(1, "symbol_bbox(): translated text: %s\n", tmp_txt);
ROTATION(rot, flip, 0.0,0.0,text.x0, text.y0,text_x0,text_y0);
#if HAS_CAIRO==1
customfont=set_text_custom_font(&text);