X-Git-Url: https://git.octo.it/?p=rrdtool.git;a=blobdiff_plain;f=libraries%2Fafm%2Ftest-afm.c;fp=libraries%2Fafm%2Ftest-afm.c;h=0000000000000000000000000000000000000000;hp=16cfc8b5c8c6ba345ffef4653a531e24c92997c3;hb=682a3ef448113e91d36676e608b66e95eff570b8;hpb=7383625ce0413ce5dbcc0ced4ee4873c6df37735 diff --git a/libraries/afm/test-afm.c b/libraries/afm/test-afm.c deleted file mode 100644 index 16cfc8b..0000000 --- a/libraries/afm/test-afm.c +++ /dev/null @@ -1,123 +0,0 @@ -#include "rrd_afm.h" -#include - -FILE *fp; - -static void make_tests( - void); -static void print( - const char *s); -double y = 0; - -//static const char *font = "Times-Roman"; -static const char *font = "Times Bold Italic"; - -//static const char *font = "Courier"; -//static const char *font = "Courier Bold Oblique"; - -void make_tests( - ) -{ -#ifdef __APPLE__ -#define charset_legend "Macintosh charset" -#define AE "\xAE" -#define ae "\xBE" -#define oe "\xBF" -#define aa "\x8C" -#define NBSP "\x00CA" -#else -#define charset_legend "IsoLatin1 charset" -#define AE "\xC6" -#define ae "\xE6" -#define oe "\xF8" -#define aa "\xA5" -#define NBSP "\x00A0" -#endif - print(AE); /* very wide char */ - print(AE AE AE AE AE AE AE AE AE AE AE AE AE AE AE); - print(charset_legend); - print("S,"); - print("sfil"); - print("Hello, world"); - print("AVAVAVAVAVAVAVAVAVAVAVAVAVAVAVAVAVAV"); - print("AAAAAAAAAAAAAAAAAAVVVVVVVVVVVVVVVVVV"); - print("fiffififfififfififfififfififfififfi"); - print("fi"); - print("fil"); - print("fifififififififififififififififififififififififififi"); - print(AE "bleskiver med gl" oe "gg. " NBSP NBSP NBSP NBSP NBSP NBSP NBSP - AE " Fywerhus: 'A " ae " u " aa " " ae " " oe " i " ae " fywer'."); - print("Ingef" ae "rp" ae "rer med karamelsauce. R" oe "dgr" oe "d med fl" - oe "de."); - print - ("(Optional.) Ligature sequence where successor and ligature are both names. The current character may join ..."); -} - -static void vline( - double x, - double y1, - double y2) -{ - fprintf(fp, "\n", x, y1, x, y2); -} - -static void print( - const char *s) -{ - double size = 12; - double x = 10; - double width = afm_get_text_width(0, font, size, 4, s); - unsigned char *up = (unsigned char *) s; - - fprintf(stderr, "Width = %f for '%s'\n", width, s); - y += 10; - vline(x, y, y + 5); - fprintf(fp, "", x, y, - size); - while (*up) { - unsigned char ch = afm_host2unicode(*up); - - if (ch < 127) - putc(ch, fp); - else - fprintf(fp, "&#%d;", ch); - up++; - } - fputs("\n", fp); - vline(x + width, y, y + 5); - y += 1.1 * size; -} - -static void header( - ) -{ - fprintf(fp, - "\n" - "\n" - "\n", font); -} - - -static void footer( - ) -{ - fputs("\n", fp); -} - -int main( - ) -{ - fp = fopen("test.svg", "w"); - if (fp == NULL) { - fprintf(stderr, "Can't create output.\n"); - exit(1); - } - header(); - make_tests(); - footer(); - fclose(fp); - return 0; -}