/* build: gcc mplus_stroke_svg_test.c mplus_stroke_svg.c -o mplus_stroke_svg_test */

#include <stdio.h>

#include "mplus_stroke_svg.h"

static MPLUS_GlyphsData_t g_tGlyphsData;

int main(int i_iArgc, char* astrArgc[]) {
	int i, j;

	LoadMPLUSStroke(&g_tGlyphsData);

	printf("Glyphs count : %d\n", g_tGlyphsData.glyphscount);
	printf("\n");

	for(i = 0; i < g_tGlyphsData.glyphscount; i++) {
		printf("=========================\n");
		printf("UTF-16 : %X\n", g_tGlyphsData.glyphs[i].code);
		printf("UTF-8  : %X\n", g_tGlyphsData.glyphs[i].code8);
		printf("Items count : %d\n", g_tGlyphsData.glyphs[i].itemscount);

		printf("--------------------\n");
		for(j = 0; j < g_tGlyphsData.glyphs[i].itemscount; j++) {
			switch(g_tGlyphsData.glyphs[i].items[j].top.ItemType) {
			case MPLUS_ITEMTYPE_LINE:
				printf("line  : %f %f %f %f\n",
					g_tGlyphsData.glyphs[i].items[j].line.pos1.x,
					g_tGlyphsData.glyphs[i].items[j].line.pos1.y,
					g_tGlyphsData.glyphs[i].items[j].line.pos2.x,
					g_tGlyphsData.glyphs[i].items[j].line.pos2.y
				);
				break;
			case MPLUS_ITEMTYPE_CUBIC:
				printf("cubic : %f %f %f %f %f %f %f %f\n",
					g_tGlyphsData.glyphs[i].items[j].cubic.pos1.x,
					g_tGlyphsData.glyphs[i].items[j].cubic.pos1.y,
					g_tGlyphsData.glyphs[i].items[j].cubic.pos2.x,
					g_tGlyphsData.glyphs[i].items[j].cubic.pos2.y,
					g_tGlyphsData.glyphs[i].items[j].cubic.pos3.x,
					g_tGlyphsData.glyphs[i].items[j].cubic.pos3.y,
					g_tGlyphsData.glyphs[i].items[j].cubic.pos4.x,
					g_tGlyphsData.glyphs[i].items[j].cubic.pos4.y
				);
				break;
			}
		}
		printf("--------------------\n");
		printf("\n");
	}
}
