0

I am using Cascadia Code font as my tt font, and I wish to use Light series as upright font, LightItalic as italic font, Regular as bold font, and Italic as bold italic font.

I am not considering using setmonofont from fontspec package since it's annoying to carry ttf files. Instead, I am using casacdia-code package.

How to change default series only for ttfamily using cascadia-code package?

2
  • Welcome! Please provide a minimal compilable example and specify the engine you are using to compile.
    – cfr
    Sep 29 at 23:42
  • There isn't an italic or oblique. You can use Light for regular upright and Regular for bold upright, but you there's no italic in any weight as far as I can tell. That is, there's nothing defined for LaTeX - I didn't check the actual fonts.
    – cfr
    Sep 29 at 23:53

1 Answer 1

3

New(ish) versions of LaTeX provide an enhanced NFSS (i.e. a New New Font Selection Scheme) which allow you to specify different default weights for typewriter, sans and/or roman.

For example,

\DeclareFontSeriesDefault[tt]{bf}{m}
\DeclareFontSeriesDefault[tt]{md}{l}

changes the weight bold and regular series specifically for the typewriter family.

The following (typographically dubious) sample shows the result when Cascadia Code is used for typewriter, while the default Computer Modern is used for roman.

light and regular typewriter with medium and bold extended roman

Moreover, this is produced using just the standard \bfseries/\mdseries i.e. the regular Cascadia is used as bold typewriter and the light as regular, while the standard series are used for roman.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{cascadia-code}
\usepackage{kantlipsum}
\DeclareFontSeriesDefault[tt]{bf}{m}
\DeclareFontSeriesDefault[tt]{md}{l}
\begin{document}
\ttfamily
\kant[1]
\bfseries
\kant[2]
\rmfamily\mdseries
\kant[1]
\bfseries
\kant[2]
\end{document}

It is not possible to use Cascadia Code italics or oblique because these shapes are not available. So this answer fulfils your desiderata insofar as they are possible with cascadia-code and fails to fulfil them insofar as they are not. If they were available, you would not need to do anything additional to enable them. The two lines above switch the weight used for regular/bold typewriter of all shapes - upright, italic, oblique, small-caps, italic small-caps, oblique small-caps, swash, upright italic .... It just so happens the only shape available with Cascadia Code is upright.

2
  • Thanks for the answer! It's just tragic that the package does not contain italic fonts : (
    – cylee
    Sep 30 at 12:49
  • @cylee Are there italic fonts? As I say, I didn't look at the fonts themselves, but only the .fd files. It would be odd for italic to be omitted, if they exist. I think in that case, it would be worth contacting the package's maintainer requesting support for italic. If there are no such fonts, the package author has two options: fake oblique or omit oblique and italic altogether. In that case, you could request fake oblique, but do not be surprised if the request is refused. (Personally, I would refuse. II have a policy of not providing fake shapes or weights in my packages.)
    – cfr
    Sep 30 at 13:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .