使用系统安装的字体和字体包

使用系统安装的字体和字体包

我正在尝试为我的讲座讲义创建一个模板。我使用 Segoe UI 作为演示文稿的主要字体,并且我想使用 BaskervilleF (https://tug.org/FontCatalogue/baskervillef/) 用于显示幻灯片正下方的讲义部分。

由于 Segoe 是系统安装的字体,必须单独使用声明\setmainfont,而 BaskervilleF 是作为包加载的,因此我不确定如何做到这一点。我之前尝试使用 Sabon 并将其声明为新字体,并且它按预期工作,但我更喜欢 BaskervilleF(只是个人偏好)。所以,我想知道这是否可以毫不费力地完成,在这种情况下,我会继续使用 Sabon。

PS:我不喜欢 Google 字体中的 Baskervville 字体(https://fonts.google.com/specimen/Baskervville?query=basker),这根本就不一样。

提前致谢。

这是MWE:

\documentclass[aspectratio=169]{beamer}

\usepackage{pgfpages}
\makeatletter 
\def\beamer@framenotesbegin{
    \usebeamercolor[fg]{normal text}
    \gdef\beamer@noteitems{}% 
    \gdef\beamer@notes{}% 
}

\defbeamertemplate*{note page}{custom}
{%
    {%
        \scriptsize
        \usebeamerfont{note title}\usebeamercolor[fg]{note title}%
        \ifbeamercolorempty[bg]{note title}{}{%
            \insertvrule{.25\paperheight}{note title.bg}%
            \vskip-.25\paperheight%
            \nointerlineskip%
        }%
        \nointerlineskip
        \vbox to .25\paperheight{\vskip0.5em
            %\hbox{\insertshorttitle[width=0.75\textwidth]}%
            \setbox\beamer@tempbox=\hbox{\insertsection}%
            \hbox{\ifdim\wd\beamer@tempbox>1pt{\hskip4pt\raise3pt\hbox{\vrule
                        width0.4pt height7pt\vrule width 9pt
                        height0.4pt}}\hskip1pt\hbox{\begin{minipage}[t]{0.71\textwidth}\def\breakhere{}\insertsection\end{minipage}}\fi%
            }%
            \setbox\beamer@tempbox=\hbox{\insertsubsection}%
            \hbox{\ifdim\wd\beamer@tempbox>1pt{\hskip17.4pt\raise3pt\hbox{\vrule
                        width0.4pt height7pt\vrule width 9pt
                        height0.4pt}}\hskip1pt\hbox{\begin{minipage}[t]{0.71\textwidth}\def\breakhere{}\insertsubsection\end{minipage}}\fi%
            }%
            \setbox\beamer@tempbox=\hbox{\insertshortframetitle}%
            \hbox{\ifdim\wd\beamer@tempbox>1pt{\hskip30.8pt\raise3pt\hbox{\vrule
                        width0.4pt height7pt\vrule width 9pt
                        height0.4pt}}\hskip1pt\hbox{\insertshortframetitle[width=0.67\textwidth]}\fi%
            }%
            \vfil}%
    }%
    \ifbeamercolorempty[bg]{note page}{}{%
        \nointerlineskip%
        \insertvrule{.75\paperheight}{note page.bg}%
        \vskip-.75\paperheight%
    }%
    \vskip.25em
    \nointerlineskip
    \insertnote
}
\makeatother

\setbeamersize{text margin left=7mm,text margin right=7mm}
\usetheme[sectionpage=progressbar,subsectionpage=progressbar,progressbar=frametitle]{metropolis}
\usecolortheme{dove}
\useinnertheme{rectangles}

\setbeamertemplate{note page}[custom]
\setbeameroption{show notes on second screen=bottom}
\setbeamercolor{note title}{fg=black,bg=gray!30}
\setbeamercolor{note page}{fg=black,bg=white}
\setbeamerfont{note page}{size=\scriptsize}
\addtobeamertemplate{note page}{\setbeamerfont{itemize/enumerate subbody}{size=\scriptsize}}{}
\addtobeamertemplate{note page}{\setbeamerfont{itemize/enumerate subsubbody}{size=\tiny}}{}

\renewcommand*\footnoterule{}
\setbeamerfont{footnote}{size=\tiny}

%Font
\usepackage{fontspec}
\setmainfont{Segoe UI}
\usepackage{newtxmath}
\setmonofont{Roboto Mono}
\newfontfamily{\Sab}{SabonLTStd-Roman}
\setbeamerfont{note title}{family=\Sab}
\setbeamerfont{note page}{family=\Sab}
\let\sfdefault\rmdefault
%

%%
%Bold frametitle
\setbeamerfont{frametitle}{size=\Large,series=\bfseries}
%
%Bold block title
\setbeamerfont{block title}{series=\bfseries}
%
%%

\title{title}
\author{author}
\date{\today}

\begin{document}
    \begin{frame}[plain]
        \maketitle
        \note{This handout contains the slides used in the video and corresponding notes. Candidates are advised to use this handout as a supplement to the video lectures.}
    \end{frame}
    
    \begin{frame}
        content...
    \end{frame}
\end{document}

答案1

根据baskervillef文档中,该软件包附带了fontspec兼容的 OpenType 字体。因此,您的 TeX 发行版应该能够检测其默认文件路径内的字体。

因此,您需要做的就是用三行 Baskerville 替换三行 Sabon:

\newfontfamily{\baskerville}{baskervillef}
\setbeamerfont{note title}{family=\baskerville}
\setbeamerfont{note page}{family=\baskerville}

相关内容