texlive[74668] Build/source/texk/dvipdfm-x: dvipdfm-x: Store

commits+takuji at tug.org commits+takuji at tug.org
Mon Mar 17 14:22:52 CET 2025


Revision: 74668
          https://tug.org/svn/texlive?view=revision&revision=74668
Author:   takuji
Date:     2025-03-17 14:22:52 +0100 (Mon, 17 Mar 2025)
Log Message:
-----------
dvipdfm-x: Store combining characters in vitual fonts with indices

Modified Paths:
--------------
    trunk/Build/source/texk/dvipdfm-x/ChangeLog
    trunk/Build/source/texk/dvipdfm-x/configure
    trunk/Build/source/texk/dvipdfm-x/configure.ac
    trunk/Build/source/texk/dvipdfm-x/vf.c

Modified: trunk/Build/source/texk/dvipdfm-x/ChangeLog
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/ChangeLog	2025-03-17 03:47:18 UTC (rev 74667)
+++ trunk/Build/source/texk/dvipdfm-x/ChangeLog	2025-03-17 13:22:52 UTC (rev 74668)
@@ -1,3 +1,10 @@
+2025-03-17  TANAKA Takuji  <ttk at t-lab.opal.ne.jp>
+
+	* vf.c: Store combining characters in vitual fonts with indices
+	and save memories to fix issue reported by gbb 60166.
+	https://okumuralab.org/tex/mod/forum/discuss.php?d=3903
+	* configure.ac: version 20250317.
+
 2025-03-14  Max Chernoff  <tex at maxchernoff.ca>
 	* pdffont.c: Switch to using only A-Z in the tag since numerical
 	digits are invalid per the PDF spec. Thanks to Yukimasa Morimi,

Modified: trunk/Build/source/texk/dvipdfm-x/configure
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/configure	2025-03-17 03:47:18 UTC (rev 74667)
+++ trunk/Build/source/texk/dvipdfm-x/configure	2025-03-17 13:22:52 UTC (rev 74668)
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.72 for dvipdfm-x (TeX Live) 20250314.
+# Generated by GNU Autoconf 2.72 for dvipdfm-x (TeX Live) 20250317.
 #
 # Report bugs to <dvipdfmx at tug.org>.
 #
@@ -614,8 +614,8 @@
 # Identity of this package.
 PACKAGE_NAME='dvipdfm-x (TeX Live)'
 PACKAGE_TARNAME='dvipdfm-x--tex-live-'
-PACKAGE_VERSION='20250314'
-PACKAGE_STRING='dvipdfm-x (TeX Live) 20250314'
+PACKAGE_VERSION='20250317'
+PACKAGE_STRING='dvipdfm-x (TeX Live) 20250317'
 PACKAGE_BUGREPORT='dvipdfmx at tug.org'
 PACKAGE_URL=''
 
@@ -1387,7 +1387,7 @@
   # 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) 20250314 to adapt to many kinds of systems.
+'configure' configures dvipdfm-x (TeX Live) 20250317 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1459,7 +1459,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of dvipdfm-x (TeX Live) 20250314:";;
+     short | recursive ) echo "Configuration of dvipdfm-x (TeX Live) 20250317:";;
    esac
   cat <<\_ACEOF
 
@@ -1590,7 +1590,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-dvipdfm-x (TeX Live) configure 20250314
+dvipdfm-x (TeX Live) configure 20250317
 generated by GNU Autoconf 2.72
 
 Copyright (C) 2023 Free Software Foundation, Inc.
@@ -2371,7 +2371,7 @@
 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 20250314, which was
+It was created by dvipdfm-x (TeX Live) $as_me 20250317, which was
 generated by GNU Autoconf 2.72.  Invocation command line was
 
   $ $0$ac_configure_args_raw
@@ -9263,7 +9263,7 @@
 
 # Define the identity of the package.
  PACKAGE='dvipdfm-x--tex-live-'
- VERSION='20250314'
+ VERSION='20250317'
 
 
 printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h
@@ -16931,7 +16931,7 @@
 Report bugs to <bug-libtool at gnu.org>."
 
 lt_cl_version="\
-dvipdfm-x (TeX Live) config.lt 20250314
+dvipdfm-x (TeX Live) config.lt 20250317
 configured by $0, generated by GNU Autoconf 2.72.
 
 Copyright (C) 2024 Free Software Foundation, Inc.
