Skip to content

Commit 7e62be2

Browse files
committed
Runtime: fix caml_gr_text_size (graphics)
1 parent c1e049a commit 7e62be2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

runtime/graphics.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,10 @@ function caml_gr_set_text_size(size){
379379

380380
//Provides: caml_gr_text_size
381381
//Requires: caml_gr_state_get
382-
function caml_gr_text_size(){
382+
function caml_gr_text_size(txt){
383383
var s = caml_gr_state_get();
384-
return s.text_size;
384+
var w = s.context.measureText(txt.toString()).width;
385+
return [0,w,s.text_size];
385386
}
386387

387388

0 commit comments

Comments
 (0)