Re: [css-text][css-fonts] preventing font fallback from ruining my monospace text's alignment

Hi Cam,

Rather than using new CSS features to solve your problem, I think the simplest and best approach here is simply to use a font that's designed for the set of characters you intend to use. Applying "effects" like this is always a second-rate option.

Cheers,

John


----- Original Message -----
From: "Cameron McCormack" <cam@mcc.id.au>
To: "www-style list" <www-style@w3.org>
Sent: Tuesday, October 21, 2014 2:35:13 PM
Subject: [css-text][css-fonts] preventing font fallback from ruining my monospace  text's alignment

I have a document that includes some code snippets in <pre> elements. 
Here is one:

   <pre>
   ...
       &lt;ex:arc from="n2" to="n3" label="Λ + c"/&gt;
   ...
   </pre>

It turns out that the font I am using for my code snippets doesn't have 
a glyph for the "Λ" character, and that the fallback font it ends up 
using has an advance that is a bit bigger than that of the surrounding 
characters.  This causes all the following characters to look 
misaligned, when looking at the lines above and below it.

Is there a way to prevent that from happening?  I feel like I want the 
ability to compress the "Λ" so that its advance is 1ch or perhaps to let 
it render at its slightly-bigger-than-I-want size but then place the 
following character where I expect it.

   pre { font-family: My Monospace Font; text-advance: 1ch compress; }

Received on Tuesday, 21 October 2014 07:34:14 UTC