texlive[44881] Build/source/texk/makejvf: makejvf/tfmread.c: more

commits+hironobu at tug.org commits+hironobu at tug.org
Mon Jul 24 18:06:50 CEST 2017


Revision: 44881
          http://tug.org/svn/texlive?view=revision&revision=44881
Author:   hironobu
Date:     2017-07-24 18:06:49 +0200 (Mon, 24 Jul 2017)
Log Message:
-----------
makejvf/tfmread.c: more efficient code

Modified Paths:
--------------
    trunk/Build/source/texk/makejvf/ChangeLog
    trunk/Build/source/texk/makejvf/makejvf.h
    trunk/Build/source/texk/makejvf/tfmread.c

Modified: trunk/Build/source/texk/makejvf/ChangeLog
===================================================================
--- trunk/Build/source/texk/makejvf/ChangeLog	2017-07-24 11:32:52 UTC (rev 44880)
+++ trunk/Build/source/texk/makejvf/ChangeLog	2017-07-24 16:06:49 UTC (rev 44881)
@@ -1,3 +1,8 @@
+2017-07-24  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
+
+	* tfmread.c, makejvf.h: More efficient code. Note that
+	GLUEKERN table parser is still not working for nl > 255.
+
 2017-07-23  Hironobu Yamashita  <h.y.acetaminophen at gmail.com>
 
 	* write.c: Trivial change to avoid round-off error in

Modified: trunk/Build/source/texk/makejvf/makejvf.h
===================================================================
--- trunk/Build/source/texk/makejvf/makejvf.h	2017-07-24 11:32:52 UTC (rev 44880)
+++ trunk/Build/source/texk/makejvf/makejvf.h	2017-07-24 16:06:49 UTC (rev 44881)
@@ -1,5 +1,5 @@
 
-#define MAX_LIG_STEPS 32510
+
 extern char *vtfmname,*kanatfm,*jistfm,*ucsqtfm;
 extern int unit,zh,zw,jfm_id,rightamount;
 extern int kanatume,chotai,baseshift,minute,hankana,fidzero,enhanced;

Modified: trunk/Build/source/texk/makejvf/tfmread.c
===================================================================
--- trunk/Build/source/texk/makejvf/tfmread.c	2017-07-24 11:32:52 UTC (rev 44880)
+++ trunk/Build/source/texk/makejvf/tfmread.c	2017-07-24 16:06:49 UTC (rev 44881)
@@ -5,9 +5,9 @@
 #include <stdlib.h>
 #include <string.h>
 
-int nt,unit,zh,zw,jfm_id,rightamount;
-int *width,*height,*depth,*italic,*param;
-unsigned char *header,*char_type,*char_info,*glue_kern,*kern,*glue;
+int nt,nl,unit,zh,zw,jfm_id,rightamount;
+int *width,*height,*depth,*italic,*kern,*glue,*param;
+unsigned char *header,*char_type,*char_info,*glue_kern;
 
 int jfmread(int kcode)
 {
@@ -30,15 +30,15 @@
 		gk_ind = char_info[0*4+3]; /* remainder for <type0> */
 		ll = 0;
 		if (ctype > 0) {
-			for (i = 0 ; i < MAX_LIG_STEPS ; i++) {
+			for (i = 0 ; i < nl-gk_ind ; i++) {
 				if (glue_kern[(gk_ind+i)*4+1] == ctype) {
 					if (glue_kern[(gk_ind+i)*4+2] >= 128) {
 						k_ind = glue_kern[(gk_ind+i)*4+3];
-						ll = mquad(&kern[k_ind*4]);
+						ll = kern[k_ind];
 					}
 					else {
 						g_ind = glue_kern[(gk_ind+i)*4+3];
-						ll = mquad(&glue[3*g_ind*4]);
+						ll = glue[3*g_ind];
 					}
 					break;
 				}
@@ -50,15 +50,15 @@
 		gk_ind = char_info[ctype*4+3]; /* remainder for <type of kcode> */
 		rr = 0;
 		if (ctype > 0) {
-			for (i = 0 ; i < MAX_LIG_STEPS ; i++) {
+			for (i = 0 ; i < nl-gk_ind ; i++) {
 				if (glue_kern[(gk_ind+i)*4+1] == 0) {
 					if (glue_kern[(gk_ind+i)*4+2] >= 128) {
 						k_ind = glue_kern[(gk_ind+i)*4+3];
-						rr = mquad(&kern[k_ind*4]);
+						rr = kern[k_ind];
 					}
 					else {
 						g_ind = glue_kern[(gk_ind+i)*4+3];
-						rr = mquad(&glue[3*g_ind*4]);
+						rr = glue[3*g_ind];
 					}
 					break;
 				}
@@ -104,7 +104,7 @@
 int tfmidx(FILE *fp)
 {
 	int i;
-	int lh,ec,nw,nh,nd,ni,nl,nk,ng,np;
+	int lh,ec,nw,nh,nd,ni,nk,ng,np;
 
 	jfm_id = fpair(fp);
 
@@ -155,13 +155,13 @@
 		for (i = 0 ; i < nl*4 ; i++) {
 			glue_kern[i] = fgetc(fp);
 		}
-		kern = xmalloc(nk*4);
-		for (i = 0 ; i < nk*4 ; i++) {
-			kern[i] = fgetc(fp);
+		kern = xmalloc(nk*sizeof(int));
+		for (i = 0 ; i < nk ; i++) {
+			kern[i] = fquad(fp);
 		}
-		glue = xmalloc(ng*4);
-		for (i = 0 ; i < ng*4 ; i++) {
-			glue[i] = fgetc(fp);
+		glue = xmalloc(ng*sizeof(int));
+		for (i = 0 ; i < ng ; i++) {
+			glue[i] = fquad(fp);
 		}
 		param = xmalloc(np*sizeof(int));
 		for (i = 0 ; i < np ; i++) {



More information about the tex-live-commits mailing list