diff options
Diffstat (limited to 'Build/source/texk')
-rw-r--r-- | Build/source/texk/dvipdfm-x/ChangeLog | 7 | ||||
-rwxr-xr-x | Build/source/texk/dvipdfm-x/configure | 22 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/configure.ac | 2 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/dvi.c | 133 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/dvipdfmx.c | 37 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/pdfdoc.c | 22 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/pdfdoc.h | 6 |
7 files changed, 193 insertions, 36 deletions
diff --git a/Build/source/texk/dvipdfm-x/ChangeLog b/Build/source/texk/dvipdfm-x/ChangeLog index 7ef6d0350bb..b77a732105c 100644 --- a/Build/source/texk/dvipdfm-x/ChangeLog +++ b/Build/source/texk/dvipdfm-x/ChangeLog @@ -1,3 +1,10 @@ +2021-01-15 Shunsaku Hirata <shunsaku.hirata74@gmail.com> + + * dvi.c, dvipdfmx.c, pdfdoc.[ch]: Experimental support for + dviluatex extended fnt_def. Separate annot_grow (linkmargin) + for horizontal and vertical direction can be specified. + * configure.ac: Version 20210115. + 2021-01-10 Shunsaku Hirata <shunsaku.hirata74@gmail.com> * cmap_read.c, t1_load.c: Fix a bug causing a segfault diff --git a/Build/source/texk/dvipdfm-x/configure b/Build/source/texk/dvipdfm-x/configure index 639649dd243..f726a34e5e1 100755 --- a/Build/source/texk/dvipdfm-x/configure +++ b/Build/source/texk/dvipdfm-x/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for dvipdfm-x (TeX Live) 20210109. +# Generated by GNU Autoconf 2.69 for dvipdfm-x (TeX Live) 20210115. # # Report bugs to <dvipdfmx@tug.org>. # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='dvipdfm-x (TeX Live)' PACKAGE_TARNAME='dvipdfm-x--tex-live-' -PACKAGE_VERSION='20210109' -PACKAGE_STRING='dvipdfm-x (TeX Live) 20210109' +PACKAGE_VERSION='20210115' +PACKAGE_STRING='dvipdfm-x (TeX Live) 20210115' PACKAGE_BUGREPORT='dvipdfmx@tug.org' PACKAGE_URL='' @@ -1350,7 +1350,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures dvipdfm-x (TeX Live) 20210109 to adapt to many kinds of systems. +\`configure' configures dvipdfm-x (TeX Live) 20210115 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1421,7 +1421,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of dvipdfm-x (TeX Live) 20210109:";; + short | recursive ) echo "Configuration of dvipdfm-x (TeX Live) 20210115:";; esac cat <<\_ACEOF @@ -1551,7 +1551,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -dvipdfm-x (TeX Live) configure 20210109 +dvipdfm-x (TeX Live) configure 20210115 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2390,7 +2390,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by dvipdfm-x (TeX Live) $as_me 20210109, which was +It was created by dvipdfm-x (TeX Live) $as_me 20210115, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -8072,7 +8072,7 @@ fi # Define the identity of the package. PACKAGE='dvipdfm-x--tex-live-' - VERSION='20210109' + VERSION='20210115' cat >>confdefs.h <<_ACEOF @@ -14741,7 +14741,7 @@ Usage: $0 [OPTIONS] Report bugs to <bug-libtool@gnu.org>." lt_cl_version="\ -dvipdfm-x (TeX Live) config.lt 20210109 +dvipdfm-x (TeX Live) config.lt 20210115 configured by $0, generated by GNU Autoconf 2.69. Copyright (C) 2011 Free Software Foundation, Inc. @@ -16631,7 +16631,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by dvipdfm-x (TeX Live) $as_me 20210109, which was +This file was extended by dvipdfm-x (TeX Live) $as_me 20210115, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -16701,7 +16701,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -dvipdfm-x (TeX Live) config.status 20210109 +dvipdfm-x (TeX Live) config.status 20210115 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/Build/source/texk/dvipdfm-x/configure.ac b/Build/source/texk/dvipdfm-x/configure.ac index 12654bacd24..f4b7b607e56 100644 --- a/Build/source/texk/dvipdfm-x/configure.ac +++ b/Build/source/texk/dvipdfm-x/configure.ac @@ -8,7 +8,7 @@ dnl This file is free software; the copyright holder dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. dnl -AC_INIT([dvipdfm-x (TeX Live)], [20210109], [dvipdfmx@tug.org]) +AC_INIT([dvipdfm-x (TeX Live)], [20210115], [dvipdfmx@tug.org]) AC_PREREQ([2.65]) AC_CONFIG_SRCDIR([agl.c]) AC_CONFIG_AUX_DIR([../../build-aux]) diff --git a/Build/source/texk/dvipdfm-x/dvi.c b/Build/source/texk/dvipdfm-x/dvi.c index 2bd395757d4..61efadffce1 100644 --- a/Build/source/texk/dvipdfm-x/dvi.c +++ b/Build/source/texk/dvipdfm-x/dvi.c @@ -1,6 +1,6 @@ /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. - Copyright (C) 2002-2020 by Jin-Hwan Cho and Shunsaku Hirata, + Copyright (C) 2002-2021 by Jin-Hwan Cho and Shunsaku Hirata, the dvipdfmx project team. Copyright (C) 2012-2015 by Khaled Hosny <khaledhosny@eglug.org> @@ -30,6 +30,7 @@ #include <stdio.h> #include <stdlib.h> #include <ctype.h> +#include <string.h> #ifdef WIN32 #include <fcntl.h> @@ -546,9 +547,105 @@ dvi_comment (void) } static void +proc_dvilua_font_record (int32_t tex_id, const char *font_name, uint32_t point_size, uint32_t design_size) +{ + char *file_name, *p, *q, *endptr; + uint32_t index = 0; + uint32_t embolden = 0; + int32_t slant = 0, extend = 0x00010000; + + ASSERT(font_name[0] == '['); + + /* redundant check but leave this here anyway */ + if (num_def_fonts >= max_def_fonts) { + max_def_fonts += TEX_FONTS_ALLOC_SIZE; + def_fonts = RENEW (def_fonts, max_def_fonts, struct font_def); + } + + file_name = NEW(strlen(font_name) + 1, char); + strcpy(file_name, font_name + 1); + endptr = file_name + strlen(file_name); + q = strchr(file_name, ']'); + if (q == NULL) { + ERROR("Syntax error in dvilua fnt_def: no ']' found in font name."); + } + *q = '\0'; + + p = q + 1; + if (p < endptr && *p == ':') { + for (p++; *p != '\0' && p < endptr; ) { + char *kvsep, *delim; + + delim = strchr(p, ';'); + kvsep = strchr(p, '='); + if (delim == NULL) + delim = endptr; + if (kvsep == NULL || kvsep >= delim) { + ERROR("Syntax error in dvilua fnt_def: not in key=value format: %s", font_name); + } + *kvsep = '\0'; + if (!strcmp(p, "index")) { + uint32_t value = strtoul(kvsep + 1, &q, 10); + if (q != delim) { + WARN("Syntax error in dvilua fnt_def: invalid value specified for \"%s\": %s", p, font_name); + } else { + index = value; + } + } else if (!strcmp(p, "embolden")) { + int32_t value = strtol(kvsep + 1, &q, 10); + if (q != delim) { + WARN("Syntax error in dvilua fnt_def: invalid value specified for \"%s\": %s", p, font_name); + } else { + embolden = value; + } + } else if (!strcmp(p, "slant")) { + int32_t value = strtol(kvsep + 1, &q, 10); + if (q != delim) { + WARN("Syntax error in dvilua fnt_def: invalid value specified for \"%s\": %s", p, font_name); + } else { + slant = value; + } + } else if (!strcmp(p, "extend")) { + int32_t value = strtol(kvsep + 1, &q, 10); + if (q != delim) { + WARN("Syntax error in dvilua fnt_def: invalid value specified for \"%s\": %s", p, font_name); + } else { + extend = value; + } + } else { + WARN("Ignoring unrecognized/unsupported key \"%s\" in dvilua fnt_def: %s", p, font_name); + } + p = delim + 1; + } + } + + def_fonts[num_def_fonts].tex_id = tex_id; + def_fonts[num_def_fonts].font_name = file_name; + def_fonts[num_def_fonts].face_index = index; + def_fonts[num_def_fonts].point_size = point_size; + def_fonts[num_def_fonts].design_size = design_size; + def_fonts[num_def_fonts].used = 0; + def_fonts[num_def_fonts].native = 1; + + def_fonts[num_def_fonts].layout_dir = 0; + def_fonts[num_def_fonts].rgba_color = 0xffffffff; + def_fonts[num_def_fonts].rgba_used = 0; + def_fonts[num_def_fonts].extend = extend; + def_fonts[num_def_fonts].slant = slant; + def_fonts[num_def_fonts].embolden = embolden; + + num_def_fonts++; + + return; +} + +#define SIG_DVILUA_FNT_DEF ('L' << 24|'u' << 16|'a' << 8|'F') + +static void read_font_record (int32_t tex_id) { int dir_length, name_length; + uint32_t checksum; uint32_t point_size, design_size; char *directory, *font_name; @@ -556,7 +653,7 @@ read_font_record (int32_t tex_id) max_def_fonts += TEX_FONTS_ALLOC_SIZE; def_fonts = RENEW (def_fonts, max_def_fonts, struct font_def); } - get_unsigned_quad(dvi_file); + checksum = get_unsigned_quad(dvi_file); point_size = get_positive_quad(dvi_file, "DVI", "point_size"); design_size = get_positive_quad(dvi_file, "DVI", "design_size"); dir_length = get_unsigned_byte(dvi_file); @@ -574,6 +671,12 @@ read_font_record (int32_t tex_id) ERROR(invalid_signature); } font_name[name_length] = '\0'; + + if (checksum == SIG_DVILUA_FNT_DEF && name_length > 0 && font_name[0] == '[') { + proc_dvilua_font_record(tex_id, font_name, point_size, design_size); + RELEASE(font_name); + return; + } def_fonts[num_def_fonts].tex_id = tex_id; def_fonts[num_def_fonts].font_name = font_name; def_fonts[num_def_fonts].point_size = point_size; @@ -1338,8 +1441,17 @@ dvi_set (int32_t ch) */ font = &loaded_fonts[current_font]; - width = tfm_get_fw_width(font->tfm_id, ch); - width = sqxfw(font->size, width); + if (font->type == NATIVE) { + if (ch >= 0 && ch < font->num_glyphs) { + width = font->gm[ch].advance; + } else { + WARN("Invalid char for dvilua font: %04x", ch); + width = 0; + } + } else { + width = tfm_get_fw_width(font->tfm_id, ch); + width = sqxfw(font->size, width); + } if (lr_mode >= SKIMMING) { lr_width += width; @@ -1393,6 +1505,19 @@ dvi_set (int32_t ch) pdf_doc_expand_box(&rect); } break; + case NATIVE: + wbuf[0] = (ch >> 8) & 0xff; + wbuf[1] = ch & 0xff; + set_string(dvi_state.h, -dvi_state.v, wbuf, 2, width, font->font_id); + if (dvi_is_tracking_boxes()) { + pdf_rect rect; + + height = font->gm[ch].ascent; + depth = font->gm[ch].descent; + calc_rect(&rect, dvi_state.h, -dvi_state.v, width, height, depth); + pdf_doc_expand_box(&rect); + } + break; case VIRTUAL: #if 0 /* See comment in locate_font() */ diff --git a/Build/source/texk/dvipdfm-x/dvipdfmx.c b/Build/source/texk/dvipdfm-x/dvipdfmx.c index a3d42d72ef5..6da8627afec 100644 --- a/Build/source/texk/dvipdfm-x/dvipdfmx.c +++ b/Build/source/texk/dvipdfm-x/dvipdfmx.c @@ -2,7 +2,7 @@ DVIPDFMx, an eXtended version of DVIPDFM by Mark A. Wicks. - Copyright (C) 2002-2020 by Jin-Hwan Cho, Matthias Franz, and Shunsaku Hirata, + Copyright (C) 2002-2021 by Jin-Hwan Cho, Matthias Franz, and Shunsaku Hirata, the DVIPDFMx project team. Copyright (c) 2006 SIL. (xdvipdfmx extensions for XeTeX support) @@ -89,7 +89,8 @@ static int pdf_version_minor = 5; static int compression_level = 9; /* PDF document navigation feature settings */ -static double annot_grow = 0.0; +static double annot_grow_x = 0.0; +static double annot_grow_y = 0.0; static int bookmark_open = 0; static double mag = 1.0; static int enable_thumbnail = 0; @@ -513,7 +514,7 @@ do_args_first_pass (int argc, char *argv[], const char *source, int unsafe) static void do_args_second_pass (int argc, char *argv[], const char *source, int unsafe) { - int c; + int c, error = 0; char *nextptr; const char *nnextptr; @@ -548,7 +549,24 @@ do_args_second_pass (int argc, char *argv[], const char *source, int unsafe) case 'g': nnextptr = nextptr = optarg; - dpx_util_read_length(&annot_grow, 1.0, &nnextptr, nextptr + strlen(nextptr)); + { + const char *comma; + + comma = strchr(optarg, ','); + if (comma) { + error = dpx_util_read_length(&annot_grow_x, 1.0, &nnextptr, comma); + nnextptr = comma + 1; + if (!error) + error = dpx_util_read_length(&annot_grow_y, 1.0, &nnextptr, nextptr + strlen(nextptr)); + } else { + error = dpx_util_read_length(&annot_grow_x, 1.0, &nnextptr, nextptr + strlen(nextptr)); + if (!error) + annot_grow_y = annot_grow_x; + } + if (error) { + WARN("Error reading argument for \"-g\" option: %s", optarg); + } + } break; case 'x': @@ -1178,11 +1196,12 @@ main (int argc, char *argv[]) if (landscape_mode) { SWAP(paper_width, paper_height); } - settings.media_width = paper_width; - settings.media_height = paper_height; - settings.annot_grow_amount = annot_grow; - settings.outline_open_depth = bookmark_open; - settings.check_gotos = !(opt_flags & OPT_PDFDOC_NO_DEST_REMOVE); + settings.media_width = paper_width; + settings.media_height = paper_height; + settings.annot_grow_amount.x = annot_grow_x; + settings.annot_grow_amount.y = annot_grow_y; + settings.outline_open_depth = bookmark_open; + settings.check_gotos = !(opt_flags & OPT_PDFDOC_NO_DEST_REMOVE); settings.enable_manual_thumb = enable_thumbnail; /* PDF page output settings */ diff --git a/Build/source/texk/dvipdfm-x/pdfdoc.c b/Build/source/texk/dvipdfm-x/pdfdoc.c index a4e96026c8a..75ed8179dde 100644 --- a/Build/source/texk/dvipdfm-x/pdfdoc.c +++ b/Build/source/texk/dvipdfm-x/pdfdoc.c @@ -1,6 +1,6 @@ /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. - Copyright (C) 2002-2020 by Jin-Hwan Cho, Matthias Franz, and Shunsaku Hirata, + Copyright (C) 2002-2021 by Jin-Hwan Cho, Matthias Franz, and Shunsaku Hirata, the dvipdfmx project team. Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu> @@ -220,7 +220,9 @@ typedef struct pdf_doc struct { int outline_open_depth; - double annot_grow; + struct { + double x, y; + } annot_grow; int enable_manual_thumb; } options; @@ -2506,7 +2508,8 @@ pdf_open_document (const char *filename, 1, 1); } - p->options.annot_grow = settings.annot_grow_amount; + p->options.annot_grow.x = settings.annot_grow_amount.x; + p->options.annot_grow.y = settings.annot_grow_amount.y; p->options.outline_open_depth = settings.outline_open_depth; pdf_init_resources(); @@ -2802,8 +2805,9 @@ pdf_doc_end_annot (void) void pdf_doc_break_annot (void) { - pdf_doc *p = &pdoc; - double g = p->options.annot_grow; + pdf_doc *p = &pdoc; + double g_x = p->options.annot_grow.x; + double g_y = p->options.annot_grow.y; if (breaking_state.dirty) { pdf_obj *annot_dict, *annot_copy; @@ -2815,10 +2819,10 @@ pdf_doc_break_annot (void) pdf_merge_dict(annot_copy, breaking_state.annot_dict); breaking_state.annot_dict = annot_copy; rect = breaking_state.rect; - rect.llx -= g; - rect.lly -= g; - rect.urx += g; - rect.ury += g; + rect.llx -= g_x; + rect.lly -= g_y; + rect.urx += g_x; + rect.ury += g_y; pdf_doc_add_annot(pdf_doc_current_page_number(), &rect, annot_dict, !breaking_state.broken); pdf_release_obj(annot_dict); diff --git a/Build/source/texk/dvipdfm-x/pdfdoc.h b/Build/source/texk/dvipdfm-x/pdfdoc.h index 2d4eafcc541..bd8bf3bedaa 100644 --- a/Build/source/texk/dvipdfm-x/pdfdoc.h +++ b/Build/source/texk/dvipdfm-x/pdfdoc.h @@ -1,6 +1,6 @@ /* This is dvipdfmx, an eXtended version of dvipdfm by Mark A. Wicks. - Copyright (C) 2002-2020 by Jin-Hwan Cho and Shunsaku Hirata, + Copyright (C) 2002-2021 by Jin-Hwan Cho and Shunsaku Hirata, the dvipdfmx project team. Copyright (C) 1998, 1999 by Mark A. Wicks <mwicks@kettering.edu> @@ -62,7 +62,9 @@ struct pdf_setting { int ver_major, ver_minor; double media_width, media_height; - double annot_grow_amount; + struct { + double x, y; + } annot_grow_amount; int outline_open_depth; int check_gotos; int enable_manual_thumb; |