Widget.mIconExtraScale

The amount of extra icon scaling used in addition the the theme's default icon font scale. Default value is `1.0`, which implies that icon_scale simply returns the value of nanogui.Theme.mIconScale.

Most widgets do not need extra scaling, but some (e.g., CheckBox, TextBox) need to adjust the Theme's default icon scaling nanogui.Theme.mIconScale to properly display icons within their bounds (upscale, or downscale).

Summary:

When using nvgFontSize for icons in subclasses, make sure to call the icon_scale function. Expected usage when *drawing* icon fonts is something like:

void draw(NanoContext ctx)
{
    // fontSize depends on the kind of `Widget`.  Search for `FontSize`
    // in the `Theme` class (e.g., standard vs button)
    float ih = fontSize;
    // assuming your Widget has a declared `mIcon`
    if (isFontIcon(mIcon)) {
        ih *= icon_scale();
        ctx.fontFace("icons");
        ctx.fontSize(ih);
        /// remaining drawing code (see button.d for more)
    }
}
class Widget
protected
float mIconExtraScale;

Meta