Skip to content

Instantly share code, notes, and snippets.

@aminophen
Last active July 31, 2017 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aminophen/157ecb92505dcee84ea7022f474e4ce3 to your computer and use it in GitHub Desktop.
Save aminophen/157ecb92505dcee84ea7022f474e4ce3 to your computer and use it in GitHub Desktop.
makejvf: GLUEKERN テーブルが“たくさん”の場合のサポート
Index: Build/source/texk/makejvf/tfmread.c
===================================================================
--- Build/source/texk/makejvf/tfmread.c (revision 44893)
+++ Build/source/texk/makejvf/tfmread.c (working copy)
@@ -11,7 +11,7 @@
int jfmread(int kcode)
{
- int i,ctype=0,w_ind,w,ll=0,rr=0,gk_ind,k_ind,g_ind;
+ int i,ctype=0,w_ind,w,ll=0,rr=0,tag,gk_ind,gk2_ind;
for (i = 0 ; i < nt ; i++) {
if (upair(&char_type[i*4]) == kcode) {
@@ -25,40 +25,50 @@
w = width[w_ind];
rightamount = 0;
- if (w != zw && ctype > 0) {
+ if (ctype > 0 && w != zw) {
/* get natural length of JFM glue between <type0> and <type of kcode> */
- gk_ind = char_info[0*4+3]; /* remainder for <type0> */
- 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 = kern[k_ind];
+ tag = char_info[ctype*4+2] % 4;
+ if (tag == 1) {
+ gk_ind = char_info[0*4+3]; /* remainder for <type0> */
+ if (glue_kern[gk_ind*4] == 254) /* support for large gluekern table */
+ gk_ind = upair(&glue_kern[gk_ind*4+2]);
+ 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) {
+ gk2_ind = glue_kern[(gk_ind+i)*4+3];
+ ll = kern[gk2_ind];
+ }
+ else {
+ gk2_ind = glue_kern[(gk_ind+i)*4+3];
+ ll = glue[3*gk2_ind];
+ }
+ break;
}
- else {
- g_ind = glue_kern[(gk_ind+i)*4+3];
- ll = glue[3*g_ind];
- }
- break;
+ if (glue_kern[(gk_ind+i)*4] >= 128)
+ break;
}
- if (glue_kern[(gk_ind+i)*4] >= 128)
- break;
}
/* get natural length of JFM glue between <type of kcode> and <type0> */
- gk_ind = char_info[ctype*4+3]; /* remainder for <type of kcode> */
- 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 = kern[k_ind];
+ tag = char_info[ctype*4+2] % 4;
+ if (tag == 1) {
+ gk_ind = char_info[ctype*4+3]; /* remainder for <type of kcode> */
+ if (glue_kern[gk_ind*4] == 254) /* support for large gluekern table */
+ gk_ind = upair(&glue_kern[gk_ind*4+2]);
+ 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) {
+ gk2_ind = glue_kern[(gk_ind+i)*4+3];
+ rr = kern[gk2_ind];
+ }
+ else {
+ gk2_ind = glue_kern[(gk_ind+i)*4+3];
+ rr = glue[3*gk2_ind];
+ }
+ break;
}
- else {
- g_ind = glue_kern[(gk_ind+i)*4+3];
- rr = glue[3*g_ind];
- }
- break;
+ if (glue_kern[(gk_ind+i)*4] >= 128)
+ break;
}
- if (glue_kern[(gk_ind+i)*4] >= 128)
- break;
}
if (abs(zw - ll - w - rr) <= 1) /* allow round-off error */
/* character width is truncated,
@aminophen
Copy link
Author

aminophen commented Jul 25, 2017

まだ pltotf.web や tftopl.web をちゃんと読んでいないのだが,

のような巨大な GLUEKERN テーブルがある場合のサポートを検討中。

@aminophen
Copy link
Author

r44927 でコミット。まだあまり自信ないが…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment