Different fonts sizes for different manuals with one stylesh

This forum is for all Flare issues related to styles, stylesheets and XML.
Post Reply
erinhill
Propeller Head
Posts: 23
Joined: Wed Aug 05, 2020 1:35 pm

Different fonts sizes for different manuals with one stylesh

Post by erinhill »

Hi. I'm outputting three different manuals from one Flare project. One manual needs to have a 14pt font (and headings need to coordinate with those) the other two I'd like to have 11pt or 12 pt font (with the headings adjusted for that size). Is there a way to do this with one stylesheet? Maybe I do a p_manualone and p_othermanuals (etc)? Would that be the way? Thanks in advance!
Nita Beck
Senior Propellus Maximus
Posts: 3667
Joined: Thu Feb 02, 2006 9:57 am
Location: Pittsford, NY

Re: Different fonts sizes for different manuals with one sty

Post by Nita Beck »

I have a similar requirement for one of my projects. I have one common stylesheet and two "override" stylesheets.

For example, say there is a user guide, quick reference guide, and setup guide. The biggest of these guides is the user guide, and so I create all the CSS for that guide in the "main" stylesheet. The user guide target points to that stylesheet.

The quick ref guides needs just a few things tweaked, so I have a quick ref guide "override" stylesheet, which imports everything from main and then just defines the few tweaks. The quick ref guide target points to the overrides stylesheet.

The setup guide also just needs a few things tweaked, so I have a setup guide "override" sheet...

From the writing perspective, the author gets to work with just one set of CSS styles while creating ccontent. No muss, no fuss.
Nita
Image
RETIRED, but still fond of all the Flare friends I've made. See you around now and then!
doloremipsum
Sr. Propeller Head
Posts: 290
Joined: Mon Aug 26, 2019 2:11 pm

Re: Different fonts sizes for different manuals with one sty

Post by doloremipsum »

I would do this using stylesheet mediums, if you're not using them already. For example, I have documentation content with 11pt font, and training content with larger font. I use a training medium with larger font on my stylesheet, and in the training targets I set the stylesheet medium in the Advanced tag.
in hoc foro dolorem ipsum amamus, consectimur, adipisci volumus.
NorthEast
Master Propellus Maximus
Posts: 6359
Joined: Mon Mar 05, 2007 8:33 am

Re: Different fonts sizes for different manuals with one sty

Post by NorthEast »

First, I'd suggest setting all font sizes in "em" units, as this means the font sizes are all relative.

In your main stylesheet, set the regular (smallest) font size on the body tag - so this is equal to 1em:

Code: Select all

body { font-size: 14pt; }
Then set any other font sizes in em units, so they're relative to the size set for the body:

Code: Select all

h1 { font-size: 4em; }
h2 { font-size: 2.5em; }
So if your body is set to 14pt, then:
h1 = 4x 14pt = 56pt
h2 = 2.5x 14pt = 35pt

So that's all the default sizes set in your main stylesheet.

Now, if you want to change this for a particular target, it means you only need to change the font-size in one place - the body tag - and all other font sizes will change in relation to that.

So to change that CSS in different target, you can use Nita's method, where the target uses a dedicated stylesheet that imports your main stylesheet and then includes any overrides for that target.
For example, you'd create a new stylesheet target-a.css (below), which is set as target A's primary/master stylesheet:

Code: Select all

@import url('main-stylesheet.css');
body { font-size: 12pt; }
This works because the CSS is processed in order - so CSS below the @import will override whatever's in the main stylesheet.

That changes the body to 12pt (overrides the 14pt), meaning 1em=12pt, so your other font sizes change as follows:
h1 = 4x 12pt = 48pt
h2 = 2.5x 12pt = 30pt

You can alternatively change the CSS on the body tag using mediums, but remember that you can only set one medium on a target, so you can't combine two mediums (like a 'print' medium and 'targetA' medium). So that'll only work if you never need to use mediums for anything else, like a 'print' medium for all print/PDF targets, that isn't used in any help targets.

If you also produce help targets, then using this method is also good for setting font sizes in the correct units for print and help targets, as you can specify the body font size in 'pt' units for print and 'px' units for help.
Post Reply