use Sans-Serif for svg default font instead of SansSerif that is unrecognized on some browsers

This commit is contained in:
Stefan Frederik 2020-12-22 13:08:11 +01:00
parent ae11f27db0
commit 5e0ba4766b
5 changed files with 12 additions and 18 deletions

View File

@ -139,8 +139,8 @@ int flat_netlist=0;
int cadlayers=0;
int hide_symbols = 0; /* draw only a bounding box for component instances and @symname, @name texts */
int dark_colorscheme=1;
char cairo_font_name[1024]="SansSerif";
char svg_font_name[1024]="SansSerif";
char cairo_font_name[80]="Sans-Serif";
char svg_font_name[80]="Sans-Serif";
double cairo_font_scale=1.0; /* default: 1.0, allows to adjust font size */
double nocairo_font_xscale=0.85; /* match with cairo sizing */
double nocairo_font_yscale=0.88; /* match with cairo sizing */

View File

@ -35,7 +35,7 @@ typedef struct {
static Svg_color *svg_colors;
static char svg_font_weight[80] = "normal"; /* normal, bold, bolder, lighter */
static char svg_font_family[80] = "SansSerif"; /* serif, monospace, Helvetica, Arial */
static char svg_font_family[80] = "Sans-Serif"; /* Serif, Monospace, Helvetica, Arial */
static char svg_font_style[80] = "normal"; /* normal, italic, oblique */
static double svg_linew; /* current width of lines / rectangles */
@ -226,7 +226,7 @@ static void svg_draw_string_line(int layer, char *s, double x, double y, double
fprintf(fd,"<text fill=\"%s\" xml:space=\"preserve\" font-size=\"%g\" ", col, size*xctx->mooz);
if(strcmp(svg_font_weight, "normal")) fprintf(fd, "font-weight=\"%s\" ", svg_font_weight);
if(strcmp(svg_font_style, "normal")) fprintf(fd, "font-style=\"%s\" ", svg_font_style);
if(strcmp(svg_font_family, "SansSerif")) fprintf(fd, "style=\"font-family:%s;\" ", svg_font_family);
if(strcmp(svg_font_family, svg_font_name)) fprintf(fd, "style=\"font-family:%s;\" ", svg_font_family);
if(rot1) fprintf(fd, "transform=\"translate(%g, %g) rotate(%d)\" ", ix, iy, rot1*90);
else fprintf(fd, "transform=\"translate(%g, %g)\" ", ix, iy);
fprintf(fd, ">");
@ -622,17 +622,11 @@ void svg_draw(void)
fprintf(fd, "}\n");
}
fprintf(fd, "text {font-family: SansSerif;}\n");
fprintf(fd, "text {font-family: %s;}\n", svg_font_name);
fprintf(fd, "</style>\n");
/* background */
fprintf(fd,
"<rect x=\"%g\" y=\"%g\" width=\"%g\" height=\"%g\" fill=\"rgb(%d,%d,%d)\" "
"stroke=\"rgb(%d,%d,%d)\" stroke-width=\"%g\" />\n",
0.0, 0.0, dx, dy,
svg_colors[0].red, svg_colors[0].green, svg_colors[0].blue,
svg_colors[0].red, svg_colors[0].green, svg_colors[0].blue,
svg_linew);
fprintf(fd, "<rect class=\"l0\" x=\"%g\" y=\"%g\" width=\"%g\" height=\"%g\"\/>\n", 0.0, 0.0, dx, dy);
svg_drawgrid();
for(i=0;i<xctx->texts;i++)
{

View File

@ -755,9 +755,9 @@ extern size_t get_tok_size;
extern int batch_mode; /* no TCL console */
extern int hide_symbols; /* draw only a bounding box for component instances and @symname, @name texts */
extern int show_pin_net_names;
extern char svg_font_name[1024];
extern char svg_font_name[80];
/* CAIRO specific global variables */
extern char cairo_font_name[1024];
extern char cairo_font_name[80];
extern int cairo_longest_line;
extern int cairo_lines;
extern double cairo_font_scale; /* default: 1.0, allows to adjust font size */

View File

@ -3490,8 +3490,8 @@ set_ne cairo_vert_correct 0
set_ne nocairo_vert_correct 0
# Arial, Monospace
set_ne cairo_font_name {SansSerif}
set_ne svg_font_name {SansSerif}
set_ne cairo_font_name {Sans-Serif}
set_ne svg_font_name {Sans-Serif}
# has_cairo set by c program if cairo enabled
set has_cairo 0

View File

@ -180,8 +180,8 @@ set disable_unique_names 0
# set cairo_font_line_spacing 1.0
#### Specify a font
# set cairo_font_name {SansSerif}
# set svg_font_name {SansSerif}
# set cairo_font_name {Sans-Serif}
# set svg_font_name {Sans-Serif}
#### Lift up text by some zoom-corrected pixels for
#### better compatibility wrt no cairo version.