Skip to content

Instantly share code, notes, and snippets.

@munepi
Created March 10, 2022 11:14
Show Gist options
  • Save munepi/751d8ffdd3aa9f255bedeaa33a7072a1 to your computer and use it in GitHub Desktop.
Save munepi/751d8ffdd3aa9f255bedeaa33a7072a1 to your computer and use it in GitHub Desktop.
%#! ptex2pdf -l -u -ot '--synctex=1' -od '-vv -V6 -z3' test-mrsw7basic
%% 場当たり的に、モリサワ基本7書体をotfパッケージの高々7つ分の仮想フォントに割り当てます。
\documentclass[dvipdfmx,uplatex,a5paper,papersize]{jsbook}
\usepackage{lmodern}
\usepackage[deluxe,jis2004,uplatex]{otf}
\makeatletter
\DeclareRobustCommand\ltseries{\not@math@alphabet\ltseries\relax
\romanfamily{lmss}\romanseries{m}% \romanseries\ltdefault
\kanjiseries\ltdefault\selectfont}
\DeclareRobustCommand\ebseries{\not@math@alphabet\ebseries\relax
\romanfamily{lmss}\romanseries{bx}% \romanseries\ebdefault
\kanjiseries\ebdefault\selectfont}
\DeclareRobustCommand\mgfamily{\not@math@alphabet\mgfamily\mathmg\relax
\romanfamily\sfdefault\kanjifamily\mgdefault\selectfont}
\DeclareRobustCommand\textmc[1]{%
\relax\ifmmode \expandafter\nfss@text \fi{\mcfamily #1}}
\DeclareRobustCommand\textgt[1]{%
\relax\ifmmode \expandafter\nfss@text \fi{\gtfamily\sffamily #1}}
\DeclareTextFontCommand{\textlt}{\mcfamily\ltseries}
\DeclareTextFontCommand{\texteb}{\gtfamily\sffamily\ebseries}
\DeclareRelationFont{\otf@JYn}{hmc}{l}{}{\otf@OTorT1}{lmss}{m}{} %lmr/l
\DeclareRelationFont{\otf@JTn}{hmc}{l}{}{\otf@OTorT1}{lmss}{m}{} %lmr/l
\DeclareRelationFont{\otf@JYn}{hmc}{m}{}{\otf@OTorT1}{lmr}{m}{}
\DeclareRelationFont{\otf@JTn}{hmc}{m}{}{\otf@OTorT1}{lmr}{m}{}
\DeclareRelationFont{\otf@JYn}{hmc}{bx}{}{\otf@OTorT1}{lmr}{bx}{}
\DeclareRelationFont{\otf@JTn}{hmc}{bx}{}{\otf@OTorT1}{lmr}{bx}{}
\DeclareRelationFont{\otf@JYn}{hgt}{m}{}{\otf@OTorT1}{lmss}{m}{}
\DeclareRelationFont{\otf@JTn}{hgt}{m}{}{\otf@OTorT1}{lmss}{m}{}
\DeclareRelationFont{\otf@JYn}{hgt}{bx}{}{\otf@OTorT1}{lmss}{bx}{}
\DeclareRelationFont{\otf@JTn}{hgt}{bx}{}{\otf@OTorT1}{lmss}{bx}{}
\DeclareRelationFont{\otf@JYn}{hgt}{eb}{}{\otf@OTorT1}{lmss}{bx}{}
\DeclareRelationFont{\otf@JTn}{hgt}{eb}{}{\otf@OTorT1}{lmss}{bx}{}
\DeclareRelationFont{\otf@JYn}{mg}{m}{}{\otf@OTorT1}{lmss}{m}{}
\DeclareRelationFont{\otf@JTn}{mg}{m}{}{\otf@OTorT1}{lmss}{m}{}
\makeatother
\AtBeginDvi{
\special{pdf:mapfile otf-morisawa}
\special{pdf:mapfile otf-up-morisawa}
%%from otf-morisawa.map
% TEXT, 90JIS
\special{pdf:mapline hminl-h H A-OTF-Jun201Pro-Regular.otf}
\special{pdf:mapline hminl-v V A-OTF-Jun201Pro-Regular.otf}
% TEXT, JIS04
\special{pdf:mapline hminln-h H A-OTF-Jun201Pro-Regular.otf}
\special{pdf:mapline hminln-v V A-OTF-Jun201Pro-Regular.otf}
% CID
\special{pdf:mapline otf-cjml-h Identity-H A-OTF-Jun201Pro-Regular.otf}
\special{pdf:mapline otf-cjml-v Identity-V A-OTF-Jun201Pro-Regular.otf}
% Unicode 90JIS
\special{pdf:mapline otf-ujml-h UniJIS-UTF16-H A-OTF-Jun201Pro-Regular.otf}
\special{pdf:mapline otf-ujml-v UniJIS-UTF16-V A-OTF-Jun201Pro-Regular.otf}
% Unicode JIS04
\special{pdf:mapline otf-ujmln-h UniJIS2004-UTF16-H A-OTF-Jun201Pro-Regular.otf}
\special{pdf:mapline otf-ujmln-v UniJIS2004-UTF16-V A-OTF-Jun201Pro-Regular.otf}
%%from otf-up-morisawa.map
% TEXT, 90JIS
\special{pdf:mapline uphminl-h UniJIS-UTF16-H A-OTF-Jun201Pro-Regular.otf}
\special{pdf:mapline uphminl-v UniJIS-UTF16-V A-OTF-Jun201Pro-Regular.otf}
% TEXT, JIS04
\special{pdf:mapline uphminln-h UniJIS2004-UTF16-H A-OTF-Jun201Pro-Regular.otf}
\special{pdf:mapline uphminln-v UniJIS2004-UTF16-V A-OTF-Jun201Pro-Regular.otf}
}
\begin{document}
\chapter{簡易的にotfパッケージでモリサワ基本7書体をしよう}
とりあえず、15分ぐらいででっち上げました。
〇〇さん所有のモリサワ基本7書体を使います。
場当たり的に、モリサワ基本7書体をotfパッケージの高々7つ分の仮想フォントに割り当てます。
これ以上の出力結果がほしい場合は、自己解決なさるなり、必要に応じて有償でうけたまわれる場合がございます。
なお、TeX Live 2020以降、標準で高品質な原ノ味フォント(源ノ明朝、源ノ角ゴシック)が割り当てられており、オススメいたします。
\section{使い方}
\begin{itemize}
\item \textlt{A-OTF-Jun201Pro-Regular.otfを割り当てています。}
\item A-OTF-RyuminPro-Light.otfを割り当てています。
\item \textbf{A-OTF-FutoMinA101Pro-Bold.otfを割り当てています。}
\item \textgt{A-OTF-GothicBBBPro-Medium.otfを割り当てています。}
\item \textgt{\textbf{A-OTF-FutoGoB101Pro-Bold.otfを割り当てています。}}
\item \textgt{\texteb{A-OTF-MidashiGoPro-MB31.otfを割り当てています。}}
\item \textmg{A-OTF-Jun101Pro-Light.otfを割り当てています。}
\end{itemize}
\section{仕様}
\paragraph{明朝ファミリー\textbackslash mcfamily}
\begin{itemize}
\item \textbackslash mcfamily+\textbackslash ltseries: \textlt{モリサワ基本7書体を使います。}
\item \textbackslash mcfamily: モリサワ基本7書体を使います。
\item \textbackslash mcfamily+\textbackslash bfseries: \textbf{モリサワ基本7書体を使います。}
\end{itemize}
\paragraph{ゴシックファミリー\textbackslash gtfamily}
\begin{itemize}
\item \textbackslash gtfamily: \textgt{モリサワ基本7書体を使います。}
\item \textbackslash gtfamily+\textbackslash bfseries: \textgt{\textbf{モリサワ基本7書体を使います。}}
\item \textbackslash gtfamily+\textbackslash ebseries: \textgt{\texteb{モリサワ基本7書体を使います。}}
\end{itemize}
\paragraph{丸ゴシックファミリー\textbackslash mgfamily}
\begin{itemize}
\item \textbackslash mgfamily: \textmg{モリサワ基本7書体を使います。}
\end{itemize}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment