From bab29bf8b511ddf638b52abb446ccbdc05cc0c6c Mon Sep 17 00:00:00 2001 From: Gwenhael Le Moine Date: Tue, 5 Nov 2024 19:01:19 +0100 Subject: [PATCH] remove more dead code --- src/x49gpng/ui_symbol.c | 198 ---------------------------------------- src/x49gpng/ui_symbol.h | 76 --------------- 2 files changed, 274 deletions(-) delete mode 100644 src/x49gpng/ui_symbol.c delete mode 100644 src/x49gpng/ui_symbol.h diff --git a/src/x49gpng/ui_symbol.c b/src/x49gpng/ui_symbol.c deleted file mode 100644 index 338dbe3..0000000 --- a/src/x49gpng/ui_symbol.c +++ /dev/null @@ -1,198 +0,0 @@ -#include -#include - -#include -#include - -#include "ui_symbol.h" - -static const cairo_path_data_t symbol_square_path_data[] = { SYMBOL_MOVE_TO( 0.100, 0.100 ), SYMBOL_LINE_TO( 0.500, 0.000 ), - SYMBOL_LINE_TO( 0.000, 0.500 ), SYMBOL_LINE_TO( -0.500, 0.000 ), - SYMBOL_CLOSE_PATH() }; -SYMBOL( square, 0.7, 0.0, 0.1, 0.1, 0.6, 0.6 ); - -static const cairo_path_data_t symbol_triangleup_path_data[] = { SYMBOL_MOVE_TO( 0.100, 0.000 ), SYMBOL_LINE_TO( 0.800, 0.000 ), - SYMBOL_LINE_TO( -0.400, 0.693 ), SYMBOL_CLOSE_PATH() }; -SYMBOL( triangleup, 1.0, 0.0, 0.1, 0.0, 0.9, 0.693 ); - -static const cairo_path_data_t symbol_triangleright_path_data[] = { SYMBOL_MOVE_TO( 0.100, 0.000 ), SYMBOL_LINE_TO( 0.000, 0.800 ), - SYMBOL_LINE_TO( 0.693, -0.400 ), SYMBOL_CLOSE_PATH() }; -SYMBOL( triangleright, 0.893, 0.0, 0.1, 0.0, 0.793, 0.8 ); - -static const cairo_path_data_t symbol_arrowleftdblfull_path_data[] = { - SYMBOL_MOVE_TO( 0.100, 0.370 ), SYMBOL_LINE_TO( 0.652, 0.500 ), SYMBOL_LINE_TO( 0.000, -0.250 ), SYMBOL_LINE_TO( 1.000, 0.000 ), - SYMBOL_LINE_TO( 0.000, -0.500 ), SYMBOL_LINE_TO( -1.000, 0.000 ), SYMBOL_LINE_TO( 0.000, -0.250 ), SYMBOL_CLOSE_PATH() }; -SYMBOL( arrowleftdblfull, 1.852, 0.0, 0.1, -0.13, 1.752, 0.87 ); - -static const cairo_path_data_t symbol_uparrowleft_path_data[] = { SYMBOL_MOVE_TO( 0.100, 0.500 ), SYMBOL_LINE_TO( 0.600, 0.200 ), - SYMBOL_LINE_TO( 0.000, -0.150 ), SYMBOL_LINE_TO( 0.500, 0.000 ), - SYMBOL_LINE_TO( 0.000, -0.550 ), SYMBOL_LINE_TO( -0.100, 0.000 ), - SYMBOL_LINE_TO( 0.000, 0.450 ), SYMBOL_LINE_TO( -0.400, 0.000 ), - SYMBOL_LINE_TO( 0.000, -0.150 ), SYMBOL_CLOSE_PATH() }; -SYMBOL( uparrowleft, 1.3, 0.0, 0.1, 0.0, 1.2, 0.7 ); - -static const cairo_path_data_t symbol_uparrowright_path_data[] = { SYMBOL_MOVE_TO( 1.200, 0.500 ), SYMBOL_LINE_TO( -0.600, 0.200 ), - SYMBOL_LINE_TO( 0.000, -0.150 ), SYMBOL_LINE_TO( -0.500, 0.000 ), - SYMBOL_LINE_TO( 0.000, -0.550 ), SYMBOL_LINE_TO( 0.100, 0.000 ), - SYMBOL_LINE_TO( 0.000, 0.450 ), SYMBOL_LINE_TO( 0.400, 0.000 ), - SYMBOL_LINE_TO( 0.000, -0.150 ), SYMBOL_CLOSE_PATH() }; -SYMBOL( uparrowright, 1.3, 0.0, 0.1, 0.0, 1.2, 0.7 ); - -static const cairo_path_data_t symbol_tick_path_data[] = { SYMBOL_MOVE_TO( 0.100, 0.400 ), SYMBOL_LINE_TO( 0.000, 0.450 ), - SYMBOL_LINE_TO( 0.150, 0.000 ), SYMBOL_LINE_TO( 0.000, -0.450 ), - SYMBOL_CLOSE_PATH() }; -SYMBOL( tick, 0.35, 0.0, 0.1, 0.4, 0.25, 0.85 ); - -static const cairo_path_data_t symbol_radical_path_data[] = { SYMBOL_MOVE_TO( 0.000, 0.500 ), SYMBOL_LINE_TO( 0.214, 0.100 ), - SYMBOL_LINE_TO( 0.213, -0.456 ), SYMBOL_LINE_TO( 0.229, 0.856 ), - SYMBOL_LINE_TO( 0.077, 0.000 ), SYMBOL_LINE_TO( 0.000, -0.100 ), - SYMBOL_LINE_TO( -0.281, -1.050 ), SYMBOL_LINE_TO( -0.287, 0.616 ), - SYMBOL_LINE_TO( -0.123, -0.057 ), SYMBOL_CLOSE_PATH() }; -SYMBOL( radical, 0.733, 0.0, 0.0, -0.15, 0.733, 1.0 ); - -static const cairo_path_data_t symbol_overscore_path_data[] = { SYMBOL_MOVE_TO( 0.000, 1.000 ), SYMBOL_LINE_TO( 0.900, 0.000 ), - SYMBOL_LINE_TO( 0.000, -0.100 ), SYMBOL_LINE_TO( -0.900, 0.000 ), - SYMBOL_CLOSE_PATH() }; -SYMBOL( overscore, 0.8, 0.0, 0.0, 0.9, 0.9, 1.0 ); - -static const cairo_path_data_t symbol_minus_path_data[] = { SYMBOL_MOVE_TO( 0.050, 0.312 ), SYMBOL_LINE_TO( 0.000, 0.118 ), - SYMBOL_LINE_TO( 0.500, 0.000 ), SYMBOL_LINE_TO( 0.000, -0.118 ), - SYMBOL_CLOSE_PATH() }; -SYMBOL( minus, 0.6, 0.0, 0.05, 0.312, 0.55, 0.430 ); - -static const cairo_path_data_t symbol_divide_path_data[] = { SYMBOL_MOVE_TO( 0.050, 0.312 ), - SYMBOL_LINE_TO( 0.000, 0.118 ), - SYMBOL_LINE_TO( 0.500, 0.000 ), - SYMBOL_LINE_TO( 0.000, -0.118 ), - SYMBOL_CLOSE_PATH(), - SYMBOL_MOVE_TO( 0.180, -0.108 ), - SYMBOL_LINE_TO( 0.135, 0.000 ), - SYMBOL_LINE_TO( 0.000, -0.135 ), - SYMBOL_LINE_TO( -0.135, 0.000 ), - SYMBOL_CLOSE_PATH(), - SYMBOL_MOVE_TO( 0.000, 0.334 ), - SYMBOL_LINE_TO( 0.000, 0.135 ), - SYMBOL_LINE_TO( 0.135, 0.000 ), - SYMBOL_LINE_TO( 0.000, -0.135 ), - SYMBOL_CLOSE_PATH() }; -SYMBOL( divide, 0.6, 0.0, 0.05, 0.069, 0.55, 0.673 ); - -static const cairo_path_data_t symbol_divisionslash_path_data[] = { SYMBOL_MOVE_TO( 0.050, 0.000 ), SYMBOL_LINE_TO( 0.345, 0.739 ), - SYMBOL_LINE_TO( 0.130, 0.000 ), SYMBOL_LINE_TO( -0.345, -0.739 ), - SYMBOL_CLOSE_PATH() }; -SYMBOL( divisionslash, 0.575, 0.000, 0.050, 0.000, 0.525, 0.739 ); - -static const cairo_path_data_t symbol_arrowup_path_data[] = { SYMBOL_MOVE_TO( 0.000, 0.000 ), SYMBOL_LINE_TO( 1.000, 0.000 ), - SYMBOL_LINE_TO( -0.500, 1.000 ), SYMBOL_CLOSE_PATH() }; -SYMBOL( arrowup, 1.0, 0.0, 0.1, 0.0, 0.9, 0.693 ); - -static const cairo_path_data_t symbol_arrowdown_path_data[] = { SYMBOL_MOVE_TO( 0.000, 1.000 ), SYMBOL_LINE_TO( 1.000, 0.000 ), - SYMBOL_LINE_TO( -0.500, -1.000 ), SYMBOL_CLOSE_PATH() }; -SYMBOL( arrowdown, 1.0, 0.0, 0.1, 0.0, 0.9, 0.693 ); - -static const cairo_path_data_t symbol_arrowleft_path_data[] = { SYMBOL_MOVE_TO( 1.000, 0.000 ), SYMBOL_LINE_TO( 0.000, 1.000 ), - SYMBOL_LINE_TO( -1.000, -0.500 ), SYMBOL_CLOSE_PATH() }; -SYMBOL( arrowleft, 1.0, 0.0, 0.1, 0.0, 0.9, 0.693 ); - -static const cairo_path_data_t symbol_arrowright_path_data[] = { SYMBOL_MOVE_TO( 0.000, 0.000 ), SYMBOL_LINE_TO( 0.000, 1.000 ), - SYMBOL_LINE_TO( 1.000, -0.500 ), SYMBOL_CLOSE_PATH() }; -SYMBOL( arrowright, 1.0, 0.0, 0.1, 0.0, 0.9, 0.693 ); - -CONTROL( beginsuperscript, 0.0, 0.5, 1.0, 0.8 ); -CONTROL( endsuperscript, 0.0, 0.5, 1.25, 1.0 ); - -CONTROL( kern_m1, -0.1, 0.0, 1.0, 1.0 ); -CONTROL( kern_m2, -0.2, 0.0, 1.0, 1.0 ); -CONTROL( kern_m3, -0.3, 0.0, 1.0, 1.0 ); -CONTROL( kern_m4, -0.4, 0.0, 1.0, 1.0 ); -CONTROL( kern_m5, -0.5, 0.0, 1.0, 1.0 ); -CONTROL( kern_m6, -0.6, 0.0, 1.0, 1.0 ); -CONTROL( kern_m7, -0.7, 0.0, 1.0, 1.0 ); -CONTROL( kern_m8, -0.8, 0.0, 1.0, 1.0 ); -CONTROL( kern_m9, -0.9, 0.0, 1.0, 1.0 ); - -typedef struct { - const char* name; - const x49gp_symbol_t* symbol; -} symbol_name_t; - -static const symbol_name_t symbol_names[] = { - {".notdef", &symbol_square }, - {"arrowleftdblfull", &symbol_arrowleftdblfull}, - {"divide", &symbol_divide }, - {"divisionslash", &symbol_divisionslash }, - {"minus", &symbol_minus }, - {"overscore", &symbol_overscore }, - {"radical", &symbol_radical }, - {"square", &symbol_square }, - {"tick", &symbol_tick }, - {"triangleright", &symbol_triangleright }, - {"triangleup", &symbol_triangleup }, - {"uparrowleft", &symbol_uparrowleft }, - {"uparrowright", &symbol_uparrowright }, - {"super", &symbol_beginsuperscript}, - {"/super", &symbol_endsuperscript }, - {"kern-1", &symbol_kern_m1 }, - {"kern-2", &symbol_kern_m2 }, - {"kern-3", &symbol_kern_m3 }, - {"kern-4", &symbol_kern_m4 }, - {"kern-5", &symbol_kern_m5 }, - {"kern-6", &symbol_kern_m6 }, - {"kern-7", &symbol_kern_m7 }, - {"kern-8", &symbol_kern_m8 }, - {"kern-9", &symbol_kern_m9 }, - {"arrowup", &symbol_arrowup }, - {"arrowdown", &symbol_arrowdown }, - {"arrowleft", &symbol_arrowleft }, - {"arrowright", &symbol_arrowright }, - - {NULL, NULL } -}; -#define NR_SYMBOLS ( sizeof( symbol_names ) / sizeof( symbol_names[ 0 ] ) - 1 ) - -int symbol_lookup_glyph_by_name( const char* name, int namelen, gunichar* glyph ) -{ - const symbol_name_t* symname; - int i = 0; - - /* - * Code symbols as Unicode Private Use from U+E000 on... - */ - - symname = symbol_names; - while ( symname->name ) { - if ( ( strlen( symname->name ) == namelen ) && !strncmp( symname->name, name, namelen ) ) { - if ( glyph ) { - *glyph = 0xe000 + i; - } - return 1; - } - - symname++; - i++; - } - - return 0; -} - -const x49gp_symbol_t* symbol_get_by_glyph( gunichar glyph ) -{ - int index = glyph - 0xe000; - - if ( ( index >= 0 ) && ( index < NR_SYMBOLS ) ) { - return symbol_names[ index ].symbol; - } - - return NULL; -} - -const x49gp_symbol_t* symbol_get_by_name( const char* name ) -{ - gunichar glyph; - - if ( symbol_lookup_glyph_by_name( name, strlen( name ), &glyph ) ) { - return symbol_get_by_glyph( glyph ); - } - - return NULL; -} diff --git a/src/x49gpng/ui_symbol.h b/src/x49gpng/ui_symbol.h deleted file mode 100644 index 17546eb..0000000 --- a/src/x49gpng/ui_symbol.h +++ /dev/null @@ -1,76 +0,0 @@ -#ifndef _X49GP_SYMBOL_H -#define _X49GP_SYMBOL_H 1 - -#include - -typedef struct { - const cairo_path_data_t* data; - int num_data; -} symbol_path_t; - -typedef struct { - double x_advance; - double y_advance; - double llx; - double lly; - double urx; - double ury; - double prescale; - double postscale; - const symbol_path_t* path; -} x49gp_symbol_t; - -#define SYMBOL_MOVE_TO( x, y ) \ - { \ - header : { CAIRO_PATH_MOVE_TO, 2 } \ -}, \ - { \ -point: \ - { \ - x, y \ - } \ - } - -#define SYMBOL_LINE_TO( x, y ) \ - { \ - header : { CAIRO_PATH_LINE_TO, 2 } \ - }, \ - { \ -point: \ - { \ - x, y \ - } \ - } - -#define SYMBOL_CURVE_TO( x1, y1, x2, y2, x3, y3 ) \ - { \ - header : { CAIRO_PATH_CURVE_TO, 4 } \ - }, \ - { point : { x1, y1 } }, { point : { x2, y2 } }, \ - { \ -point: \ - { \ - x3, y3 \ - } \ - } - -#define SYMBOL_CLOSE_PATH() \ - { \ - header : { CAIRO_PATH_CLOSE_PATH, 1 } \ - } - -#define SYMBOL( name, x_advance, y_advance, llx, lly, urx, ury ) \ - static const symbol_path_t symbol_##name##_path = { symbol_##name##_path_data, \ - sizeof( symbol_##name##_path_data ) / sizeof( cairo_path_data_t ) }; \ - \ - static const x49gp_symbol_t symbol_##name = { x_advance, y_advance, llx, lly, urx, ury, 1.0, 1.0, &symbol_##name##_path } - -#define CONTROL( name, x_advance, y_advance, prescale, postscale ) \ - static const x49gp_symbol_t symbol_##name = { x_advance, y_advance, 0.0, 0.0, 0.0, 0.0, prescale, postscale, NULL } - -int symbol_lookup_glyph_by_name( const char* name, int namelen, gunichar* ); - -const x49gp_symbol_t* symbol_get_by_name( const char* name ); -const x49gp_symbol_t* symbol_get_by_glyph( gunichar glyph ); - -#endif /* !(_X49GP_SYMBOL_H) */