Is it possible to obtain total pixel scaling from a juce::Graphics?

I’m doing custom text rendering using FreeType, and the resultant image is painted into JUCE graphics context. To fully utilize FreeType, especially hinting and subpixel rendering, I have to tell FreeType the “correct” total pixel scaling, which should consider both screen DPI scaling and any potential scaling induced in component hierarchy or painting transform. So is it possible to obtain it directly from a given Graphics object (I thought it should have such knowledge), without accessing related components?

Would getPhysicalPixelScaleFactor work? You can get to this via getInternalContext of Graphics.

https://docs.juce.com/master/classLowLevelGraphicsContext.html#ab669e2dc4e4ec570685fb92fe963b9bd

any potential scaling induced in component hierarchy or painting transform

I’m not sure it will satisfy this criteria though.

1 Like

That enough. Thank you!