技术解读

以下内容由 GitRead 中文社区 编辑团队基于项目 README 与官方资料整理, 结合中文开发者的常见使用场景补充技术选型建议。具体以项目官方文档为准。

Sebschub/FontPro:完美的 LaTeX 字体支持方案

项目背景与痛点

在学术写作或专业文档制作中,LaTeX 一直是将内容与格式分离的首选工具。然而,Adobe 的专业的可扩展字体(例如 Minion Pro、Myriad Pro 和 Cronos Pro)在传统 LaTeX 环境中的集成并不完善,这直接导致了输出文档美观度和可读性上的不足。

为什么需要它?

  • 高质量排版:这些专业的字体提供了高质量的文字排版,尤其是在需要优雅设计的正式出版物中。
  • 跨平台一致性:确保在不同平台下输出的一致性,用户可以放心使用,不会因为平台差异而导致排版失准。
  • 兼容性:提供了广泛的支持,让学术文档、技术手册等的输出更自然、美观。

核心技术揭秘

技术架构

FontPro 解决了将 Adobe 专业字体无缝集成到 LaTeX 环境中的问题。核心在于一套定制化的风格文件,将字体与 LaTeX 的宏包完美对接。具体包括:

  • 字体支持文件:FontPro 提供了一系列的 .fd 和 .sty 文件,这些文件中定义了大量的字体命令。
  • TCPDF 流式字体映射:这允许来自 Adobe 的字体在图形文件中被正确渲染,适合生成包含复杂图形的文档。
  • 宏包集成:使用 \usepackage{} 自动加载所需字体,简化了开发者的工作。
架构图
graph TD A[LaTeX 文档编译] --> B("FontPro 宏包加载") B --> C("字体支持配置") C --> D[TCPDF 流式字体映射] C --> E[Adobe 字体文件支持] D --> F[图形渲染] E --> F F --> G[高质量输出]

通过使用 FontPro,Adobe 专业字体在复杂文档中的兼容性和排版效果得到了显著提升。

功能亮点与差异

FontPro 针对的是专业的出版领域,专业的字体如 Minion Pro、Myriad Pro 提供了强大的排版选项。Maximinum 字体尺寸的灵活设置和与 PDF 格式的完美结合,意味着这些字体的表现力可以覆盖更多的印刷需求。

竞品对比

与同类的字体支持项目相比,FontPro 的独特之处在于:

  • Professional Adobe 字体支持:直接支持更多 Adobe 豪华字体,用户直接使用,无需额外安装。
  • 格式兼容性:全面的 TCPDF 支持,一切文档的最终格式是 PDF,因此确保了输出的一致性和美观度。

应用场景与落地建议

生产环境使用建议

使用 FontPro 时要注意以下几点:

  • 字体文件:确保所有的字体文件都已正确安装在本地系统中。
  • 编译器配置:正确配置 LaTeX 编译器,以包含 FontPro 的宏包。
  • 格式支持:所有包含复杂图形的文档应生成为 PDF 格式,以确保最佳显示效果。

面向的应用场景

  • 学术论文:适用于要求高印刷质量的学术期刊和会议文章。
  • 技术手册:技术文档需要使用专业字体出自权威,给人可信的感觉。
  • 出版物:高质量的字体能够直接提升出版物的专业性和美观度。

综合评价

优点

  • 高质量输出:确保印刷级的质量,适用于专业出版。
  • 集成简便:用户通过简单的宏包加载即可体验专业字体效果。

缺点

  • 字体安装依赖:操作系统中的字体库未安装对应字体时,文档编译可能失败。

总的来说,FontPro 是现有最全面支持 Adobe 专业字体的 LaTeX 解决方案之一,适用于对文档输出质量要求极高的场景。

关于

GitHub 原始描述(英文)

LaTeX support for Adobe's Pro opentype fonts: Minion Pro, Myriad Pro, Cronos Pro and possibly more

描述取自 GitHub 官方 API,保持仓库作者书写的原文。

简要分析

热度分
356
价值分
163
活跃状态
活跃
暂无主题

语言占比

Batchfile
Perl
Prolog
Shell
TeX

README

FontPro source distribution

FontPro provides scripts that automatically generate all necessary files to use Adobe Minion Pro, Adobe Myriad Pro and Adobe Cronos Pro with (pdf)latex. In contrast to other solutions, the supplied LaTeX packages provide extensive math support in the case of Minion and Myriad. The swash letters of CronosPro can be used as mathcal symbols with MyriadPro’s math (option crswash).

Requirements

The scripts need the LCDF Typetools to run. Version 2.85 or later is required; certain recent font versions need version 2.99 or later. Furthermore, standard Unix tools such as bash, sed and ed are required and the following LaTeX packages, which are currently included in a complete TeXLive or MikTeX installation, are necessary:

  • fontinst v1.925 or better
  • fontaxes package
  • MnSymbol for MinionPro, MdSymbol for MyriadPro
  • fltpoint package
  • tabfigures package (optional)
  • fontware package (usually, but not always, comes with your Tex distribution)

Supported font styles

For the basic set-up (smallfamily LaTeX package option), the regular and bold face font are required together with their respective italic version. This set-up can be extended with the semibold face and its italic (medfamily option), and even further with the medium face and its italic (fullfamily option).

Furthermore, the optical sizes Caption, Text, Subhead and Display are supported independently from the set-up above (opticals option). Here, every font file has to be available in every optical size.

For Myriad Pro, also the light and the black weight can be used (see documentation).

Extended or condensed font styles are not supported.

Building

