diff options
| author | Florian Fischer <florian.fischer@muhq.space> | 2021-10-07 14:38:26 +0200 |
|---|---|---|
| committer | Florian Fischer <florian.fischer@muhq.space> | 2021-10-07 14:40:29 +0200 |
| commit | 67976bc7f5e7768f5ab7b92a1f5b648eaf03e111 (patch) | |
| tree | 9e13b60e6cec77cbede64f8d7a9759f97335c307 | |
| parent | bbf80cb49383f8cac6625a8ca8f0adc3367974a7 (diff) | |
| download | muhqs-game-67976bc7f5e7768f5ab7b92a1f5b648eaf03e111.tar.gz muhqs-game-67976bc7f5e7768f5ab7b92a1f5b648eaf03e111.zip | |
[tikzcards] shrink to large left strip text and reformat latex
| -rw-r--r-- | latex/libs.tex | 2 | ||||
| -rw-r--r-- | latex/tikzcards.tex | 170 |
2 files changed, 130 insertions, 42 deletions
diff --git a/latex/libs.tex b/latex/libs.tex index 43ad3456..0775091e 100644 --- a/latex/libs.tex +++ b/latex/libs.tex @@ -18,6 +18,8 @@ \usetikzlibrary{shadows} \usetikzlibrary{fit, calc} % for getnodedim macro +\usepackage{etoolbox} + \usepackage{xparse} % for getnodedim macro \usepackage{csquotes} diff --git a/latex/tikzcards.tex b/latex/tikzcards.tex index 59ad59c2..08bca480 100644 --- a/latex/tikzcards.tex +++ b/latex/tikzcards.tex @@ -9,19 +9,51 @@ \pgfmathsetmacro{\stripwidth}{0.7} \pgfmathsetmacro{\strippadding}{0.2} \pgfmathsetmacro{\textpadding}{0.1} -\pgfmathsetmacro{\titley}{\cardheight-\strippadding-1.5*\textpadding-0.5*\stripwidth} -\pgfmathsetmacro{\contentTextWidth}{(\cardwidth-2*\strippadding-\stripwidth-2*\textpadding-0.3)*1cm} -\pgfmathsetmacro{\contentLeft}{2*\strippadding + \stripwidth + \textpadding} -\pgfmathsetmacro{\contentBottom}{1 + \textpadding} +\pgfmathsetmacro{\titley}{ + \cardheight - \strippadding - 1.5 * \textpadding - 0.5 * \stripwidth +} +\pgfmathsetmacro{\contentTextWidth}{ + (\cardwidth - 2* \strippadding - \stripwidth - 2* \textpadding - 0.3) * 1cm +} +\pgfmathsetmacro{\contentLeft}{2* \strippadding + \stripwidth + \textpadding} +\pgfmathsetmacro{\stripShortHeight}{1} +\pgfmathsetmacro{\contentBottom}{\stripShortHeight + \textpadding} +\pgfmathsetmacro{\leftStripLongHeight}{ + \cardheight - (3 * \strippadding) - \stripShortHeight +} +\pgfmathsetmacro{\leftStripTextXCoord}{\strippadding + 0.5 * \stripwidth} +\pgfmathsetmacro{\costXCoord}{\cardwidth - 0.5 * \stripwidth - \strippadding} % Formen der einzelnen Kartenelemente/-bestandteile -\def\shapeCard{(0,0) rectangle (\cardwidth,\cardheight)} -\def\shapeLeftStripLong{(\strippadding,-\strippadding) rectangle (\strippadding+\stripwidth,\cardheight-\strippadding-\strippadding-1)} -\def\shapeLeftStripShort{(\strippadding,\cardheight-\strippadding-1) rectangle (\strippadding+\stripwidth,\cardheight+\strippadding)} -\def\shapeRightStripShortHigh{(\cardwidth-\stripwidth-\strippadding,\cardheight-\strippadding-1) rectangle (\cardwidth-\strippadding,\cardheight+\strippadding)} -\def\shapeRightStripShortLow{(\cardwidth-\stripwidth-\strippadding,-\strippadding) rectangle (\cardwidth-\strippadding,1)} -\def\shapeTitleArea{(2*\strippadding+\stripwidth,\cardheight-\strippadding) rectangle (\cardwidth-2*\strippadding-\stripwidth,\cardheight-2*\stripwidth)} +\def\shapeCard{(0,0) rectangle (\cardwidth, \cardheight)} +\def\shapeLeftStripLong{ + (\strippadding, -\strippadding) + rectangle + (\strippadding + \stripwidth, + \cardheight - \strippadding - \strippadding - \stripShortHeight) +} +\def\shapeLeftStripShort{ + (\strippadding, \cardheight - \strippadding - \stripShortHeight) + rectangle + (\strippadding + \stripwidth, \cardheight + \strippadding) +} +\def\shapeRightStripShortHigh{ + (\cardwidth - \stripwidth - \strippadding, + \cardheight - \strippadding - \stripShortHeight) + rectangle + (\cardwidth - \strippadding, \cardheight + \strippadding) +} +\def\shapeRightStripShortLow{ + (\cardwidth - \stripwidth - \strippadding, -\strippadding) + rectangle + (\cardwidth - \strippadding, \stripShortHeight) +} +\def\shapeTitleArea{ + (2 * \strippadding + \stripwidth, \cardheight - \strippadding) + rectangle + (\cardwidth - 2 * \strippadding - \stripwidth, \cardheight - 2 * \stripwidth) +} % macro to get the height of an node @@ -77,42 +109,72 @@ % arg4: Text for left stripe % arg5: Title \newcommand{\cardtype}[5]{ - % First we fill the intersecting area - % The \clip command does not allow options, therefore - % we have to use a scope to set the even odd rule. + % First we fill the intersecting area + % The \clip command does not allow options, therefore + % we have to use a scope to set the even odd rule. \begin{scope}[even odd rule] - % Define a clipping path. All paths outside shapeCard will - % be cut because the even odd rule is set. + % Define a clipping path. All paths outside shapeCard will + % be cut because the even odd rule is set. \clip[cardcorners] \shapeCard; + % Fill shapeLeftStripLong and shapeLeftStripShort. - % Since the even odd rule is set, only the card will be filled. - \fill[strip,#1] \shapeLeftStripLong node[rotate=90,above left=0.9mm,font=\normalsize] { - \color{white}\uppercase{#4 - #2} - }; - \fill[strip,#1] \shapeLeftStripShort; + % Since the even odd rule is set, only the card will be filled. + \fill[strip, #1] \shapeLeftStripLong; + \fill[strip, #1] \shapeLeftStripShort; \end{scope} - \node at (\strippadding+0.5*\stripwidth,\cardheight-\strippadding-\strippadding-0.37) {\color{white}#3}; + \node(leftStripTextInvisible) at (\leftStripTextXCoord, \leftStripLongHeight - \strippadding) + [rotate=90, anchor=east, font=\normalsize, opacity=0] { + \uppercase{#4 - #2} + }; + + \getnodedimen{leftStripTextInvisible} + + \node(leftStripText) at (\leftStripTextXCoord, \leftStripLongHeight - \strippadding) + [rotate=90, anchor=east, font=\normalsize] { + \color{white} + \ifdimgreater{\nodeheight}{\leftStripLongHeight cm - (\leftStripLongHeight cm / 4)} + {{\small \uppercase{#4 - #2}}} + {\uppercase{#4 - #2}} + }; + + \node at (\leftStripTextXCoord, \cardheight - \strippadding - \strippadding - 0.37) { + \color{white}#3 + }; \cardtitle{#5} } -\newcommand{\cardtypeUnitToken}[1]{\cardtype{tokenbg}{Unit}{\LARGE\sympawn}{TOKEN}{{\Large TOKEN} \\ #1}} + +% Known card types +\newcommand{\cardtypeUnitToken}[1]{ + \cardtype{tokenbg}{Unit}{\LARGE\sympawn}{TOKEN}{{\Large TOKEN} \\ #1} +} \newcommand{\cardtypeUnit}[1]{\cardtype{unitbg}{Unit}{\LARGE\sympawn}{#1}{#1}} -\newcommand{\cardtypeSpellToken}[1]{\cardtype{tokenbg}{Spell}{\Large\faBolt}{TOKEN}{{\Large TOKEN} \\ #1}} +\newcommand{\cardtypeSpellToken}[1]{ + \cardtype{tokenbg}{Spell}{\Large\faBolt}{TOKEN}{{\Large TOKEN} \\ #1} +} \newcommand{\cardtypeSpell}[1]{\cardtype{spellbg}{Spell}{\Large\faBolt}{#1}{#1}} -\newcommand{\cardtypeArtifactToken}[1]{\cardtype{tokenbg}{Artifact}{\LARGE\decoone}{TOKEN}{{\Large TOKEN} \\ #1}} -\newcommand{\cardtypeArtifact}[1]{\cardtype{artifactbg}{Artifact}{\LARGE\decoone}{#1}{#1}} +\newcommand{\cardtypeArtifactToken}[1]{ + \cardtype{tokenbg}{Artifact}{\LARGE\decoone}{TOKEN}{{\Large TOKEN} \\ #1} +} +\newcommand{\cardtypeArtifact}[1]{ + \cardtype{artifactbg}{Artifact}{\LARGE\decoone}{#1}{#1} +} -\newcommand{\cardtypeEquipmentToken}[1]{\cardtype{tokenbg}{Equipment}{\huge\dag}{TOKEN}{{\Large TOKEN} \\ #1}} -\newcommand{\cardtypeEquipment}[1]{\cardtype{equipmentbg}{Equipment}{\huge\dag}{#1}{#1}} +\newcommand{\cardtypeEquipmentToken}[1]{ + \cardtype{tokenbg}{Equipment}{\huge\dag}{TOKEN}{{\Large TOKEN} \\ #1} +} +\newcommand{\cardtypeEquipment}[1]{ + \cardtype{equipmentbg}{Equipment}{\huge\dag}{#1}{#1} +} % Titel der Karte \newcommand{\cardtitle}[1]{ %\draw[pattern=soft crosshatch,rounded corners=0.1cm] \shapeTitleArea; - \fill[elementcorners,titlebg,opacity=.85] \shapeTitleArea; - \node[text width=3.75cm] at (0.5*\cardwidth,\titley) { + \fill[elementcorners, titlebg, opacity=.85] \shapeTitleArea; + \node[text width=3.75cm] at (0.5 * \cardwidth, \titley) { \begin{center} \color{white}\uppercase{\normalsize #1} \end{center} @@ -126,7 +188,11 @@ % \end{scope} % draw content node just to get its dimensions - \node(content)[above right, minimum width=\cardwidth, text width=\contentTextWidth] at (\contentLeft, \contentBottom) { + \node(content)[ + above right, + minimum width=\cardwidth, + text width=\contentTextWidth + ] at (\contentLeft, \contentBottom) { \textit{\normalsize #1} \vrule width \textwidth height 2pt \\[-2pt] \vspace{0.2cm} @@ -135,10 +201,20 @@ % draw content background using dimensions of the content node \getnodedimen{content} - \node[fill=contentbg, above right, elementcorners, minimum height=\nodeheight, minimum width=\nodewidth + 1] at (\contentLeft - \textpadding, \contentBottom) {}; + \node[ + fill=contentbg, + above right, + elementcorners, + minimum height=\nodeheight, + minimum width=\nodewidth + 1 + ] at (\contentLeft - \textpadding, \contentBottom) {}; % redraw content so it is on top of the background - \node()[above right, minimum width=\cardwidth, text width=\contentTextWidth] at (\contentLeft, \contentBottom) { + \node[ + above right, + minimum width=\cardwidth, + text width=\contentTextWidth + ] at (\contentLeft, \contentBottom) { \textit{\normalsize #1} \vrule width \textwidth height 2pt \\[-2pt] \vspace{0.2cm} @@ -151,17 +227,26 @@ % \begin{scope}[even odd rule] % \clip[cardcorners] \shapeCard; % \end{scope} - \node(content)[above right, text width=\contentTextWidth] at (\contentLeft, \contentBottom) { - \textit{\normalsize #1} + \node(content)[ + above right, + text width=\contentTextWidth + ] at (\contentLeft, \contentBottom) { + {\normalsize #1} }; % draw content background using dimensions of the content node \getnodedimen{content} - \node[fill=contentbg, above right, elementcorners, minimum height=\nodeheight, minimum width=\nodewidth + 1] at (\contentLeft - \textpadding, \contentBottom) {}; + \node[ + fill=contentbg, + above right, + elementcorners, + minimum height=\nodeheight, + minimum width=\nodewidth + 1 + ] at (\contentLeft - \textpadding, \contentBottom) {}; % redraw content so it is on top of the background \node[above right, text width=\contentTextWidth] at (\contentLeft, \contentBottom) { - \textit{\normalsize #1} + {\normalsize #1} }; } @@ -169,22 +254,23 @@ \newcommand{\cardbuycost}[1]{ \begin{scope}[even odd rule] \clip[cardcorners] \shapeCard; - \fill[strip,pricebg] \shapeRightStripShortHigh; + \fill[strip, pricebg] \shapeRightStripShortHigh; \end{scope} - \node at (\cardwidth-0.5*\stripwidth-\strippadding,\titley-\textpadding) {\color{black}#1}; + \node at (\costXCoord, \titley - \textpadding) {\color{black}#1}; } % Playing cost \newcommand{\cardplaycost}[1]{ \begin{scope}[even odd rule] \clip[cardcorners] \shapeCard; - \fill[strip,playbg] \shapeRightStripShortLow; + \fill[strip, playbg] \shapeRightStripShortLow; \end{scope} - \node at (\cardwidth-0.5*\stripwidth-\strippadding, \strippadding+\strippadding) {\color{black}#1}; + \node at (\costXCoord, \strippadding + \strippadding) {\color{black}#1}; } % Module containing the card \newcommand{\cardmodule}[1]{ - - \node[rotate=90, right] at (\strippadding+0.5*\stripwidth, \strippadding+\strippadding) {\color{black}#1}; + \node[rotate=90, right] at + (\strippadding + 0.5 * \stripwidth, \strippadding + \strippadding) + {\color{black}#1}; } |
