[Tex/LaTex] Set the font of the caption in a subfigure to the same of the figure

fontssubfloats

I am writing a paper using the IEEEtranTIE template (provided by IEEE Transaction on Industrial Electronics).

They slightly modified the IEEEtran template and one of the edits is a change in the caption font.

To obtain the information about the fonts I used the following macro:

\makeatletter
\newcommand{\showfont}{
    Encoding: \f@encoding{},
    Family: \f@family{},
    Series: \f@series{},
    Shape: \f@shape{},
    Size: \f@size{}.
}
\makeatother

Using \caption{\showfont} I get Encoding: T1, Family: phv, Series: m, Shape: n, Size: 8.
When I add a subfigure using the subcaption package as indicate by IEEEtran

\makeatletter
\let\MYcaption\@makecaption
\makeatother
\usepackage[labelformat=simple,font=footnotesize]{subcaption}
\makeatletter
\let\@makecaption\MYcaption
\renewcommand{\thesubfigure}{(\roman{subfigure})}
\makeatother

and I write a caption in a sub figure I get a different family.
\subcaption{\showfont} gives Encoding: T1, Family: ptm, Series: m, Shape: n, Size: 8..
In order to have a consistent look&feel I would like to set the same font family (phv) but slightly smaller (7).
How can be this obtained?

As a side question, is it possible to obtain a font of a certain environment and to assign it to an another environment?

Something like (pseudo-code):

\edef\subcaptionfont\captionfont

or (to be honest I still struggle to understand when to use \the):

\edef\subcaptionfont{\the\captionfont}

Possibly with also the ability to change some fields, like size or font family.

A MWE (the IEEEtranTIE class can be downloaded from the link above):

\documentclass[journal]{IEEEtranTIE}
\usepackage[pdftex,demo]{graphicx}
\usepackage{lipsum}

\makeatletter
\let\MYcaption\@makecaption
\makeatother

\usepackage[labelformat=simple,font=footnotesize]{subcaption}

\makeatletter
\let\@makecaption\MYcaption
\renewcommand{\thesubfigure}{(\roman{subfigure})}
\makeatother

\makeatletter
\newcommand{\showfont}{
    Encoding: \f@encoding{},
    Family: \f@family{},
    Series: \f@series{},
    Shape: \f@shape{},
    Size: \f@size{}.
}
\makeatother


\title{Title}

\author{Author}

\begin{document}
\maketitle

\begin{abstract}
\lipsum[1-2]
\end{abstract}

\section{title}
\lipsum[1-3]

\begin{figure}[h]
\begin{subfigure}{\columnwidth}
    \includegraphics[width=\textwidth]{dummy}
    \subcaption{\showfont}
    \label{fig1}
\end{subfigure}
\caption{\showfont}
\label{fig0}
\end{figure}

\end{document}

–EDIT–
With the help of @TeXnician I was able to get the desired result.
The result is obtained by changing the part where subcaption is loaded, namely

\usepackage[labelformat=simple,font=footnotesize]{subcaption}

with

\usepackage[labelformat=simple]{subcaption}
\DeclareCaptionFont{myfont}{\fontfamily{phv}\scriptsize\sele‌​ctfont}
\captionsetup[sub]{font=myfont}

The last part of the question is still valid and can be rephrased as follows.

Is it possible to set the subcaption font to inherit the same of the caption using something similar to (but not a working example since \thecaptionfont is not a valid command):

\usepackage[labelformat=simple]{subcaption}
\DeclareCaptionFont{myfont}{\thecaptionfont\scriptsize\selec‌​tfont}
\captionsetup[sub]{font=myfont}

?

Best Answer

In my opinion, you shouldn't use caption or subcaption with that class.

Anyway, since the font used in captions is \footnotesize\sffamily, you can get away with

\documentclass[journal]{IEEEtranTIE}
\usepackage[demo]{graphicx}
\usepackage{lipsum}

\makeatletter
\let\MYcaption\@makecaption
\makeatother

\usepackage[labelformat=simple,font={footnotesize,sf}]{subcaption}

\makeatletter
\let\@makecaption\MYcaption
\renewcommand{\thesubfigure}{(\roman{subfigure})}
\makeatother

\makeatletter
\newcommand{\showfont}{
    Encoding: \f@encoding{},
    Family: \f@family{},
    Series: \f@series{},
    Shape: \f@shape{},
    Size: \f@size{}.
}
\makeatother


\title{Title}

\author{Author}

\begin{document}
\maketitle

\begin{abstract}
\lipsum[1-2]
\end{abstract}

\section{title}
\lipsum[1-3]

\begin{figure}[h]
\begin{subfigure}{\columnwidth}
    \includegraphics[width=\textwidth]{dummy}
    \subcaption{\showfont}
    \label{fig1}
\end{subfigure}
\caption{\showfont}
\label{fig0}
\end{figure}

\end{document}

enter image description here

Here is the setup with subfig, which is compatible with the class.

\documentclass[journal]{IEEEtranTIE}
\usepackage[demo]{graphicx}
\usepackage{lipsum}

\usepackage[caption=false]{subfig}

\captionsetup[subfloat]{font={footnotesize,sf}}

\makeatletter
\newcommand{\showfont}{
    Encoding: \f@encoding{},
    Family: \f@family{},
    Series: \f@series{},
    Shape: \f@shape{},
    Size: \f@size{}.
}
\makeatother


\title{Title}

\author{Author}

\begin{document}
\maketitle

\begin{abstract}
\lipsum[1-2]
\end{abstract}

\section{title}
\lipsum[1-3]

\begin{figure}[htp]
\subfloat[\showfont\label{fig1}]{%
  \includegraphics[width=\columnwidth]{dummy}%
}
\caption{\showfont}
\label{fig0}
\end{figure}

\end{document}

The output is the same.