Is it possible to append switches to the existing settings for the TikZ font key?
For example, suppose that I want all nodes to be in the \sffamily typeface. This can be done by setting every node/.append style={font=\sffamily}. I might later wish to have a node that inherits the every node font settings and, additionally, uses the italic shape \itshape. Unfortunately, as the following shows, it does not work to simply add font=\itshape; doing so overrides the previous font setting, and the default type family (in italic) is used.
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[every node/.append style={font=\sffamily}]
\node {Sans serif};
\node [font=\itshape] at (3,0) {Sans serif, italic};
\end{tikzpicture}
\end{document}

Digging through the manual, I found the <key>/.append handler, which looked promising.
Key handler
<key>/.append={<append value>}
Adds the<append value>at the end of the value stored in<key>.
What if I used font/.append=\itshape? Well, this does not work either:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[every node/.append style={font=\sffamily}]
\node {Sans serif};
\node [font/.append=\itshape] at (3,0) {Sans serif, italic};
\end{tikzpicture}
\end{document}

Thus, I have two questions:
- Why does
font/.append=\itshapenot work here? - How can I append switches to the existing settings for
font?

font={\sffamily\itshape}. Actually you have to overwrite as they are not cumulative properties. – percusse Aug 24 '12 at 22:34font={\sffamily\itshape}, but what if I change theevery nodestyle to have, say,font=\ttfamily(or even some other typeface included via thefontspecpackage in XeLaTeX)? This way, I don't have to remember to also update thefontvalue for the second node. (I know, I know, I shouldn't be so greedy...:)) What I don't understand is why the value is stored in\tikz@textfontrather than directly in the key itself (i.e., use\pgfkeysvalueofto get the value). – Henry DeYoung Aug 25 '12 at 19:30[bold,italic]the result won't be bold and italic but just italic. Since each will call a different macro. Also the code goes into a box and immediately forgotten once the\nodeparttextboxis established. So pulling back the value is double difficult. – percusse Aug 25 '12 at 19:38\pgfkeysvalueofdoesn't work (i.e., that it's a/.codenot a/.style) makes sense. But isn't this a design decision in TikZ? Couldn't one imagine an alternate implementation of thefontkey that stores the value directly in the key rather than in a macro via the/.codehandler? Then, the imaginary implementation of\nodeparttextboxwould use\pgfkeysvalueof{/tikz/font}in place of\tikz@textfont. Would that implementation fail because some code goes into a box, as you point out? – Henry DeYoung Aug 25 '12 at 20:01/.prefix codeor/.append codeor more generally/.add codeas you did. But you have to keep in mind that anything complicated for pdflatex is also complicated for TikZ. I've asked a question about it : http://tex.stackexchange.com/questions/60778/fundamental-differences-pstricks-tikz-pgf-and-others – percusse Aug 25 '12 at 20:16/.add code(or/.prefix codeor/.append code) above, or did I? Sorry I'm being dense... – Henry DeYoung Aug 25 '12 at 21:54\itshapeetc. is added before the box content inside the box. That's what I meant. In short, which code should be put, is saved in these@populated macros. – percusse Aug 25 '12 at 22:28