Skip to content

Instantly share code, notes, and snippets.

@aminophen
Last active August 30, 2019 15:55
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/d2a874fca7531cec7a5ffa97d3de3ff1 to your computer and use it in GitHub Desktop.
Save aminophen/d2a874fca7531cec7a5ffa97d3de3ff1 to your computer and use it in GitHub Desktop.
dvips: JFM 由来の VF からは OFM が参照されないようにするパッチ
Index: protos.h
===================================================================
--- protos.h (revision 51992)
+++ protos.h (working copy)
@@ -409,5 +409,6 @@
/* global variables from tfmload.c */
extern FILE *tfmfile;
+extern Boolean force_jfm;
#endif
Index: tfmload.c
===================================================================
--- tfmload.c (revision 51992)
+++ tfmload.c (working copy)
@@ -12,6 +12,7 @@
#include "protos.h"
FILE *tfmfile;
+Boolean force_jfm = 0;
/*
* Our static variables:
@@ -43,7 +44,7 @@
/* 6 for tfm() + null */
error("! TFM file name too long in tfmopen") ;
}
- if (!noomega) {
+ if (!noomega && !force_jfm) {
#ifdef KPATHSEA
d = ofmpath;
#else
@@ -59,6 +60,7 @@
if ((tfmfile=search(d, name, READBIN))!=NULL)
return;
}
+ force_jfm = 0;
#ifdef KPATHSEA
d = tfmpath;
#else
Index: virtualfont.c
===================================================================
--- virtualfont.c (revision 51992)
+++ virtualfont.c (working copy)
@@ -159,6 +159,7 @@
integer maxcc=255;
register quarterword *tempr;
fontmaptype *fm, *newf;
+ int id = 0;
int kindfont;
kindfont = vfopen(curfnt); /* 1 for TeX and pTeX, 2 for Omega */
if (!kindfont)
@@ -195,14 +196,17 @@
k = vfquad();
check_checksum (k, curfnt->checksum, curfnt->name);
k = (integer)(alpha * (real)vfquad());
- if (k > curfnt->designsize + 2 || k < curfnt->designsize - 2) {
- int id = 0;
- if (!noptex) {
- tfmopen(curfnt); /* We check if parent is jfm or not. */
- id = tfm16();
- fclose(tfmfile);
- }
- if (id != 9 && id != 11) {
+ if (!noptex) {
+ tfmopen(curfnt); /* We check if parent is jfm or not. */
+ id = tfm16();
+ fclose(tfmfile);
+ }
+ if (id == 9 || id == 11)
+ /* if parent is jfm, the error is suppressed.
+ also, mapped font should be jfm; ignore ofm! */
+ force_jfm = 1;
+ else {
+ if (k > curfnt->designsize + 2 || k < curfnt->designsize - 2) {
char *msg = concat("Design size mismatch in font ", name);
error(msg);
free(msg);
@aminophen
Copy link
Author

aminophen commented Aug 30, 2019

texjporg/japanese-otf-mirror#15 を参照。

dvips では「\CID{...} や expert の縦書きが dvips でうまく行かない」という問題が起きるが,これは OTF パッケージの VF から「otf-cjmr-h」というフォントを参照する際に otf-cjmr-v.ofm と otf-cjmr-v.tfm が競合し,前者が優先されることに由来する。そこで,「和文 JFM 由来の VF からは OFM を参照しないようにする」というパッチを書いてみた。

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