Scale fontsize as percentage of screenheight?

Hi,

Coming from WPF a technique often used there is to scale text relative to the screen height.

I’m trying to translate this to fusetools, but I’m stuck.

I’d like to do something like this

< Grid Rows=“10_,90_”> < Decorator ux:Name=“FontSizeRef” Row=“0”/> </ Grid >

< Text FontSize="{FontSizeRef.ActualHeight}>Test</ Text>

Is there a way to do this is in Fuse, or what approach do you recommend?

(The ux code in this post is really not formatting as I expected)

Hi,

This sort of binding will create a feedback loop and is therefore not possible in Fuse.

A way to acheive this today is to use Viewbox, it will scale its content to fill the available space:

<Grid Rows="10,90">
    <Viewbox>
        <Text FontSize="100">Test</Text>
    </Viewbox>
</Grid>

FontSize must simply be large “enough”, so i picked 100 here, assuming that’s larger than the maximum actual size you will display.

I’ve made ticket to investigate “better” ways to do this in the future. Thanks for posting!