[util] Don’t split text at new lines in batch mode

In batch mode (which is used for testing) we are probably not interested
in splitting text into lines as we could have split the string into
different tests. This fixes a bunch of AOTS tests that use newlines as
input.
This commit is contained in:
Khaled Hosny 2021-07-28 16:13:49 +02:00 committed by Behdad Esfahbod
parent 92b85749f2
commit 50379fbb15
5 changed files with 12 additions and 12 deletions

View File

@ -1,5 +1,5 @@
#../fonts/lookupflag_ignore_attach_f1.otf:--features="test" --no-clusters --no-glyph-names --no-positions:U+000A,U+000B,U+000D,U+001A,U+000A:[10|15|10]
#../fonts/lookupflag_ignore_attach_f1.otf:--features="test" --no-clusters --no-glyph-names --no-positions:U+000A,U+000B,U+0015,U+000D,U+0016,U+0017,U+001D,U+001A,U+000A:[10|15|21|22|23|29|10]
#../fonts/lookupflag_ignore_attach_f1.otf:--features="test" --no-clusters --no-glyph-names --no-positions:U+000A,U+000B,U+0015,U+000D,U+0016,U+001B,U+001A,U+000A:[10|11|21|13|22|27|26|10]
#../fonts/lookupflag_ignore_attach_f1.otf:--features="test" --no-clusters --no-glyph-names --no-positions:U+000A,U+000B,U+001B,U+000D,U+0016,U+0017,U+001A,U+000A:[10|11|27|13|22|23|26|10]
#../fonts/lookupflag_ignore_attach_f1.otf:--features="test" --no-clusters --no-glyph-names --no-positions:U+000A,U+000B,U+001B,U+000D,U+000E,U+0017,U+001A,U+000A:[10|11|27|13|14|23|26|10]
../fonts/lookupflag_ignore_attach_f1.otf:--features="test" --no-clusters --no-glyph-names --no-positions:U+000A,U+000B,U+000D,U+001A,U+000A:[10|15|10]
../fonts/lookupflag_ignore_attach_f1.otf:--features="test" --no-clusters --no-glyph-names --no-positions:U+000A,U+000B,U+0015,U+000D,U+0016,U+0017,U+001D,U+001A,U+000A:[10|15|21|22|23|29|10]
../fonts/lookupflag_ignore_attach_f1.otf:--features="test" --no-clusters --no-glyph-names --no-positions:U+000A,U+000B,U+0015,U+000D,U+0016,U+001B,U+001A,U+000A:[10|11|21|13|22|27|26|10]
../fonts/lookupflag_ignore_attach_f1.otf:--features="test" --no-clusters --no-glyph-names --no-positions:U+000A,U+000B,U+001B,U+000D,U+0016,U+0017,U+001A,U+000A:[10|11|27|13|22|23|26|10]
../fonts/lookupflag_ignore_attach_f1.otf:--features="test" --no-clusters --no-glyph-names --no-positions:U+000A,U+000B,U+001B,U+000D,U+000E,U+0017,U+001A,U+000A:[10|11|27|13|14|23|26|10]

View File

@ -165,7 +165,7 @@ main (int argc, char **argv)
{
size_t l = strlen (buf);
if (l && buf[l - 1] == '\n') buf[l - 1] = '\0';
main_font_text_t<shape_consumer_t<output_buffer_t>, FONT_SIZE_UPEM, 0> driver;
main_font_text_t<shape_consumer_t<output_buffer_t>, FONT_SIZE_UPEM, 0, EOF> driver;
char *args[32];
argc = 0;
char *p = buf, *e;

View File

@ -47,7 +47,7 @@ locale_to_utf8 (char *s)
return t;
}
template <typename consumer_t, int default_font_size, int subpixel_bits>
template <typename consumer_t, int default_font_size, int subpixel_bits, char eol = '\n'>
struct main_font_text_t
{
main_font_text_t ()
@ -77,7 +77,7 @@ struct main_font_text_t
unsigned int text_len;
const char *text;
while ((text = input.get_line (&text_len)))
while ((text = input.get_line (&text_len, eol)))
consumer.consume_line (text, text_len, input.text_before, input.text_after);
consumer.finish (&font_opts);

View File

@ -771,7 +771,7 @@ font_options_t::get_font () const
const char *
text_options_t::get_line (unsigned int *len)
text_options_t::get_line (unsigned int *len, char eol)
{
if (text) {
if (!line)
@ -788,7 +788,7 @@ text_options_t::get_line (unsigned int *len)
}
const char *ret = line;
const char *p = (const char *) memchr (line, '\n', line_len);
const char *p = (const char *) memchr (line, eol, line_len);
unsigned int ret_len;
if (!p) {
ret_len = line_len;
@ -824,7 +824,7 @@ text_options_t::get_line (unsigned int *len)
char buf[BUFSIZ];
while (fgets (buf, sizeof (buf), fp)) {
unsigned int bytes = strlen (buf);
if (bytes && buf[bytes - 1] == '\n') {
if (bytes && buf[bytes - 1] == eol) {
bytes--;
g_string_append_len (gs, buf, bytes);
break;

View File

@ -548,7 +548,7 @@ struct text_options_t : option_group_t
"Only one of text and text-file can be set");
}
const char *get_line (unsigned int *len);
const char *get_line (unsigned int *len, char eol);
char *text_before;
char *text_after;