diff --git a/doc/xschem_man/component_property_syntax.html b/doc/xschem_man/component_property_syntax.html index bbef4ed8..16b48996 100644 --- a/doc/xschem_man/component_property_syntax.html +++ b/doc/xschem_man/component_property_syntax.html @@ -127,7 +127,7 @@ name="mchanged_name" model=\"nmos\" w="20u" l="3u" m="10"

A hide=true attribute will only display the symbol bounding box.

  • hide_texts
  • A hide_texts=true attribute will hide all symbol texts.

    -
  • text_<n>_size
  • +
  • text_size_<n>
  • This attribute sets the size of symbol text item number n. This allows instance based symbol text sizing.

  • highlight
  • diff --git a/src/actions.c b/src/actions.c index cec627af..9ad87c2f 100644 --- a/src/actions.c +++ b/src/actions.c @@ -808,42 +808,42 @@ int set_inst_flags(xInstance *inst) my_strdup2(_ALLOC_ID_, &(inst->lab), get_tok_value(inst->prop_ptr,"lab",0)); } } + if(!strboolcmp(get_tok_value(inst->prop_ptr,"hide",0), "true")) inst->flags |= HIDE_INST; + if(!strboolcmp(get_tok_value(inst->prop_ptr,"hide_texts",0), "true")) + inst->flags |= HIDE_SYMBOL_TEXTS; ptr = get_tok_value(inst->prop_ptr,"spice_ignore",0); if(!strcmp(ptr, "short")) inst->flags |= SPICE_SHORT; else if(!strboolcmp(ptr, "true") || !strcmp(ptr, "open")) inst->flags |= SPICE_IGNORE; - + ptr = get_tok_value(inst->prop_ptr,"verilog_ignore",0); if(!strcmp(ptr, "short")) inst->flags |= VERILOG_SHORT; else if(!strboolcmp(ptr, "true") || !strcmp(ptr, "open")) inst->flags |= VERILOG_IGNORE; - + ptr = get_tok_value(inst->prop_ptr,"vhdl_ignore",0); if(!strcmp(ptr, "short")) inst->flags |= VHDL_SHORT; else if(!strboolcmp(ptr, "true") || !strcmp(ptr, "open")) inst->flags |= VHDL_IGNORE; - + ptr = get_tok_value(inst->prop_ptr,"tedax_ignore",0); if(!strcmp(ptr, "short")) inst->flags |= TEDAX_SHORT; else if(!strboolcmp(ptr, "true") || !strcmp(ptr, "open")) inst->flags |= TEDAX_IGNORE; - + ptr = get_tok_value(inst->prop_ptr,"lvs_ignore",0); if(!strcmp(ptr, "short")) inst->flags |= LVS_IGNORE_SHORT; else if(!strboolcmp(ptr, "true") || !strcmp(ptr, "open")) inst->flags |= LVS_IGNORE_OPEN; - if(!strboolcmp(get_tok_value(inst->prop_ptr,"hide_texts",0), "true")) - inst->flags |= HIDE_SYMBOL_TEXTS; - if(!strboolcmp(get_tok_value(inst->prop_ptr,"highlight",0), "true")) inst->flags |= HILIGHT_CONN; diff --git a/src/draw.c b/src/draw.c index c1dc925d..a64b556f 100644 --- a/src/draw.c +++ b/src/draw.c @@ -420,17 +420,21 @@ void get_sym_text_size(int inst, int text_n, double *xscale, double *yscale) const char *ts; double size; int sym_n = xctx->inst[inst].ptr; - xText *txtptr; if(sym_n >= 0 && xctx->sym[sym_n].texts > text_n) { - txtptr = &(xctx->sym[sym_n].text[text_n]); - my_snprintf(attr, S(attr), "text_%d_size", text_n); - ts = get_tok_value(xctx->inst[inst].prop_ptr, attr, 0); + if(strstr(xctx->inst[inst].prop_ptr, "text_size_")) { + my_snprintf(attr, S(attr), "text_size_%d", text_n); + ts = get_tok_value(xctx->inst[inst].prop_ptr, attr, 0); + } else { + xctx->tok_size = 0; + } if(xctx->tok_size) { size = atof(ts); *xscale = size; *yscale = size; } else { + xText *txtptr; + txtptr = &(xctx->sym[sym_n].text[text_n]); *xscale = txtptr->xscale; *yscale = txtptr->yscale; } diff --git a/src/token.c b/src/token.c index d613e25f..58751887 100644 --- a/src/token.c +++ b/src/token.c @@ -440,6 +440,7 @@ const char *get_tok_value(const char *s,const char *tok, int with_quotes) static char *translated_tok = NULL; xctx->tok_size = 0; + if(s==NULL) { if(tok == NULL) { my_free(_ALLOC_ID_, &result); @@ -450,6 +451,7 @@ const char *get_tok_value(const char *s,const char *tok, int with_quotes) } return ""; } + if(!tok || !strstr(s, tok)) return ""; /* dbg(0, "get_tok_value(): looking for <%s> in <%.30s>\n",tok,s); */ if( size == 0 ) { sizetok = size = CADCHUNKALLOC;