/*************************************************************** SVGC EXAMPLE: STYLESHEET FILE This example reads CSS once and embeds its contents into SVG defs. ***************************************************************/ #include #include int main( void ) { struct __svg_sheet *sheet; struct __svg_scene *scene; struct __svg_node *text; sheet = (struct __svg_sheet *)__svg_new_sheet( 640, 160, 16, 16, 16, 16 ); if( !sheet ) return( 1 ); /* File content is copied into the sheet; no external CSS is needed later. */ if( __svg_sheet_add_css_file( sheet, "fonts.css" ) != 1 ) { __svg_free_node( sheet ); fprintf( stderr, "Cannot add fonts.css to the SVG sheet\n" ); return( 1 ); } scene = __svg_new_scene( sheet ); if( !scene ) { __svg_free_node( sheet ); return( 1 ); } text = __svg_new_text( 36, 90, "SVG fonts from CSS", "Roboto", 28 ); if( !text || __svg_scene_add_node( scene, text ) != 1 ) { if( text ) __svg_free_node( text ); __svg_free_scene( scene ); return( 1 ); } __svg_paint_scene( scene, 0, "example.svg" ); __svg_free_scene( scene ); return( 0 ); }