texlive[46454] Build/source/texk/dvipdfm-x: dvipdfm-x: support new

commits+hironobu at tug.org commits+hironobu at tug.org
Sat Jan 27 03:25:02 CET 2018


Revision: 46454
          http://tug.org/svn/texlive?view=revision&revision=46454
Author:   hironobu
Date:     2018-01-27 03:25:02 +0100 (Sat, 27 Jan 2018)
Log Message:
-----------
dvipdfm-x: support new JFM spec

Modified Paths:
--------------
    trunk/Build/source/texk/dvipdfm-x/ChangeLog
    trunk/Build/source/texk/dvipdfm-x/numbers.c
    trunk/Build/source/texk/dvipdfm-x/numbers.h
    trunk/Build/source/texk/dvipdfm-x/tfm.c

Modified: trunk/Build/source/texk/dvipdfm-x/ChangeLog
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/ChangeLog	2018-01-27 02:24:19 UTC (rev 46453)
+++ trunk/Build/source/texk/dvipdfm-x/ChangeLog	2018-01-27 02:25:02 UTC (rev 46454)
@@ -1,3 +1,8 @@
+2018-01-27  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
+
+	* tfm.c, number.[ch]: Support new JFM spec (3-byte characters
+	in TYPE > 0).
+
 2017-12-21  Akira Kakuto  <kakuto at fuk.kindai.ac.jp>
 
 	* jpegimage.c: If j_info->xdpi and j_info->ydpi are not

Modified: trunk/Build/source/texk/dvipdfm-x/numbers.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/numbers.c	2018-01-27 02:24:19 UTC (rev 46453)
+++ trunk/Build/source/texk/dvipdfm-x/numbers.c	2018-01-27 02:25:02 UTC (rev 46454)
@@ -84,6 +84,16 @@
   return triple;
 }
 
+#ifndef WITHOUT_ASCII_PTEX
+unsigned int get_unsigned_triple_kanji(FILE *file)
+{
+  unsigned int triple = get_unsigned_byte(file);
+  triple = (triple << 8) | get_unsigned_byte(file);
+  triple = triple | (get_unsigned_byte(file)<<16);
+  return triple;
+}
+#endif
+
 signed int get_signed_triple(FILE *file)
 {
   int i;

Modified: trunk/Build/source/texk/dvipdfm-x/numbers.h
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/numbers.h	2018-01-27 02:24:19 UTC (rev 46453)
+++ trunk/Build/source/texk/dvipdfm-x/numbers.h	2018-01-27 02:25:02 UTC (rev 46454)
@@ -59,6 +59,9 @@
 extern unsigned short sget_unsigned_pair (unsigned char *);
 extern signed short get_signed_pair (FILE *);
 extern unsigned int get_unsigned_triple (FILE *);
+#ifndef WITHOUT_ASCII_PTEX
+extern unsigned int get_unsigned_triple_kanji (FILE *);
+#endif
 extern signed int get_signed_triple (FILE *);
 extern int32_t get_signed_quad (FILE *);
 extern uint32_t get_unsigned_quad (FILE *);

Modified: trunk/Build/source/texk/dvipdfm-x/tfm.c
===================================================================
--- trunk/Build/source/texk/dvipdfm-x/tfm.c	2018-01-27 02:24:19 UTC (rev 46453)
+++ trunk/Build/source/texk/dvipdfm-x/tfm.c	2018-01-27 02:25:02 UTC (rev 46454)
@@ -52,7 +52,7 @@
 #define JFMV_ID  9
 #define IS_JFM(i) ((i) == JFM_ID || (i) == JFMV_ID)
 
-#define CHARACTER_INDEX(i)  ((i > 0xFFFFUL ? 0x10000UL : i))
+#define CHARACTER_INDEX(i)  ((i > 0x10FFFFUL ? 0x110000UL : i))
 #else
 #define CHARACTER_INDEX(i)  ((i))
 #endif
@@ -83,7 +83,7 @@
 #endif /* !WITHOUT_OMEGA */
   fixword       *header;
 #ifndef WITHOUT_ASCII_PTEX
-  unsigned short *chartypes;
+  unsigned int *chartypes;
 #endif /* !WITHOUT_ASCII_PTEX */
   uint32_t      *char_info;
   unsigned short *width_index;
@@ -181,7 +181,11 @@
 struct char_map
 {
   struct coverage coverage;
+#ifndef WITHOUT_ASCII_PTEX
+  unsigned int *indices;
+#else
   unsigned short *indices;
+#endif
 };
 
 static void
@@ -454,17 +458,18 @@
 static void
 jfm_do_char_type_array (FILE *tfm_file, struct tfm_font *tfm)
 {
-  unsigned short charcode;
+  unsigned int charcode;
   unsigned short chartype;
-  int i;
+  unsigned int i;
 
-  tfm->chartypes = NEW(65536, unsigned short);
-  for (i = 0; i < 65536; i++) {
+  tfm->chartypes = NEW(1114112, unsigned int);
+  for (i = 0; i < 1114112; i++) {
     tfm->chartypes[i] = 0;
   }
   for (i = 0; i < tfm->nt; i++) {
-    charcode = get_unsigned_pair(tfm_file);
-    chartype = get_unsigned_pair(tfm_file);
+    /* support new JFM spec by texjporg */
+    charcode = get_unsigned_triple_kanji(tfm_file);
+    chartype = get_unsigned_byte(tfm_file);
     tfm->chartypes[charcode] = chartype;
   }
 }
@@ -481,14 +486,14 @@
     map->coverage.first_char = 0;
 #ifndef WITHOUT_ASCII_PTEX
     map->coverage.num_chars  = 0x10FFFFL;
-    map->indices    = NEW(0x10001L, unsigned short);
-    map->indices[0x10000L] = tfm->chartypes[0];
+    map->indices    = NEW(0x110001L, unsigned int);
+    map->indices[0x110000L] = tfm->chartypes[0];
+    for (code = 0; code <= 0x10FFFFU; code++) {
 #else
     map->coverage.num_chars  = 0xFFFFL;
     map->indices    = NEW(0x10000L, unsigned short);
+    for (code = 0; code <= 0xFFFFU; code++) {
 #endif
-
-    for (code = 0; code <= 0xFFFFU; code++) {
       map->indices[code] = tfm->chartypes[code];
     }
   } else {



More information about the tex-live-commits mailing list