6

I would like to write a presentation title in the following manner:

enter image description here

The 3 font weights appear to be stacked one on top of the other. Is this possible to manage with Tikz?

11

REVISED ANSWER (including actual 3-weight font)

This revision actually simplifies things a bit, as I don't have to do pdfliteral tricks to change the font weight, but actually use a font (OpenSans) that has 3 font weights.

The new trick here was setting each font weight with letter spacing equivalent to the bold-weight spacing, for which I created the macro \boldwidth{}.

\documentclass{article}
\usepackage[default]{opensans}
\usepackage{stackengine,xcolor,trimclip}
\setstackgap{L}{0pt}
\setstackEOL{\\}
\newcommand\boldwidth[1]{\boldwidthaux#1\relax}
\def\boldwidthaux#1#2\relax{%
  \setbox0=\hbox{\fontseries{b}\selectfont#1}%
  \makebox[\wd0][c]{#1}%
  \ifx\relax#2\relax\else\boldwidthaux#2\relax\fi%
}
\begin{document}
\pagecolor{black!80}
\sffamily

\fontseries{l}\selectfont
\color{black!70}\savestack\light{\kern1pt\boldwidth{JUNCTION}}
\color{black}\savestack\lightA{LIGHT}

\fontseries{m}\selectfont
\color{black!50}\savestack\regular{\kern.1pt\rotatebox{3.5}{\clipbox{-1pt -1pt 0pt 4pt}{%
                                   \rotatebox{-3.5}{\boldwidth{JUNCTION}}}}\kern-.1pt}
\color{black}\savestack\regularA{REGULAR}

\fontseries{b}\selectfont
\color{black!30}\savestack\heavy{\clipbox{-1pt -1pt 0pt 5pt}{\boldwidth{JUNCTION}}}
\color{black}\savestack\heavyA{BOLD}

\stackunder[0pt]{\Longunderstack{\light\\\regular\\\heavy}}{%
  \scalebox{.15}{\lightA\qquad\regularA\qquad\heavyA}}
\end{document}

enter image description here

ORIGINAL ANSWER

Based on a simplified version of my part 2 answer at Have LaTeX document slowly transform/fade from one font into another, which employs pdfliteral magic provided by Malipivo at TikZ: halo around text?. That "stuff" allows me to set the color and thickness of the text, using pdf literal code. I threw away the part of those answers that dealt with automatically varying the transformation as a function of text length.

NOTE: if I had a font that could give me three separate weights directly, I would not need this pdfliteral stuff at all. Maybe someone could suggest a font.

Once I have the variable thickness/color texts, I create three versions in three different colors/weights, and then \trimclip them (with rotation as needed), and overlay them.

\documentclass{article}
\usepackage{xcolor,stackengine,trimclip}
%%%
\makeatletter
%%% MALIPIVO's PDF SPECIAL TO CHANGE FONT OUTLINE THICKNESS/COLOR
% https://tex.stackexchange.com/questions/18472/tikz-halo-around-text/169549#169549
\input pdf-trans
\newbox\qbox
\def\usecolor#1{\csname\string\color@#1\endcsname\space}
\newcommand\bordercolor[1]{\colsplit{1}{#1}}
\newcommand\fillcolor[1]{\colsplit{0}{#1}}
\newcommand\outline[1]{\leavevmode%
  \def\maltext{#1}%
  \setbox\qbox=\hbox{\maltext}%
  \boxgs{Q q 2 Tr \thickness\space w \fillcol\space \bordercol\space}{}%
  \copy\qbox%
}
\makeatother
\newcommand\colsplit[2]{\colorlet{tmpcolor}{#2}\edef\tmp{\usecolor{tmpcolor}}%
  \def\tmpB{}\expandafter\colsplithelp\tmp\relax%
  \ifnum0=#1\relax\edef\fillcol{\tmpB}\else\edef\bordercol{\tmpC}\fi}
\def\colsplithelp#1#2 #3\relax{%
  \edef\tmpB{\tmpB#1#2 }%
  \ifnum `#1>`9\relax\def\tmpC{#3}\else\colsplithelp#3\relax\fi
}
\bordercolor{black}
\fillcolor{black}
%%% BRUNO's \slantbox
% https://tex.stackexchange.com/questions/63179/shear-transform-a-box/63188#63188
\newsavebox\foobox
\newcommand{\slantbox}[2][.2]{\mbox{%
        \sbox{\foobox}{#2}%
        \hskip\wd\foobox
        \pdfsave
        \pdfsetmatrix{1 0 #1 1}%
        \llap{\usebox{\foobox}}%
        \pdfrestore
}}
%%%
\setstackgap{L}{0pt}
\setstackEOL{\\}
\begin{document}
\pagecolor{black}
\sffamily

\savestack\light{%
  \def\thickness{0.0}%
  \fillcolor{black!60}%
  \bordercolor{black!60}%
  \outline{JUNCTION}%
}

\savestack\medium{%
  \def\thickness{0.4}%
  \fillcolor{black!40}%
  \bordercolor{black!40}%
  \rotatebox{3}{\clipbox{0pt -1pt 0pt 4pt}{\rotatebox{-3}{\outline{JUNCTION}}}}%
}

\savestack\heavy{%
  \def\thickness{0.8}%
  \fillcolor{black!20}%
  \bordercolor{black!20}%
  \clipbox{0pt -1pt 0pt 5pt}{\outline{JUNCTION}}%
}

\Longunderstack{\light\\\medium\\\heavy}
\end{document}

enter image description here

  • The font from the image (completely free) can be found here: theleagueofmoveabletype.com/junction – jrojasqu Jan 13 '17 at 1:45
  • @jrojasqu I have revised the answer to use OpenSans, which has 3 font weights and is accessible via pdflatex. You should be able to adapt it to your font, if you use xelatex and sprinkle the answer with the proper xelatex incantations for changing the font weight. – Steven B. Segletes Jan 13 '17 at 1:55
3

I still have a problem with letter alignment but this is an initial solution with TikZ and microtype. As I don't know how to use microtype or even don't know if it's the way to solve the problem, so feel free to change it.

enter image description here

\documentclass[tikz,border=2mm]{standalone}
\usepackage[default]{opensans}
\usepackage{tikz}
\usepackage{microtype}

\begin{document}

\begin{tikzpicture}[font=\sffamily]

\node[minimum height=1cm, minimum width=3cm,
    fill=black!80, font=\fontseries{l}\selectfont, text=black!70] (A) {\textls[50]{JUNCTION}};

\begin{scope}
\clip ([yshift= -1pt]A.west)|-(A.south east)--([yshift= 4pt]A.east)--cycle;
\node[minimum height=1cm, minimum width=3cm,
    fill=none, font=\fontseries{m}\selectfont, text=black!50, anchor=south] (B) at (A.south) {\textls[25]{JUNCTION}};
\end{scope}

\begin{scope}
\clip ([yshift= -2pt]A.west)|-(A.south east)--([yshift= 1pt]A.east)--cycle;
\node[minimum height=1cm, minimum width=3cm,
    fill=none, font=\fontseries{b}\selectfont, text=black!30, anchor=south] (C) at (A.south) {JUNCTION};
\end{scope}

\end{tikzpicture}

\end{document}
  • Very good. I vote your question. Hi. – Sebastiano Jan 16 '17 at 9:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.