The following describes the build process. Here, $ at the beginning of the line indicates the shell command prompt. Under Windows, Cygwin is required; either install the LCDF type tools in Cygwin from source or install the texlive-font-fontutils package.

  1. Put the sources in a folder.

  2. Create an otf directory in that folder and copy your OpenType font files into the otf directory:

     $ mkdir otf
     $ cp /some/path/*.otf otf
    

    MinionPro and MyriadPro font files normally follow the naming scheme assumed in the scripts. Make sure that the CronosPro files are of the form

     $FONT-$WEIGHT$SHAPE$OPTICAL.otf
    

    resulting in for example

     CronosPro-BoldCapt.otf
     CronosPro-BoldDisp.otf
     CronosPro-BoldItCapt.otf
     CronosPro-BoldItDisp.otf
     CronosPro-BoldIt.otf
     CronosPro-BoldItSubh.otf
     CronosPro-Bold.otf
     CronosPro-BoldSubh.otf
     CronosPro-Capt.otf
     CronosPro-Disp.otf
     CronosPro-ItCapt.otf
     CronosPro-ItDisp.otf
     CronosPro-It.otf
     CronosPro-ItSubh.otf
     CronosPro-Regular.otf
     CronosPro-SemiboldCapt.otf
     CronosPro-SemiboldDisp.otf
     CronosPro-SemiboldItCapt.otf
     CronosPro-SemiboldItDisp.otf
     CronosPro-SemiboldIt.otf
     CronosPro-SemiboldItSubh.otf
     CronosPro-Semibold.otf
     CronosPro-SemiboldSubh.otf
     CronosPro-Subh.otf 
    
  3. Run the main script makeall:

     $ ./scripts/makeall $FONT [options]
    

    Currently, $FONT can be MinionPro, MyriadPro or CronosPro.

    makeall has some options, which normally you do not need to use.

     --verbose            show warning messages from otftotfm
     --quiet              omit these messages (default)
     --pack=<glyph-list>  explicitly name the glyph list
    

    The glyph list of the last option is used to reduce the number of generated files and the size of the map file. This speeds up the compilation slightly but does not affect the output. The default behaviour without the --pack option is to use the glyph list that fits to your font version; if this glyph list is not available in the scripts folder, it can be generated using generate-glyph-list.sh after a successful build. The --pack option can only be used if all you font files are of the same version.

    Furthermore, you can specify which metrics to create:

     --smallcaps          create small caps metrics (default)
     --nosmallcaps        turn --smallcaps off
     --swash              create swash metrics (default)
     --noswash            turn --swash off
     --greek              create greek metrics (default)
     --nogreek            turn --greek off
     --cyrillic           create cyrillic metrics (default)
     --nocyrillic         turn --cyrillic off
     --vietnamese         create vietnamese metrics (default)
     --novietnamese       turn --vietnamese off
     --expanded           create expanded metrics for pdftex
     --noexpanded         turn --expanded off (default)
     --kern               add some missing kerning pairs (default)
     --nokern             use the original Adobe kerning
     --ligatures          provide standard ligatures (default)
     --noligatures        provide no ligatures
     --wide-spacing       increase the sidebearings of quote glyphs
     --narrow-spacing     turn --wide-spacing off (default)
    

    The --expanded option allows to use the font expansion feature of microtype even with pdftex in dvi mode but increases the run-time of makeall and the number of produced files considerably.

Installing

Under Linux-like environments, use the following commands to install the font:

  1. Run the install script. The default folder is TEXMFLOCAL, which can be queried by kpsewhich -expand-var='$TEXMFLOCAL'.

     $ ./scripts/install 
    

    root permissions are usually required in TEXMFLOCAL. Alternatively, you can specify the directory where the files should be put, for example in TEXMFHOME. Depending on your system, this could look like

     $ ./scripts/install $HOME/texmf
    

    (If you use a TeX distribution older than 2005 which does not follow TDS v1.1, uncomment the “old directory folders” in the install script!)

  2. Add $FONT.map to the default font map files by

     $ updmap-sys --enable Map=$FONT.map
    

    for a system-wide installation. Use updmap or, on a recent TeXLive distribution, updmap-user instead of updmap-sys for a user-based installation.

Under Windows with MikTeX, do the following:

  1. Run in the Cygwin Bash

     $ ./scripts/install /cygdrive/c/path/to/Miktex
    

    where c/path/to/Miktex is the path to the Miktex installation tree of choice.

  2. In the Windows prompt, issue

     initexmf -u
     initexmf --admin --edit-config-file updmap
    

    Add the following in the editor:

     Map $FONT.map
    

    and save. Afterwards, run

     initexmf --mkmaps
    

Cleaning up of the building folder

If you want to install another font, it is recommended to do a

$ ./scripts/clean

or to start from a fresh building folder.

Usage

Use the FONT with

\usepackage{FONT}

By default, the MinionPro package modifies the default serif and the main math fonts; the MyriadPro and CronosPro change only the sans serif font. In the latter case, if you want to use the respective font as your main document’s font, you probably have to set

\renewcommand{\familydefault}{\sfdefault}

All valid options of the font packages are included in the documentation, which is provided in the doc folder and which can also be generated after installing with

latex $FONT.dtx

The dtx file resides in the tex folder.

If you get errors about insufficient memory you might need to increase the values of font_mem_size and font_max in your TeX configuration. For most distributions, these can be changed in the file texmf/web2c/texmf.cnf. For MiKTeX the file is called miktex.ini.

Maintainer and acknowledgement

The scripts and LaTeX packages are maintained by Sebastian Schubert [email protected].

They have been forked from the amazing MinionPro scripts and package written by Achim Blumensath, Andreas Bühmann and Michael Zedler.

The part of this README concerning Cygwin is based on this entry.

All files are public domain.

评论

暂无评论