Since finding this post I’ve been fiddling round with dynamic fonts specifically on form fields.
So sharing a bit what I have set up so far.
First though for some reason if
rfs-base-font-size is not explicitly set (even if to default) then the fonts don’t resize. Note I use a “factor” so I know it’s bigger which according to docs should enable the resizing.
Secondly like @kosirm noted although useful it doesn’t adjust the related class properties (height, padding etc). That’s ok I suppose but the smaller font on smaller devices could have a smaller field box height saving precious vertical space and not look so wonky. Too classes like q-field__label need more bottom padding at smaller font size in order to keep the field content from running into the label.
Too looks like instead of using padding the field box height is controlled by the height parameter of
.q-field__control. So would have to be able to grab the computed font size in order to scale that number I suppose.
Bottom line is that quasar at this point is agnostic to the dynamic font size. So if the framework wants to support dynamic font size then just need easy ways to scale all the related classes/properties when the font size changes. One idea would be that the framework has variables for font-size of various components/elements (e.g. q-field). Then you set that dynamically or manually (with defaults) instead of messing with classes directly. Guess those variables can be part of the component rather than in the core. Then all related can be changed accordingly. Nothing in the core variables like that except
$input-font-size which gets ignored when wrapped in a field.
@import "../../node_modules/rfs/stylus" // rfs settable variables - commented are defaults $rfs-base-font-size = 1.25rem // $rfs-font-size-unit = rem $rfs-breakpoint = 1400px // $rfs-breakpoint-unit = px // $rfs-factor = 10 // $rfs-rem-value = 16 $rfs-two-dimensional = true // $rfs-class = false $field-font-factor = 1.3 $field-label-font-factor = 1 .q-field__native .q-item__label rfs($rfs-base-font-size * $field-font-factor) .q-field__label &.no-pointer-events rfs($rfs-base-font-size * $field-font-factor) .q-field__label rfs($rfs-base-font-size * $field-label-font-factor) padding-bottom .3em // needs to be dynamic based on font size .q-field__control // height ??px // needs to be computed based on font size.