doc updates (text attributes), prepare improvements for new_prop_string()

This commit is contained in:
stefan schippers 2023-10-03 13:21:04 +02:00
parent e49f9902a7
commit 24bc44ad0c
3 changed files with 10 additions and 7 deletions

View File

@ -261,7 +261,7 @@ device="tantalium capacitor"<br>
are perfectly equivalent.
</p>
<h3>TEXT OBJECT</h3>
<a id="textobj"><h3>TEXT OBJECT</h3></a>
<p>
Example: <kbd>T {3 of 4 NANDS of a 74ls00} 500 -580 0 0 0.4 0.4 {font=Monospace layer=4}</kbd><br>
This line defines a text object, the first field after the type tag is the displayed text,
@ -277,7 +277,7 @@ device="tantalium capacitor"<br>
with respect to its anchor point.
<img src="developer_info_03.png"></li>
<li> text X and Y sizes are stored as floating point numbers.</li>
<li> Finally a property string is stored with the same syntax as the displayed text field.
<li> Finally a property string is available to attach attributes to the text object.
Currently the following attributes are predefined for text objects:<br><br>
<ul>
<li><kbd>font</kbd> Name of font to be used (ex: font=Arial)</li>
@ -286,6 +286,8 @@ device="tantalium capacitor"<br>
<li><kbd>vcenter</kbd> If set to <kbd>true</kbd> vertical center text</li>
<li><kbd>weight</kbd> If set to <kbd>bold</kbd> use bold style</li>
<li><kbd>slant</kbd> If set to <kbd> italic</kbd> or <kbd>oblique</kbd> use that style for text</li>
<li><kbd>hide</kbd> If set to <kbd>true</kbd> text will be hidden unless <kbd>View-&gt;Show hidden texts</kbd>
is enabled</li>
</ul>
</li>
</ul>

View File

@ -98,7 +98,8 @@ p{padding: 15px 30px 10px;}
the 2 attributes may be set both to get full centered text box.<br>
A <kbd>weight=bold</kbd> attribute may be given for bold text, while a <kbd>slant=italic</kbd> or
<kbd>slant=oblique</kbd> may specify italic or slanted text.<br>
A <kbd>hide=true</kbd> will make the specified text invisible when the symbol is displayed as a component in a schematic.
A <kbd>hide=true</kbd> will make the specified text invisible unless the <kbd>View-&gt;Show hidden texts</kbd>
option is enabled.
</p>
<img src="xschem_elements_02.png">
<p>

View File

@ -678,8 +678,8 @@ void hash_names(int inst, int action)
if(upinst) my_free(_ALLOC_ID_, &upinst);
}
/* return -1 if name is not used, else return instance number with same name found */
static int name_is_used(char *name)
/* return -1 if name is not used, else return first instance number with same name found */
static int name_is_used(char *name, int q)
{
int mult, used = -1;
char *upinst = NULL;
@ -732,7 +732,7 @@ void new_prop_string(int i, const char *old_prop, int fast, int dis_uniq_names)
}
/* don't change old_prop if name does not conflict. */
/* if no hash_names() is done and inst_table uninitialized --> use old_prop */
is_used = name_is_used(old_name);
is_used = name_is_used(old_name, -1);
if(dis_uniq_names || is_used == -1 || is_used == i) {
my_strdup(_ALLOC_ID_, &xctx->inst[i].prop_ptr, old_prop);
my_free(_ALLOC_ID_, &old_name);
@ -752,7 +752,7 @@ void new_prop_string(int i, const char *old_prop, int fast, int dis_uniq_names)
} else { /* goes here if weird name set for example to name=[3:0] or name=12 */
my_snprintf(new_name, old_name_len + 40, "%d%s", q, brkt);
}
is_used = name_is_used(new_name);
is_used = name_is_used(new_name, q);
if(is_used == -1 ) break;
}
my_free(_ALLOC_ID_, &old_name_base);