add attributes "weight=bold", "slant=italic", "slant=oblique" on text objects for bold/italic/oblique texts, doc updates.

This commit is contained in:
Stefan Schippers 2020-09-23 18:15:26 +02:00
parent 39b7a441b3
commit 5bab41e28b
8 changed files with 164 additions and 73 deletions

View File

@ -95,7 +95,9 @@ p{padding: 15px 30px 10px;}
A <kbd>font</kbd> property is defined to change the default font.
A <kbd>hcenter=true</kbd> attribute may be set to center text in the reading direction,
while <kbd>vcenter=true</kbd> centers text in the perpendicular (to reading) direction.
the 2 attributes may be set both to get full centered text box.
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.
</p>
<img src="xschem_elements_02.png">
<p>

View File

@ -2189,7 +2189,7 @@ void place_text(int draw_text, double mx, double my)
{
char *txt;
int textlayer;
const char *strlayer;
const char *str;
int save_draw;
/* 20171112 */
@ -2231,24 +2231,39 @@ void place_text(int draw_text, double mx, double my)
/* textelement[lasttext].prop_ptr=NULL; */
dbg(1, "place_text(): done text input\n");
strlayer = get_tok_value(textelement[lasttext].prop_ptr, "hcenter", 0);
textelement[lasttext].hcenter = strcmp(strlayer, "true") ? 0 : 1;
strlayer = get_tok_value(textelement[lasttext].prop_ptr, "vcenter", 0);
textelement[lasttext].vcenter = strcmp(strlayer, "true") ? 0 : 1;
str = get_tok_value(textelement[lasttext].prop_ptr, "hcenter", 0);
textelement[lasttext].hcenter = strcmp(str, "true") ? 0 : 1;
str = get_tok_value(textelement[lasttext].prop_ptr, "vcenter", 0);
textelement[lasttext].vcenter = strcmp(str, "true") ? 0 : 1;
strlayer = get_tok_value(textelement[lasttext].prop_ptr, "layer", 0);
if(strlayer[0]) textelement[lasttext].layer = atoi(strlayer);
str = get_tok_value(textelement[lasttext].prop_ptr, "layer", 0);
if(str[0]) textelement[lasttext].layer = atoi(str);
else textelement[lasttext].layer = -1;
textelement[lasttext].flags = 0;
str = get_tok_value(textelement[lasttext].prop_ptr, "slant", 0);
textelement[lasttext].flags |= strcmp(str, "oblique") ? 0 : TEXT_OBLIQUE;
textelement[lasttext].flags |= strcmp(str, "italic") ? 0 : TEXT_ITALIC;
str = get_tok_value(textelement[lasttext].prop_ptr, "weight", 0);
textelement[lasttext].flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
my_strdup(21, &textelement[lasttext].font, get_tok_value(textelement[lasttext].prop_ptr, "font", 0));/* 20171206 */
textlayer = textelement[lasttext].layer;
if(textlayer < 0 || textlayer >= cadlayers) textlayer = TEXTLAYER;
#ifdef HAS_CAIRO
textfont = textelement[lasttext].font;
if(textfont && textfont[0]) {
if((textfont && textfont[0]) || textelement[lasttext].flags) {
cairo_font_slant_t slant;
cairo_font_weight_t weight;
textfont = (textelement[lasttext].font && textelement[lasttext].font[0]) ? textelement[lasttext].font : cairo_font_name;
weight = ( textelement[lasttext].flags & TEXT_BOLD) ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL;
slant = CAIRO_FONT_SLANT_NORMAL;
if(textelement[lasttext].flags & TEXT_ITALIC) slant = CAIRO_FONT_SLANT_ITALIC;
if(textelement[lasttext].flags & TEXT_OBLIQUE) slant = CAIRO_FONT_SLANT_OBLIQUE;
cairo_save(ctx);
cairo_save(save_ctx);
cairo_select_font_face (ctx, textfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_select_font_face (save_ctx, textfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_select_font_face (ctx, textfont, slant, weight);
cairo_select_font_face (save_ctx, textfont, slant, weight);
}
#endif
save_draw=draw_window; /* 20181009 */
@ -2258,9 +2273,7 @@ void place_text(int draw_text, double mx, double my)
textelement[lasttext].xscale, textelement[lasttext].yscale);
draw_window = save_draw;
#ifdef HAS_CAIRO
if(textfont && textfont[0]) {
cairo_select_font_face (ctx, cairo_font_name, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_select_font_face (save_ctx, cairo_font_name, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
if((textfont && textfont[0]) || textelement[lasttext].flags) {
cairo_restore(ctx);
cairo_restore(save_ctx);
}

View File

@ -203,8 +203,7 @@ void print_image()
cairo_set_line_width(save_ctx, 1);
cairo_set_line_join(save_ctx, CAIRO_LINE_JOIN_ROUND);
cairo_set_line_cap(save_ctx, CAIRO_LINE_CAP_ROUND);
cairo_select_font_face (save_ctx, cairo_font_name,
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_select_font_face (save_ctx, cairo_font_name, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (save_ctx, 20);
#endif /*HAS_CAIRO */
@ -228,9 +227,16 @@ int set_text_custom_font(Text *txt) /* 20171122 for correct text_bbox calculatio
char *textfont;
textfont = txt->font;
if(textfont && textfont[0]) {
if((textfont && textfont[0]) || txt->flags) {
cairo_font_slant_t slant;
cairo_font_weight_t weight;
textfont = (txt->font && txt->font[0]) ? txt->font : cairo_font_name;
weight = ( txt->flags & TEXT_BOLD) ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL;
slant = CAIRO_FONT_SLANT_NORMAL;
if(txt->flags & TEXT_ITALIC) slant = CAIRO_FONT_SLANT_ITALIC;
if(txt->flags & TEXT_OBLIQUE) slant = CAIRO_FONT_SLANT_OBLIQUE;
cairo_save(ctx);
cairo_select_font_face (ctx, textfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_select_font_face (ctx, textfont, slant, weight);
return 1;
}
return 0;
@ -586,11 +592,19 @@ void draw_symbol(int what,int c, int n,int layer,int tmp_flip, int rot,
if((c == PINLAYER && inst_ptr[n].flags & 4) || enable_layer[textlayer]) {
#ifdef HAS_CAIRO
textfont = symptr->txtptr[j].font;
if(textfont && textfont[0]) {
if((textfont && textfont[0]) || symptr->txtptr[j].flags) {
cairo_font_slant_t slant;
cairo_font_weight_t weight;
textfont = (symptr->txtptr[j].font && symptr->txtptr[j].font[0]) ? symptr->txtptr[j].font : cairo_font_name;
weight = ( symptr->txtptr[j].flags & TEXT_BOLD) ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL;
slant = CAIRO_FONT_SLANT_NORMAL;
if(symptr->txtptr[j].flags & TEXT_ITALIC) slant = CAIRO_FONT_SLANT_ITALIC;
if(symptr->txtptr[j].flags & TEXT_OBLIQUE) slant = CAIRO_FONT_SLANT_OBLIQUE;
cairo_save(ctx);
cairo_save(save_ctx);
cairo_select_font_face (ctx, textfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_select_font_face (save_ctx, textfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_select_font_face (ctx, textfont, slant, weight);
cairo_select_font_face (save_ctx, textfont, slant, weight);
}
#endif
dbg(1, "drawing string: str=%s prop=%s\n", txtptr, text.prop_ptr);
@ -603,7 +617,7 @@ void draw_symbol(int what,int c, int n,int layer,int tmp_flip, int rot,
drawline(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0);
#endif
#ifdef HAS_CAIRO
if(textfont && textfont[0]) {
if( (textfont && textfont[0]) || symptr->txtptr[j].flags) {
cairo_restore(ctx);
cairo_restore(save_ctx);
}
@ -1704,11 +1718,19 @@ void draw(void)
dbg(1, "draw(): drawing string %d = %s\n",i, textelement[i].txt_ptr);
#ifdef HAS_CAIRO
textfont = textelement[i].font; /* 20171206 */
if(textfont && textfont[0]) {
if( (textfont && textfont[0]) || textelement[i].flags) {
cairo_font_slant_t slant;
cairo_font_weight_t weight;
textfont = (textelement[i].font && textelement[i].font[0]) ? textelement[i].font : cairo_font_name;
weight = ( textelement[i].flags & TEXT_BOLD) ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL;
slant = CAIRO_FONT_SLANT_NORMAL;
if(textelement[i].flags & TEXT_ITALIC) slant = CAIRO_FONT_SLANT_ITALIC;
if(textelement[i].flags & TEXT_OBLIQUE) slant = CAIRO_FONT_SLANT_OBLIQUE;
cairo_save(ctx);
cairo_save(save_ctx);
cairo_select_font_face (ctx, textfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_select_font_face (save_ctx, textfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_select_font_face (ctx, textfont, slant, weight);
cairo_select_font_face (save_ctx, textfont, slant, weight);
}
#endif
@ -1717,7 +1739,7 @@ void draw(void)
textelement[i].x0,textelement[i].y0,
textelement[i].xscale, textelement[i].yscale);
#ifdef HAS_CAIRO
if(textfont && textfont[0]) {
if((textfont && textfont[0]) || textelement[i].flags ) {
cairo_restore(ctx);
cairo_restore(save_ctx);
}

View File

@ -706,7 +706,7 @@ void edit_text_property(int x)
double xx1,yy1,xx2,yy2;
double pcx,pcy; /* pin center 20070317 */
char property[1024];/* used for float 2 string conv (xscale and yscale) overflow safe */
const char *strlayer;
const char *str;
char *oldprop = NULL;
dbg(1, "edit_text_property(): entering\n");
@ -815,14 +815,23 @@ void edit_text_property(int x)
my_strdup(75, &textelement[sel].prop_ptr,(char *) tclgetvar("props"));
my_strdup(76, &textelement[sel].font, get_tok_value(textelement[sel].prop_ptr, "font", 0));/*20171206 */
strlayer = get_tok_value(textelement[sel].prop_ptr, "hcenter", 0);
textelement[sel].hcenter = strcmp(strlayer, "true") ? 0 : 1;
strlayer = get_tok_value(textelement[sel].prop_ptr, "vcenter", 0);
textelement[sel].vcenter = strcmp(strlayer, "true") ? 0 : 1;
str = get_tok_value(textelement[sel].prop_ptr, "hcenter", 0);
textelement[sel].hcenter = strcmp(str, "true") ? 0 : 1;
str = get_tok_value(textelement[sel].prop_ptr, "vcenter", 0);
textelement[sel].vcenter = strcmp(str, "true") ? 0 : 1;
strlayer = get_tok_value(textelement[sel].prop_ptr, "layer", 0); /* 20171206 */
if(strlayer[0]) textelement[sel].layer = atoi(strlayer);
str = get_tok_value(textelement[sel].prop_ptr, "layer", 0); /* 20171206 */
if(str[0]) textelement[sel].layer = atoi(str);
else textelement[sel].layer=-1;
textelement[sel].flags = 0;
str = get_tok_value(textelement[sel].prop_ptr, "slant", 0);
textelement[sel].flags |= strcmp(str, "oblique") ? 0 : TEXT_OBLIQUE;
textelement[sel].flags |= strcmp(str, "italic") ? 0 : TEXT_ITALIC;
str = get_tok_value(textelement[sel].prop_ptr, "weight", 0);
textelement[sel].flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
textelement[sel].xscale=atof(tclgetvar("hsize"));
textelement[sel].yscale=atof(tclgetvar("vsize"));
}

View File

@ -453,7 +453,7 @@ void copy_objects(int what)
int newpropcnt;
double tmpx, tmpy;
int textlayer;
const char *strlayer;
const char *str;
/* 20171112 */
#ifdef HAS_CAIRO
@ -737,15 +737,22 @@ void copy_objects(int what)
my_strdup(231, &textelement[lasttext].font, get_tok_value(textelement[lasttext].prop_ptr, "font", 0));/*20171206 */
strlayer = get_tok_value(textelement[lasttext].prop_ptr, "hcenter", 0);
textelement[lasttext].hcenter = strcmp(strlayer, "true") ? 0 : 1;
strlayer = get_tok_value(textelement[lasttext].prop_ptr, "vcenter", 0);
textelement[lasttext].vcenter = strcmp(strlayer, "true") ? 0 : 1;
str = get_tok_value(textelement[lasttext].prop_ptr, "hcenter", 0);
textelement[lasttext].hcenter = strcmp(str, "true") ? 0 : 1;
str = get_tok_value(textelement[lasttext].prop_ptr, "vcenter", 0);
textelement[lasttext].vcenter = strcmp(str, "true") ? 0 : 1;
strlayer = get_tok_value(textelement[lasttext].prop_ptr, "layer", 0); /*20171206 */
if(strlayer[0]) textelement[lasttext].layer = atoi(strlayer);
str = get_tok_value(textelement[lasttext].prop_ptr, "layer", 0); /*20171206 */
if(str[0]) textelement[lasttext].layer = atoi(str);
else textelement[lasttext].layer = -1;
textelement[lasttext].flags = 0;
str = get_tok_value(textelement[lasttext].prop_ptr, "slant", 0);
textelement[lasttext].flags |= strcmp(str, "oblique") ? 0 : TEXT_OBLIQUE;
textelement[lasttext].flags |= strcmp(str, "italic") ? 0 : TEXT_ITALIC;
str = get_tok_value(textelement[lasttext].prop_ptr, "weight", 0);
textelement[lasttext].flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
textelement[lasttext].xscale=textelement[n].xscale;
textelement[lasttext].yscale=textelement[n].yscale;
@ -753,11 +760,18 @@ void copy_objects(int what)
if(textlayer < 0 || textlayer >= cadlayers) textlayer = TEXTLAYER;
#ifdef HAS_CAIRO
textfont = textelement[lasttext].font; /* 20171206 */
if(textfont && textfont[0]) {
if((textfont && textfont[0]) || textelement[lasttext].flags) {
cairo_font_slant_t slant;
cairo_font_weight_t weight;
textfont = (textelement[lasttext].font && textelement[lasttext].font[0]) ? textelement[lasttext].font : cairo_font_name;
weight = ( textelement[lasttext].flags & TEXT_BOLD) ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL;
slant = CAIRO_FONT_SLANT_NORMAL;
if(textelement[lasttext].flags & TEXT_ITALIC) slant = CAIRO_FONT_SLANT_ITALIC;
if(textelement[lasttext].flags & TEXT_OBLIQUE) slant = CAIRO_FONT_SLANT_OBLIQUE;
cairo_save(ctx);
cairo_save(save_ctx);
cairo_select_font_face (ctx, textfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_select_font_face (save_ctx, textfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_select_font_face (ctx, textfont, slant, weight);
cairo_select_font_face (save_ctx, textfont, slant, weight);
}
#endif
draw_string(textlayer, ADD, textelement[lasttext].txt_ptr, /* draw moved txt */
@ -769,9 +783,7 @@ void copy_objects(int what)
drawline(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0);
#endif
#ifdef HAS_CAIRO
if(textfont && textfont[0]) {
/* cairo_select_font_face (ctx, cairo_font_name, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); */
/* cairo_select_font_face (save_ctx, cairo_font_name, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); */
if( (textfont && textfont[0]) || textelement[lasttext].flags) {
cairo_restore(ctx);
cairo_restore(save_ctx);
}
@ -1220,11 +1232,18 @@ void move_objects(int what, int merge, double dx, double dy)
if(textlayer < 0 || textlayer >= cadlayers) textlayer = TEXTLAYER;
#ifdef HAS_CAIRO
textfont = textelement[n].font; /* 20171206 */
if(textfont && textfont[0]) {
if((textfont && textfont[0]) || textelement[n].flags) {
cairo_font_slant_t slant;
cairo_font_weight_t weight;
textfont = (textelement[n].font && textelement[n].font[0]) ? textelement[n].font : cairo_font_name;
weight = ( textelement[n].flags & TEXT_BOLD) ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL;
slant = CAIRO_FONT_SLANT_NORMAL;
if(textelement[n].flags & TEXT_ITALIC) slant = CAIRO_FONT_SLANT_ITALIC;
if(textelement[n].flags & TEXT_OBLIQUE) slant = CAIRO_FONT_SLANT_OBLIQUE;
cairo_save(ctx);
cairo_save(save_ctx);
cairo_select_font_face (ctx, textfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_select_font_face (save_ctx, textfont, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_select_font_face (ctx, textfont, slant, weight);
cairo_select_font_face (save_ctx, textfont, slant, weight);
}
#endif
draw_string(textlayer, ADD, textelement[n].txt_ptr, /* draw moved txt */
@ -1236,9 +1255,7 @@ void move_objects(int what, int merge, double dx, double dy)
drawline(textlayer, END, 0.0, 0.0, 0.0, 0.0, 0);
#endif
#ifdef HAS_CAIRO
if(textfont && textfont[0]) {
/*cairo_select_font_face (ctx, cairo_font_name, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); */
/*cairo_select_font_face (save_ctx, cairo_font_name, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL); */
if( (textfont && textfont[0]) || textelement[n].flags) {
cairo_restore(ctx);
cairo_restore(save_ctx);
}

View File

@ -29,7 +29,7 @@
void merge_text(FILE *fd)
{
int i;
const char *strlayer;
const char *str;
check_text_storage();
i=lasttext;
textelement[i].txt_ptr=NULL;
@ -45,15 +45,22 @@ void merge_text(FILE *fd)
my_strdup(302, &textelement[i].font, get_tok_value(textelement[i].prop_ptr, "font", 0));/*20171206 */
strlayer = get_tok_value(textelement[i].prop_ptr, "hcenter", 0);
textelement[i].hcenter = strcmp(strlayer, "true") ? 0 : 1;
strlayer = get_tok_value(textelement[i].prop_ptr, "vcenter", 0);
textelement[i].vcenter = strcmp(strlayer, "true") ? 0 : 1;
str = get_tok_value(textelement[i].prop_ptr, "hcenter", 0);
textelement[i].hcenter = strcmp(str, "true") ? 0 : 1;
str = get_tok_value(textelement[i].prop_ptr, "vcenter", 0);
textelement[i].vcenter = strcmp(str, "true") ? 0 : 1;
strlayer = get_tok_value(textelement[i].prop_ptr, "layer", 0); /*20171206 */
if(strlayer[0]) textelement[i].layer = atoi(strlayer);
str = get_tok_value(textelement[i].prop_ptr, "layer", 0); /*20171206 */
if(str[0]) textelement[i].layer = atoi(str);
else textelement[i].layer = -1;
textelement[i].flags = 0;
str = get_tok_value(textelement[i].prop_ptr, "slant", 0);
textelement[i].flags |= strcmp(str, "oblique") ? 0 : TEXT_OBLIQUE;
textelement[i].flags |= strcmp(str, "italic") ? 0 : TEXT_ITALIC;
str = get_tok_value(textelement[i].prop_ptr, "weight", 0);
textelement[i].flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
select_text(i,SELECTED, 1);
set_modify(1);
lasttext++;

View File

@ -449,7 +449,7 @@ void write_xschem_file(FILE *fd)
static void load_text(FILE *fd)
{
int i;
const char *strlayer;
const char *str;
dbg(3, "load_text(): start\n");
check_text_storage();
i=lasttext;
@ -469,14 +469,21 @@ static void load_text(FILE *fd)
load_ascii_string(&textelement[i].prop_ptr,fd);
if( textelement[i].prop_ptr) my_strdup(318, &textelement[i].font, get_tok_value(textelement[i].prop_ptr, "font", 0));/*20171206 */
strlayer = get_tok_value(textelement[i].prop_ptr, "hcenter", 0);
textelement[i].hcenter = strcmp(strlayer, "true") ? 0 : 1;
strlayer = get_tok_value(textelement[i].prop_ptr, "vcenter", 0);
textelement[i].vcenter = strcmp(strlayer, "true") ? 0 : 1;
str = get_tok_value(textelement[i].prop_ptr, "hcenter", 0);
textelement[i].hcenter = strcmp(str, "true") ? 0 : 1;
str = get_tok_value(textelement[i].prop_ptr, "vcenter", 0);
textelement[i].vcenter = strcmp(str, "true") ? 0 : 1;
strlayer = get_tok_value(textelement[i].prop_ptr, "layer", 0); /*20171206 */
if(strlayer[0]) textelement[i].layer = atoi(strlayer);
str = get_tok_value(textelement[i].prop_ptr, "layer", 0); /*20171206 */
if(str[0]) textelement[i].layer = atoi(str);
else textelement[i].layer = -1;
textelement[i].flags = 0;
str = get_tok_value(textelement[i].prop_ptr, "slant", 0);
textelement[i].flags |= strcmp(str, "oblique") ? 0 : TEXT_OBLIQUE;
textelement[i].flags |= strcmp(str, "italic") ? 0 : TEXT_ITALIC;
str = get_tok_value(textelement[i].prop_ptr, "weight", 0);
textelement[i].flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
lasttext++;
}
@ -1296,7 +1303,7 @@ int load_sym_def(const char *name, FILE *embed_fd)
int lastt; /* 20171115 lastp */
Text *tt;
int endfile;
const char *strlayer;
const char *str;
const char *label;
char *pin_label = NULL, *recover_str=NULL;
char *skip_line;
@ -1595,14 +1602,22 @@ int load_sym_def(const char *name, FILE *embed_fd)
my_strdup(351, &tt[i].font, get_tok_value(tt[i].prop_ptr, "font", 0));/*20171206 */
strlayer = get_tok_value(tt[i].prop_ptr, "hcenter", 0);
tt[i].hcenter = strcmp(strlayer, "true") ? 0 : 1;
strlayer = get_tok_value(tt[i].prop_ptr, "vcenter", 0);
tt[i].vcenter = strcmp(strlayer, "true") ? 0 : 1;
str = get_tok_value(tt[i].prop_ptr, "hcenter", 0);
tt[i].hcenter = strcmp(str, "true") ? 0 : 1;
str = get_tok_value(tt[i].prop_ptr, "vcenter", 0);
tt[i].vcenter = strcmp(str, "true") ? 0 : 1;
strlayer = get_tok_value(tt[i].prop_ptr, "layer", 0); /*20171206 */
if(strlayer[0]) tt[i].layer = atoi(strlayer);
str = get_tok_value(tt[i].prop_ptr, "layer", 0); /*20171206 */
if(str[0]) tt[i].layer = atoi(str);
else tt[i].layer = -1;
tt[i].flags = 0;
str = get_tok_value(tt[i].prop_ptr, "slant", 0);
tt[i].flags |= strcmp(str, "oblique") ? 0 : TEXT_OBLIQUE;
tt[i].flags |= strcmp(str, "italic") ? 0 : TEXT_ITALIC;
str = get_tok_value(tt[i].prop_ptr, "weight", 0);
tt[i].flags |= strcmp(str, "bold") ? 0 : TEXT_BOLD;
lastt++;
break;
case 'N': /* store wires as lines on layer WIRELAYER. */

View File

@ -240,6 +240,11 @@ extern char win_temp_dir[PATH_MAX];
#define XDELETE 2
#define XINSERT_NOREPLACE 3 /* do not replace token value in hash if already present */
/* Cairo text flags */
#define TEXT_BOLD 1
#define TEXT_OBLIQUE 2
#define TEXT_ITALIC 4
#define S(a) (sizeof(a)/sizeof(char))
#define BUS_WIDTH 4
#define POINTINSIDE(xa,ya,x1,y1,x2,y2) \
@ -370,6 +375,7 @@ typedef struct
int layer; /* 20171201 for cairo */
int hcenter, vcenter;
char *font; /* 20171201 for cairo */
int flags;
} Text;
typedef struct