W3C home > Mailing lists > Public > www-style@w3.org > September 2010

Shouldn't fonts embedded through @font-face be available in <canvas>?

From: Adam Twardoch (List) <list.adam@twardoch.com>
Date: Sun, 26 Sep 2010 07:54:31 +0200
Message-ID: <4C9EE017.30502@twardoch.com>
To: www-font <www-font@w3.org>
CC: www-style <www-style@w3.org>
 I just tested, and none of the implementations (Webkit, Firefox, Opera)
of <canvas> allows the use of fonts embedded through @font-face to be
used within HTML canvas.

I was hoping that something like that would work:

<style type="text/css">
@font-face { font-family: "EnglSchr";
src:url("fonts/EnglSchr.ttf"); }
<canvas id="canvas" width="600" height="300"></canvas>
<script language="javascript">
var ctx = $('#canvas')[0].getContext("2d");
ctx.font = "20pt EnglSchr";
ctx.fillText("Hello World!", 10, 50); 
</script>

but it does not. A pity, because that would be very useful. Can you guys
forward the appropriate feature request?

Best,
Adam
Received on Sunday, 26 September 2010 06:48:27 GMT

This archive was generated by hypermail 2.3.1 : Tuesday, 26 March 2013 17:20:31 GMT