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

Hi David,

No, you clearly can't predict coverage for a generic across the entire Unicode character range. Browsers attempt to do something but there's no *guarantee*, implicit or otherwise, that you'll end up "advances are the same for all glyphs". The concept of a 'monospace' font gets a bit dodgy for a lot of complex scripts.

The simple, practical solution is for authors to provide a font with their content rather than introducing more complexity to user agents. :)

Cheers,

John

----- Original Message -----
From: "David Singer" <singer@apple.com>
To: "www-style list" <www-style@w3.org>
Sent: Wednesday, October 22, 2014 5:13:07 PM
Subject: Re: [css-text][css-fonts] preventing font fallback from ruining my monospace  text's alignment


On Oct 21, 2014, at 9:33 , John Daggett <jdaggett@mozilla.com> wrote:

> 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.

true, but is it possible to predict the coverage of a ‘generic’ font like monospace? isn’t it likely to vary across platforms?  Perhaps doing a character-fallback from a font that has a certain ‘promise’ (e.g. monospacing in this case) to one that does not adhere to that promise is not helpful, unless some kind of adjustment step is taken?

> 
> 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; }
> 
> 

David Singer
Manager, Software Standards, Apple Inc.

Received on Wednesday, 22 October 2014 08:40:15 UTC