# Condensed comment font in listings

I'm trying to condense the size of my comments by using a condensed font however its not working correctly.

The font shape looks fine with ttfamily enabled in basicstyle, however, there is a huge amount of space between the letters for comments. How can I get rid of this spacing?

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}

\begin{document}
hello :- world
% This is a comment
\end{lstlisting}
\end{document}


Edit: How do I get the source of this post to compile like I've seen in other threads?

-
Try columns=fullflexible. Since you're highlighting some Prolog code, you may also be interested in this answer of mine. – Jubobs Jun 14 '14 at 14:57
It is not a duplicate, because this question is about the spacing in comments only. Setting of columns for the whole listings affects the whole listings. – Heiko Oberdiek Jun 14 '14 at 16:12

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{listings}

\begin{document}
\begin{lstlisting}[language=Prolog,basicstyle=\ttfamily\footnotesize,
hello :- world
% This is a comment
\end{lstlisting}
\end{document}


Hijacking the answer, because the question is closed, when I was seconds from sending my anser. :-((((

A variation of Herbert's answer, which requires columns=fullflexible. The following example uses this setting for the comment only. Then other values of columns can be used, if vertical alignment is an issue and requires a less flexible setting for columns:

\documentclass{article}
\usepackage[a6paper]{geometry}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{listings}

\begingroup
\fontseries{lc}%
\fontshape{it}%
\selectfont
\lstset{columns=fullflexible}%
#1%
\endgroup
}

\begin{document}
\begin{lstlisting}[
language=Prolog,
basicstyle=\ttfamily,

BTW, if the vertical alignment requirements allow it, I would prefer fullflexible or at least flexible to fixed as value for columns. The text is much nicer to read. There is even a variable width typewriter font (family lmvtt or option variablett for package lmodern).