mirror of
https://git.code.sf.net/p/zint/code
synced 2026-08-08 14:28:52 +00:00
font_wip branch: new WIP font stuff using "stb_truetype.h",
not implemented for EAN/UPC, not fully tested
This commit is contained in:
+41
-15
@@ -3224,6 +3224,7 @@ INTERNAL int zint_test_gs1_hrt_conv_parsed(struct zint_symbol *symbol, const uns
|
||||
static void test_gs1_hrt_conv_parsed(const testCtx *const p_ctx) {
|
||||
|
||||
struct item {
|
||||
int show_hrt;
|
||||
const char *data;
|
||||
int ai_count;
|
||||
int ai_vals[4];
|
||||
@@ -3235,11 +3236,15 @@ static void test_gs1_hrt_conv_parsed(const testCtx *const p_ctx) {
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { "^0112345678901231", 1, { 1, 0, 0, 0 }, { 1, 0, 0, 0 }, { 3, 0, 0, 0 }, { 14, 0, 0, 0 }, 0, "(01)12345678901231" },
|
||||
/* 1*/ { "^011234567890123190ABCD^21123456AB", 3, { 1, 90, 21, 0 }, { 1, 17, 24, 0 }, { 3, 19, 26, 0 }, { 14, 4, 8, 0 }, 0, "(01)12345678901231(90)ABCD(21)123456AB" },
|
||||
/* 2*/ { "^91123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890^92123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890^93123456789012345678901234567890123456789012345678901234567890123", 3, { 91, 92, 93, 0 }, { 1, 94, 187, 0 }, { 3, 96, 189, 0 }, { 90, 90, 63, 0 }, 0, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 3*/ { "^91123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890^92123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890^931234567890123456789012345678901234567890123456789012345678901234", 3, { 91, 92, 93, 0 }, { 1, 94, 187, 0 }, { 3, 96, 189, 0 }, { 90, 90, 64, 0 }, ZINT_WARN_HRT_TRUNCATED, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" },
|
||||
/* 4*/ { "^91123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890^92123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890^93123456789012345678901234567890123456789012345678901234567890123^94123", 4, { 91, 92, 93, 94 }, { 1, 94, 187, 256 }, { 3, 96, 189, 258 }, { 90, 90, 63, 3 }, ZINT_WARN_HRT_TRUNCATED, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 0*/ { -1, "^0112345678901231", 1, { 1, 0, 0, 0 }, { 1, 0, 0, 0 }, { 3, 0, 0, 0 }, { 14, 0, 0, 0 }, 0, "(01)12345678901231" },
|
||||
/* 1*/ { ZINT_HRT_GS1_NEWLINE, "^0112345678901231", 1, { 1, 0, 0, 0 }, { 1, 0, 0, 0 }, { 3, 0, 0, 0 }, { 14, 0, 0, 0 }, 0, "(01)12345678901231" },
|
||||
/* 2*/ { -1, "^011234567890123190ABCD^21123456AB", 3, { 1, 90, 21, 0 }, { 1, 17, 24, 0 }, { 3, 19, 26, 0 }, { 14, 4, 8, 0 }, 0, "(01)12345678901231(90)ABCD(21)123456AB" },
|
||||
/* 3*/ { ZINT_HRT_GS1_NEWLINE, "^011234567890123190ABCD^21123456AB", 3, { 1, 90, 21, 0 }, { 1, 17, 24, 0 }, { 3, 19, 26, 0 }, { 14, 4, 8, 0 }, 0, "(01)12345678901231\n(90)ABCD\n(21)123456AB" },
|
||||
/* 4*/ { -1, "^91123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890^92123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890^93123456789012345678901234567890123456789012345678901234567890123", 3, { 91, 92, 93, 0 }, { 1, 94, 187, 0 }, { 3, 96, 189, 0 }, { 90, 90, 63, 0 }, 0, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 5*/ { -1, "^91123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890^92123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890^931234567890123456789012345678901234567890123456789012345678901234", 3, { 91, 92, 93, 0 }, { 1, 94, 187, 0 }, { 3, 96, 189, 0 }, { 90, 90, 64, 0 }, ZINT_WARN_HRT_TRUNCATED, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" },
|
||||
/* 6*/ { -1, "^91123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890^92123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890^93123456789012345678901234567890123456789012345678901234567890123^94123", 4, { 91, 92, 93, 94 }, { 1, 94, 187, 256 }, { 3, 96, 189, 258 }, { 90, 90, 63, 3 }, ZINT_WARN_HRT_TRUNCATED, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 7*/ { ZINT_HRT_GS1_NEWLINE, "^91123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890^92123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890^931234567890123456789012345678901234567890123456789012345678901", 3, { 91, 92, 93, 0 }, { 1, 94, 187, 0 }, { 3, 96, 189, 0 }, { 90, 90, 61, 0 }, 0, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\n(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\n(93)1234567890123456789012345678901234567890123456789012345678901" },
|
||||
/* 7*/ { ZINT_HRT_GS1_NEWLINE, "^91123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890^92123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890^9312345678901234567890123456789012345678901234567890123456789012", 3, { 91, 92, 93, 0 }, { 1, 94, 187, 0 }, { 3, 96, 189, 0 }, { 90, 90, 62, 0 }, ZINT_WARN_HRT_TRUNCATED, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\n(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
@@ -3253,6 +3258,9 @@ static void test_gs1_hrt_conv_parsed(const testCtx *const p_ctx) {
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
if (data[i].show_hrt != -1) {
|
||||
symbol->show_hrt = data[i].show_hrt;
|
||||
}
|
||||
|
||||
length = (int) strlen(data[i].data);
|
||||
ret = zint_test_gs1_hrt_conv_parsed(symbol, ZCUCP(data[i].data), length, data[i].ai_count, data[i].ai_vals,
|
||||
@@ -3277,17 +3285,23 @@ INTERNAL int zint_test_gs1_hrt_cpy(struct zint_symbol *symbol, const unsigned ch
|
||||
static void test_gs1_hrt_cpy(const testCtx *const p_ctx) {
|
||||
|
||||
struct item {
|
||||
int show_hrt;
|
||||
const char *data;
|
||||
int ret;
|
||||
const char *expected;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { "(01)12345678901231", 0, "(01)12345678901231" },
|
||||
/* 1*/ { "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)123456789012345678901234567890123456789012345678901234567890123", 0, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 2*/ { "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)123456789012345678901234567890123456789012345678901234567890123", 0, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 3*/ { "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)1234567890123456789012345678901234567890123456789012345678901234", ZINT_WARN_HRT_TRUNCATED, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" },
|
||||
/* 4*/ { "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)123456789012345678901234567890123456789012345678901234567890123(94)123456789", ZINT_WARN_HRT_TRUNCATED, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 0*/ { -1, "(01)12345678901231", 0, "(01)12345678901231" },
|
||||
/* 1*/ { ZINT_HRT_GS1_NEWLINE, "(01)12345678901231", 0, "(01)12345678901231" },
|
||||
/* 2*/ { -1, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)123456789012345678901234567890123456789012345678901234567890123", 0, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 3*/ { -1, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)1234567890123456789012345678901234567890123456789012345678901234", ZINT_WARN_HRT_TRUNCATED, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" },
|
||||
/* 4*/ { -1, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)123456789012345678901234567890123456789012345678901234567890123(94)123456789", ZINT_WARN_HRT_TRUNCATED, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 5*/ { ZINT_HRT_GS1_NEWLINE, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)1234567890123456789012345678901234567890123456789012345678901", 0, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\n(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\n(93)1234567890123456789012345678901234567890123456789012345678901" },
|
||||
/* 6*/ { ZINT_HRT_GS1_NEWLINE, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)12345678901234567890123456789012345678901234567890123456789012", ZINT_WARN_HRT_TRUNCATED, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\n(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" },
|
||||
/* 7*/ { ZINT_HRT_GS1_NEWLINE, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)123456789012345678901234567890123456789012345678901234567890(94)123456789", ZINT_WARN_HRT_TRUNCATED, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\n(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\n(93)123456789012345678901234567890123456789012345678901234567890" },
|
||||
/* 8*/ { ZINT_HRT_GS1_NEWLINE, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)1234567890123456789012345678901234567890123456789012345678901(94)123456789", ZINT_WARN_HRT_TRUNCATED, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\n(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\n(93)1234567890123456789012345678901234567890123456789012345678901" },
|
||||
/* 9*/ { ZINT_HRT_GS1_NEWLINE, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)1234567890123456789012345678901234567890123456789012345678901\\(", ZINT_WARN_HRT_TRUNCATED, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\n(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
@@ -3302,6 +3316,9 @@ static void test_gs1_hrt_cpy(const testCtx *const p_ctx) {
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
symbol->input_mode |= GS1PARENS_MODE;
|
||||
if (data[i].show_hrt != -1) {
|
||||
symbol->show_hrt = data[i].show_hrt;
|
||||
}
|
||||
|
||||
length = (int) strlen(data[i].data);
|
||||
ret = zint_test_gs1_hrt_cpy(symbol, ZCUCP(data[i].data), length, 0 /*no_errtxt*/);
|
||||
@@ -3325,17 +3342,23 @@ INTERNAL int zint_test_gs1_hrt_conv_brackets(struct zint_symbol *symbol, const u
|
||||
static void test_gs1_hrt_conv_brackets(const testCtx *const p_ctx) {
|
||||
|
||||
struct item {
|
||||
int show_hrt;
|
||||
const char *data;
|
||||
int ret;
|
||||
const char *expected;
|
||||
};
|
||||
/* s/\/\*[ 0-9]*\*\//\=printf("\/\*%3d*\/", line(".") - line("'<")): */
|
||||
static const struct item data[] = {
|
||||
/* 0*/ { "[01]12345678901231", 0, "(01)12345678901231" },
|
||||
/* 1*/ { "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123", 0, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 2*/ { "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123", 0, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 3*/ { "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]1234567890123456789012345678901234567890123456789012345678901234", ZINT_WARN_HRT_TRUNCATED, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" },
|
||||
/* 4*/ { "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123[94]123456789", ZINT_WARN_HRT_TRUNCATED, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 0*/ { -1, "[01]12345678901231", 0, "(01)12345678901231" },
|
||||
/* 1*/ { ZINT_HRT_GS1_NEWLINE, "[01]12345678901231", 0, "(01)12345678901231" },
|
||||
/* 2*/ { -1, "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123", 0, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 3*/ { -1, "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123", 0, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 4*/ { -1, "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]1234567890123456789012345678901234567890123456789012345678901234", ZINT_WARN_HRT_TRUNCATED, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" },
|
||||
/* 5*/ { -1, "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]123456789012345678901234567890123456789012345678901234567890123[94]123456789", ZINT_WARN_HRT_TRUNCATED, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890(93)123456789012345678901234567890123456789012345678901234567890123" },
|
||||
/* 6*/ { ZINT_HRT_GS1_NEWLINE, "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]1234567890123456789012345678901234567890123456789012345678901", 0, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\n(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\n(93)1234567890123456789012345678901234567890123456789012345678901" },
|
||||
/* 7*/ { ZINT_HRT_GS1_NEWLINE, "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]12345678901234567890123456789012345678901234567890123456789012", ZINT_WARN_HRT_TRUNCATED, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\n(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890" },
|
||||
/* 8*/ { ZINT_HRT_GS1_NEWLINE, "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]1234567890123456789012345678901234567890123456789012345[94]1", 0, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\n(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\n(93)1234567890123456789012345678901234567890123456789012345\n(94)1" },
|
||||
/* 9*/ { ZINT_HRT_GS1_NEWLINE, "[91]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[92]123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890[93]12345678901234567890123456789012345678901234567890123456[94]1", ZINT_WARN_HRT_TRUNCATED, "(91)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\n(92)123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\n(93)12345678901234567890123456789012345678901234567890123456" },
|
||||
};
|
||||
const int data_size = ARRAY_SIZE(data);
|
||||
int i, length, ret;
|
||||
@@ -3349,6 +3372,9 @@ static void test_gs1_hrt_conv_brackets(const testCtx *const p_ctx) {
|
||||
|
||||
symbol = ZBarcode_Create();
|
||||
assert_nonnull(symbol, "Symbol not created\n");
|
||||
if (data[i].show_hrt != -1) {
|
||||
symbol->show_hrt = data[i].show_hrt;
|
||||
}
|
||||
|
||||
length = (int) strlen(data[i].data);
|
||||
ret = zint_test_gs1_hrt_conv_brackets(symbol, ZCUCP(data[i].data), length, 0 /*no_errtxt*/);
|
||||
|
||||
Reference in New Issue
Block a user