@@ -18885,7 +18885,7 @@
 # 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 20250314, which was
+This file was extended by dvipdfm-x (TeX Live) $as_me 20250317, which was
 generated by GNU Autoconf 2.72.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -18957,7 +18957,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config='$ac_cs_config_escaped'
 ac_cs_version="\\
-dvipdfm-x (TeX Live) config.status 20250314
+dvipdfm-x (TeX Live) config.status 20250317
 configured by $0, generated by GNU Autoconf 2.72,
   with options \\"\$ac_cs_config\\"
 

Modified: trunk/Build/source/texk/dvipdfm-x/configure.ac
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/configure.ac	2025-03-17 03:47:18 UTC (rev 74667)
+++ trunk/Build/source/texk/dvipdfm-x/configure.ac	2025-03-17 13:22:52 UTC (rev 74668)
@@ -8,7 +8,7 @@
 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)], [20250314], [dvipdfmx at tug.org])
+AC_INIT([dvipdfm-x (TeX Live)], [20250317], [dvipdfmx at tug.org])
 AC_PREREQ([2.65])
 AC_CONFIG_SRCDIR([agl.c])
 AC_CONFIG_AUX_DIR([../../build-aux])

Modified: trunk/Build/source/texk/dvipdfm-x/vf.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/vf.c	2025-03-17 03:47:18 UTC (rev 74667)
+++ trunk/Build/source/texk/dvipdfm-x/vf.c	2025-03-17 13:22:52 UTC (rev 74668)
@@ -47,6 +47,8 @@
 #define TEXPT2PT (72.0/72.27)
 #define FW2PT (TEXPT2PT/((double)(FIX_WORD_BASE)))
 
+#define CHAR_INDEX_MIN 0x40000
+
 struct font_def {
   int32_t font_id /* id used internally in vf file */;
   uint32_t checksum, size, design_size;
@@ -65,6 +67,7 @@
   unsigned char **ch_pkt, message_flag;
   uint32_t *pkt_len;
   unsigned num_chars;
+  uint32_t *idx_to_char, max_idx;
 };
 
 struct vf *vf_fonts = NULL;
@@ -111,12 +114,21 @@
 {
   unsigned i;
   if (size > (a_vf->num_chars)) {
-    size = MAX (size, a_vf->num_chars+256);
+    if (size > 0x40000)
+      size = MAX (size+0x1000, a_vf->num_chars+0x40000);
+    else if (size > 0x8000)
+      size = MAX (size+0x1000, a_vf->num_chars+0x8000);
+    else if (size > 0x1000)
+      size = MAX (size+0x100, a_vf->num_chars+0x1000);
+    else
+      size = MAX (size, a_vf->num_chars+256);
     a_vf->ch_pkt = RENEW (a_vf->ch_pkt, size, unsigned char *);
     a_vf->pkt_len = RENEW (a_vf->pkt_len, size, uint32_t);
+    a_vf->idx_to_char = RENEW (a_vf->idx_to_char, size, uint32_t);
     for (i=a_vf->num_chars; i<size; i++) {
       (a_vf->ch_pkt)[i] = NULL;
       (a_vf->pkt_len)[i] = 0;
+      (a_vf->idx_to_char)[i] = -1;
     }
     a_vf->num_chars = size;
   }
@@ -126,20 +138,35 @@
 			    uint32_t ch)
 {
   unsigned char *pkt;
+  uint32_t idx;
+
 #ifdef DEBUG
   fprintf (stderr, "read_a_char_def: len=%u, ch=%u\n", pkt_len, ch);
 #endif
+  idx = ch;
+  if (ch >= CHAR_INDEX_MIN) {
+    if (vf_fonts[thisfont].max_idx==0)
+      vf_fonts[thisfont].max_idx = CHAR_INDEX_MIN;
+    idx = vf_fonts[thisfont].max_idx;
+  }
   /* Resize and initialize character arrays if necessary */
-  if (ch >= vf_fonts[thisfont].num_chars) {
-    resize_one_vf_font (vf_fonts+thisfont, ch+1);
+  if (idx >= vf_fonts[thisfont].num_chars)
+    resize_one_vf_font (vf_fonts+thisfont, idx+1);
+  if (ch >= CHAR_INDEX_MIN) {
+    if (idx > CHAR_INDEX_MIN && (vf_fonts[thisfont].idx_to_char)[idx-1] >= ch) {
+      fprintf (stderr, "Unexpected character code: %x, index: %x\n", ch, idx);
+      ERROR ("Unexpected character code in vf file\n");
+    }
+    (vf_fonts[thisfont].idx_to_char)[idx] = ch;
+    vf_fonts[thisfont].max_idx++;
   }
   if (pkt_len > 0) {
     pkt = NEW (pkt_len, unsigned char);
     if (fread (pkt, 1, pkt_len, vf_file) != pkt_len)
       ERROR ("VF file ended prematurely.");
-    (vf_fonts[thisfont].ch_pkt)[ch] = pkt;
+    (vf_fonts[thisfont].ch_pkt)[idx] = pkt;
   }
-  (vf_fonts[thisfont].pkt_len)[ch] = pkt_len;
+  (vf_fonts[thisfont].pkt_len)[idx] = pkt_len;
   return;
 }
 
@@ -278,6 +305,8 @@
 	vf_fonts[thisfont].num_chars = 0;
 	vf_fonts[thisfont].ch_pkt = NULL;
 	vf_fonts[thisfont].pkt_len = NULL;
+	vf_fonts[thisfont].idx_to_char = NULL;
+	vf_fonts[thisfont].max_idx = 0;
       }
       read_header(vf_file, thisfont);
       process_vf_file (vf_file, thisfont);
