summaryrefslogtreecommitdiff
path: root/Build/source/texk/makejvf
diff options
context:
space:
mode:
authorHironobu Yamashita <h.y.acetaminophen@gmail.com>2017-07-24 16:06:49 +0000
committerHironobu Yamashita <h.y.acetaminophen@gmail.com>2017-07-24 16:06:49 +0000
commit01ffe4a9dcdc2e14ee16025376eee1315e025201 (patch)
tree6355d33092f8bcd320a8e7794b6adf1ac6821493 /Build/source/texk/makejvf
parent03baebc3f22764133d066a942a43b9fb94c0d12e (diff)
makejvf/tfmread.c: more efficient code
git-svn-id: svn://tug.org/texlive/trunk@44881 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/makejvf')
-rw-r--r--Build/source/texk/makejvf/ChangeLog5
-rw-r--r--Build/source/texk/makejvf/makejvf.h2
-rw-r--r--Build/source/texk/makejvf/tfmread.c32
3 files changed, 22 insertions, 17 deletions
diff --git a/Build/source/texk/makejvf/ChangeLog b/Build/source/texk/makejvf/ChangeLog
index 9cff18b9c91..c19b5d4a8cf 100644
--- a/Build/source/texk/makejvf/ChangeLog
+++ b/Build/source/texk/makejvf/ChangeLog
@@ -1,3 +1,8 @@
+2017-07-24 Hironobu Yamashita <h.y.acetaminophen@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@gmail.com>
* write.c: Trivial change to avoid round-off error in
diff --git a/Build/source/texk/makejvf/makejvf.h b/Build/source/texk/makejvf/makejvf.h
index 05e8a4b9c05..62b3b94fef8 100644
--- a/Build/source/texk/makejvf/makejvf.h
+++ b/Build/source/texk/makejvf/makejvf.h
@@ -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;
diff --git a/Build/source/texk/makejvf/tfmread.c b/Build/source/texk/makejvf/tfmread.c
index c110e7e8f84..8059b1737e4 100644
--- a/Build/source/texk/makejvf/tfmread.c
+++ b/Build/source/texk/makejvf/tfmread.c
@@ -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 @@ int jfmread(int kcode)
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 @@ int jfmread(int kcode)
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 tfmget(char *name)
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 @@ int tfmidx(FILE *fp)
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++) {