text-font does not respect the font size argument
Closed this issue · 3 comments
It looks like it's defaulting to a very small font size, regardless of what is passed in as the argument. This works in WeScheme, so something must have broken in the Pyret port. Interestingly enough, the regular text
function does not have this problem, despite sharing the same underlying JS implementation!
The raw JS code looks identical to the WeScheme version, but I think the culprit may lie in the annotation checker. The wrapper for text
uses this checker:
c3("text", maybeString, runtime.String, maybeSize, annByte, maybeColor, annColor);
In contrast, the wrapper for text-font
uses this series of checkers:
c("text-font",
maybeString, runtime.String,
maybeSize, annByte,
maybeColor, annColor,
maybeFace, runtime.String,
maybeFamily, annFontFamily,
maybeStyle, annFontStyle,
maybeWeight, annFontWeight,
maybeUnderline, runtime.Boolean);
Why check the annotation differently?
Other than that, I don't see any reason for the different behavior. @blerner will likely have better insight than I.
Whoa. OK, I can only chalk this up to gremlins or my own creeping insanity.
I opened one of the Bootstrap example games and switched the context to use a newer file I'm working on. Changes made in that file were not reflected in the game (after the usual "publish, refresh, update-context, run" cycle), so eventually I tried to copy/pasting the examples from the documentation in the REPL and getting the same weird result.
But yeah, upon opening a fresh tab and doing the exact same thing, I'm now seeing the expected behavior. Sorry for the false alarm! (But I am curious why we use different annotations for size
in the two text
functions...)
I think you're misreading -- both maybeSize
arguments are checked as annByte
s. The checker functions are asking "does this possibly-valid-size value satisfy the annByte annotation?" The difference between c
and c3
are just the arities of the checking -- c3
is hard-coded to three argument/annotation pairings.