Skip to content

Commit

Permalink
document color changes
Browse files Browse the repository at this point in the history
  • Loading branch information
u-fischer authored and zauguin committed Dec 18, 2023
1 parent 6c587d5 commit 2da7a80
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 4 deletions.
3 changes: 3 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ Change history
* added option verbose to undo silent/quiet
* euenc/tuenc options are obsolete
* TU is the only encoding
* added support for named colors from l3color
* support with lualatex spotcolors and cmyk colors in the pdf.

## v2.8a (2022/01/15)

* Add `SwashFont` and `BoldSwashFont` features to support LaTeX's now-builtin `\textsw`
Expand Down
52 changes: 48 additions & 4 deletions fontspec-doc-featset.tex
Original file line number Diff line number Diff line change
Expand Up @@ -351,17 +351,61 @@ \subsection{Colour}
\definecolor{Foo}{rgb}{0.3,0.4,0.5}
\fontspec[Color=Foo]{Verdana} ...
\end{Verbatim}
The \pkg{color} package is \emph{not} supported; use \pkg{xcolor} instead.

You may specify the transparency with a named colour using the \feat{Opacity}
feature which takes an decimal from zero to one corresponding to
transparent to opaque respectively:
You may also use named colours defined with the color commands of the L3
programming layer:
\begin{Verbatim}
\ExplSyntaxOn
\color_set:nnn{Foo}{rgb}{0.3,0.4,0.5}
\ExplSyntaxOff
...
\fontspec[Color=Foo]{Verdana} ...
\end{Verbatim}

Color expressions (\verb+red!50!blue+) are not supported. The \pkg{color}
package is \emph{not} supported neither.

The code will at first test for color names of the L3 layer, then for xcolor
names and at last try to use the argument as a hexadecimal value.

You may specify the transparency with a named colour using the \feat{Opacity}
feature which takes an decimal from zero to one corresponding to transparent
to opaque respectively:
\begin{Verbatim}
\fontspec[Color=red,Opacity=0.7]{Verdana} ...
\end{Verbatim}
It is still possible to specify a colour in six-char hexadecimal form
while defining opacity in this way, if you like.

\subsubsection{Color models}

With \XeTeX\ color are always written in the rgb color model into the PDF.
When using \LuaTeX, colors with the commands of the L3 layer can be written
as rgb or cmyk or as spot color depending on their definition and of the
value of the variable \verb+\l_color_fixed_model_tl+.

\subsubsection{Spot colors}
With \LuaTeX\ it is possible to use spot colors. This requires the use of the
PDF management:
\begin{Verbatim}
\DocumentMetadata{}
\documentclass{article}
\usepackage{fontspec}
\ExplSyntaxOn
\color_model_new:nnn { sepblue } { Separation }
{
name = PANTONE~3005~U ,
alternative-model = cmyk ,
alternative-values = {1, 0.56, 0,0},
}
\color_set:nnn{spotblue}{sepblue}{1}
\ExplSyntaxOff
...
\fontspec[Color=spotblue]{texgyreheros}
\end{Verbatim}



\subsection{Scale}

\cmdbox{
Expand Down

0 comments on commit 2da7a80

Please sign in to comment.