@@ -406,6 +435,20 @@
   unsigned char *start, *end;
   spt_t ptsize;
   int default_font = -1;
+  int32_t idx;
+  idx = ch;
+  if (ch >= CHAR_INDEX_MIN) {
+    int32_t j, k, mid, ch0;
+    idx = -1;
+    j=CHAR_INDEX_MIN;  k=vf_fonts[vf_font].max_idx;
+    while (j < k) {
+      mid = j + (k - j) / 2;
+      ch0 = (vf_fonts[vf_font].idx_to_char)[mid];
+      if      (ch0 < ch) j = mid+1;
+      else if (ch0 > ch) k = mid;
+      else { idx = mid; break; }
+    }
+  }
   if (vf_font < num_vf_fonts) {
     /* Initialize to the first font or -1 if undefined */
     ptsize = vf_fonts[vf_font].ptsize;
@@ -412,10 +455,10 @@
     if (vf_fonts[vf_font].num_dev_fonts > 0)
       default_font = ((vf_fonts[vf_font].dev_fonts)[0]).dev_id;
     dvi_vf_init (default_font);
-    if (ch >= vf_fonts[vf_font].num_chars ||
-	!(start = (vf_fonts[vf_font].ch_pkt)[ch])) {
+    if (idx >= vf_fonts[vf_font].num_chars || idx < 0 ||
+	!(start = (vf_fonts[vf_font].ch_pkt)[idx])) {
       int is_jfm = tfm_is_jfm(vf_fonts[vf_font].dev_fonts[0].tfm_id);
-      if (is_jfm &&
+      if (is_jfm && ch < CHAR_INDEX_MIN &&
           ch <= JFM_LASTCHAR && dpx_conf.compat_mode != dpx_mode_xdv_mode) {
         /* fallback multibyte character for (u)pTeX */
         if (dpx_conf.verbose_level == 1)
@@ -437,7 +480,7 @@
       fprintf (stderr, "Tried to set a nonexistent character in a virtual font");
       start = end = NULL;
     } else {
-      end = start + (vf_fonts[vf_font].pkt_len)[ch];
+      end = start + (vf_fonts[vf_font].pkt_len)[idx];
     }
     while (start && start < end) {
       opcode = *(start++);
@@ -555,6 +598,8 @@
     }
     if (vf_fonts[i].pkt_len)
       RELEASE (vf_fonts[i].pkt_len);
+    if (vf_fonts[i].idx_to_char)
+      RELEASE (vf_fonts[i].idx_to_char);
     if (vf_fonts[i].tex_name)
       RELEASE (vf_fonts[i].tex_name);
     /* Release each font record */



More information about the tex-live-commits mailing list.