W3C home > Mailing lists > Public > www-style@w3.org > May 2014

[css-font-loading] Suggestions for new features

From: Joćo Eiras <joaoe@opera.com>
Date: Tue, 06 May 2014 16:13:16 +0200
To: www-style@w3.org
Message-ID: <op.xffy4epqm7930f@localhost>

I stumbled upon the draft for CSS Font Loading and was happy to see it  
given I
had some related ideas some time ago.

I see the spec handles only loading of fonts, and suggest for it to  
extended to
incorporate the following features and use cases.

a) font enumeration. The main use case are WYSIWYG editors, which would  
give the
user to option to style the text with which ever fonts he/she has  
available in
the browser. Both system fonts and web fonts could be enumerated. This  
also relieve the web developer of having to keep track of the set of web  
that the web page is using. Would perhaps as simple as extending  
     readonly attribute unsigned long length;
     getter FontFace item(unsined long index);
     getter FontFace namedItem(DOMString fontFamily);

So for instance document.fonts["MyFont"] would return as web font I added  
it's loaded, and document.fonts.monospace would return a FontFace object  
Courier (for instance) or my web font if I overrode 'monospace'. The nice  
with namedItem() is that it would unalias font names. The FontFace  
would then need a flag to tell whether it's a web font or not.

b) font loading, unloading. The API already has font loading. Adding a
unload/disable feature would be an expected symmetrical feature for  
sake, similar to deleting the @font-face rule.

c) the set of glyphs and glyph geometry. This is specially welcome for  
apps or
games trying to do their own fine grained text layout or manipulation (like
letter animation) in canvas or SVG. Would perhaps be as simple as querying
whether a glyph exists for a given unicode code point and returning the  
that make up the font (or bitmap, but no one uses bitmap fonts anymore).

Something like
     boolean hasGlyph(unsigned int unicodeCodePoint)
     FontFaceGlyph getGlyph(unsigned int unicodeCodePoint)

Thoughts ?
Received on Tuesday, 6 May 2014 14:13:52 UTC

This archive was generated by hypermail 2.4.0 : Friday, 25 March 2022 10:08:42 UTC