New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: font packages #965
Comments
We already provide a lot of fonts in the standard bundle — at least, the ones that we are allowed to redistribute. The "problem" with a lot of other fonts is that we're legally disallowed from redistributing them in a packaged format. (I put that in scare-quotes since fonts are really hard and time-consuming to make and it's totally reasonable for a font creator to want to restrict access to it in various ways.) Do you have a particular example font in mind? |
I am using \setromanfont{Source Serif 4}
\setsansfont{Noto Sans}[BoldFont=* Bold]
\setmonofont{Source Code Pro} All of them are packaged by Arch Linux, so I think it should be no problem to also package them with tectonic. It looks like none of them are current available at tectonic, I had to install all of them manual at the ci. |
They are available, you just have to use the packages. TeX usually distributes fonts via packages. Here is eg Noto Sans: this - I assume - is also in the tectonic... package bundle if thats what you call it. It will be downloaded automatically just like the other packages. When looking at the fonts you have to ensure that they support Xe(La)TeX, I've seen a few fonts that wont, these wont se supported, otherwise, other than some verbose logging from the Roboto font package thats been addressed in another issue, and some fonts not being available as packages (notably the nerdfont variants which I use for stuff like language icons) I've not had issues. |
Hey @LuckyTurtleDev, thanks for the interesting issue! I believe it's a topic that has ramifications so I'm going to outline them: FormatsTeX Live uses its own font system called METAFONT. To be used natively fonts would have to be converted to that format. Using it would be like invoking any other package, e.g.: \usepackage{ebgaramond} Currently, in modern typography, TrueType (TTF) and OpenType (OTF) are the formats most used. So a bunch of people decided to make a package to use these formats: It requires XeLaTeX or LuaLaTeX, so you can't use it for pdfLaTeX, but it allows you to use the fonts installed in your system e.g.: \usepackage{fontspec}
\setmainfont{Adobe Garamond Pro} Both LuaLaTeX and XeLaTeX, have their own font lookup mechanisms when using ReproducibilityAnother aspect: reproducibility. Being LaTeX a high-quality typesetting system one starts thinking how interesting or important can be to reproduce a document content with its original format it was intended to. Part of this format can be, yes, fonts. Some of them have glyphs, ligatures or symbols that are different to others, and while it's a good praxis to use the already big and growing collection of built-in TeX Live symbols, eventually you'll find something that it's not there, or a shape you just like more in a font than another. One could just switch fonts, but it won't look the same, and thus it's not the same. Font licensing aside and the challenges it poses to reproduce sources and outputs, I'm quite fond of including additional domains to further improve reproducibility, and currently Usability and ImplementationWouldn't it be amazing if we could get the free fonts bundled, away from managing their installation and having a single tool (
SummaryIn the TeX Live world, its package manager While it's not an impossible thing to achieve, you can see the issue is a bit more involved than just bundling the fonts. |
I've not been able to make fontspec work with installed fonts on windows btw. If it is of interest, this is a project that uses a setup close to my current one: https://gitlab.rz.hft-stuttgart.de/02masa1bif/prog1tut_veranstaltung5 It should be open for public. In that case I download the nerdfont font ttf (or otf) files to the src directory before the build, that's been the only way I've been able to get it to run on Windows too. For now I've given up on keeping that directory free of noise with latex. Sadly could not find something like a CDN link, so who knows whether that link for downloading the font will stay online... I'm aware of the fontawsome symbol package, didn't have to time to look at all the other ways. Sadly fontawsome didn't have symbols for all languages. And the nerdfont patch includes fontawsome so once I decided for a nerdfont for the added symbols I got rid of fontawsome and instead created commands which allow easy access to the symbols I need, eg. \newcommand{\consoleicon}{{\large\ttfamily }} Where I copied the symbol from https://www.nerdfonts.com/cheat-sheet. |
@mnrvwl I did not expect that using a custom font would be so complex. I had though that it would simple be possible that tectonic can save the TTF/OTF to a folder and give fontspec a hint to check out also this font at this folder. @9SMTM6 I will define checkout out the package an ctan.org. I did not know that "normal" Latex can also package fonts. |
@LuckyTurtleDev If |
Maybe a merge request to fontec, witch add support to load additional fonts from paths/files definded by enviroment variables would solve this issue. Tectonic can download the fonts to the fontex folder and define the env before calling latex. Another option would be that tectonic install fonts at the os. But this must be implentated for each operating system. However tectonic should maybe check if the font is allready installed and not perform any action than. |
I assume that all fonts that are on CTAN (and hence in TeX Live - barring licensing). These include the ones mentioned above:
I can confirm that by do something like Great! Now how do I use them? Well, easily if I require the fonts by their file names. Then it is Tectonic that is able to match the paths (in its handling of TeX paths). Thus the following works: \documentclass{article}
\usepackage{fontspec}
\setromanfont{SourceSerifPro}[
Extension = .otf,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-RegularIt,
BoldItalicFont = *-BoldIt]
\setsansfont{NotoSans}[
Extension = .ttf,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-Italic,
BoldItalicFont = *-BoldItalic]
\setmonofont{SourceCodePro}[
Extension = .otf,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-RegularIt,
BoldItalicFont = *-BoldIt]
\begin{document}
\textrm{a} \textsf{b} \texttt{c}
\end{document} How did I find out how to set this up exactly like this? I executed variations on this: tectonic -X bundle search NotoSans | grep ttf | grep NotoSans- | grep -v -e Semi -e Extra -e Medium -e Thin -e Black -e Light
IMO this setup has quite a few advantages:
But:
For me personally even the last point is an advantage, because I like to have control (especially when different font packages would interact like in this noto / source serif/code case) and be explicit (perhaps the So why doesn't the below "obvious" work? \setromanfont{Source Serif 4}
\setsansfont{Noto Sans}[BoldFont=* Bold]
\setmonofont{Source Code Pro} Since these "font names" aren't "font file names", but real "font names" Tectonic can't easily map them directly to font files and take them from the "TeX bundle". The search thus falls back to XeTeX's logic of handling system fonts, which uses (at least on Linux) Fontconfig and your specific font config configuration files, which don't include Tectonic. Now what I have described is #9. Khaled Hosny has already offered a suggestion on how Tectonic can teach the system Fontconfig to also look for other font files. But AFAICT this would be really hard to apply to Tectonic's use case (downloading and caching the files from the internet, not having the files stored and indexed upfront). It is also possible that Tectonic uses other interfaces than Fontconfig on other operating systems (macOS, Windows). All in all: Solving #9 is hard. With the TeX model especially with many layers of abstraction I think that specifying fonts by file names rather than font names should be preferred (this bypasses any weird system library differences and also differences between XeTeX and LuaTeX). Packages (usually?) do use font file names, so you may find luck by just doing |
By the way: I think that Tectonic already distributes all fonts that it can (i.e. are uploaded to CTAN and their license allows it). So by that logic this issue is should be closed. Other than that #9 is already discussing the possibility use Tectonic fonts even when direct font file name mapping fails. But if the problem is now more clear, feel free to open more specific issues. (Including a MWE helps a lot.) |
@vlasakm thans your example does work, but it does also create a lots of warning:
|
Just to be sure: is it that the following works without warnings: \documentclass{article}
\usepackage{fontspec}
\setromanfont{SourceSerifPro}[
Extension = .otf,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-RegularIt,
BoldItalicFont = *-BoldIt]
\setsansfont{NotoSans}[
Extension = .ttf,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-Italic,
BoldItalicFont = *-BoldItalic]
\setmonofont{SourceCodePro}[
Extension = .otf,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-RegularIt,
BoldItalicFont = *-BoldIt]
\begin{document}
\textrm{a} \textsf{b} \texttt{c}
\end{document} and something like: \documentclass{article}
\usepackage{noto}
\usepackage{sourceserifpro}
\usepackage{sourcecodepro}
\begin{document}
\textrm{a} \textsf{b} \texttt{c}
\end{document} produces warnings like in your excerpt? In that case what you see what is #819 and #924. In short some font packages turn on tracing of fonts, which ultimately results in warnings in Tectonic (see the mentioned issues for details). This is gradually getting fixed in the packages, though it may take time before this hits Tectonic. |
I have do the following think, witch does look pretty similar:
|
TL;DR: Delete the lines: \usepackage{noto}
\usepackage{sourceserifpro}
\usepackage{sourcecodepro} I am not near a computer at the moment, though it looks like you are loading both the font packages ( You should only do one (the latter mostly overrides the former). And because To explain a bit more: what \setromanfont{NotoSerif}[
Extension = .ttf,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-Italic,
BoldItalicFont = *-BoldItalic]
\setsansfont{NotoSans}[
Extension = .ttf,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-Italic,
BoldItalicFont = *-BoldItalic]
\setmonofont{NotoSansMono}[
Extension = .ttf,
UprightFont = *-Regular,
BoldFont = *-Bold,
ItalicFont = *-Italic,
BoldItalicFont = *-BoldItalic] But it has options to let you control the weights, it also sets serif and mono fonts, etc. So even though the |
Thanks that has fix the warnings |
Similar to #965 (comment) I can reproduce the warnings here: ccebinger/CTAN_Inter#6 (comment). ccebinger/CTAN_Inter#6 (comment) suggest that it's because tectonic is using an older version of LaTeX. (here |
FWIW this issue is being tracked in #924 and the Inter font is mentioned as well.
It is great that the package got fixed! Unfortunately it is true, that Tectonic is using an old version of the package. Currently Tectonic uses TeX Live 2022 (as released on 2022-03-21) and the Inter got updated in TeX Live only on 2023-07-21. This unfortunately means that this update missed even TeX Live 2023 release (2023-03-13) and will get into TeX Live 2024 (expected March 2024). Tectonic has been lagging behind TeX Live releases, but with the great work in tectonic-typesetting/tectonic-texlive-bundles#14 updating Tectonic bundles to new TeX Live is getting much easier. Patching infrustructure has also improved there, so patching the font packages will be easier and hopefully we will get the fix there soon with the release of the Tectonic TeX Live 2023 bundle. |
In case it's of use to anyone on this thread (since a quick search on "tex live 2024" brought me here), the TeX Live 2024 ISO is available now via torrent and magnet link: https://www.texastim.dev/texlive/2024/03/12/texlive.html The usual official TeX Live "Acquiring TeX Live as an ISO image" web page isn't updated yet with the new torrent file, but that should happen in the next day or two (or so Karl Berry tells me). |
I think it would be a nice feature, if tectonic can also provide fonts as package and download it automatically. So the user must not install the font manual if it is not installed at the system.
This is would be very useful if you work on the same document with other inexperienced users, with does not use the same operating system.
The text was updated successfully, but these errors were encountered: