Class GuiMeasureContext
java.lang.Object
com.render.api.gui.GuiMeasureContext
Public, read-only measurement surface for custom retained components.
All lengths use the host's design pixels. Text measurement follows the host's font policy and the same shaping and wrapping routes as painting. The host reuses this context; it is valid only during a measurement callback and must not be retained. Measurement callbacks should return sizes without modifying the component tree.
-
Method Summary
Modifier and TypeMethodDescriptionfloatlayoutText(GuiRichText text, GuiTextConstraints constraints) Shapes rich text and returns immutable metrics and caret/selection geometry.floatmeasureTextHeight(String text, GuiPaintContext.TextOptions options) Measures a literal string's height, including wrapped lines when a maximum width is supplied.floatmeasureTextHeight(net.minecraft.network.chat.Component text, GuiPaintContext.TextOptions options) Measures a styled Minecraft text value's height.floatmeasureTextWidth(String text, GuiPaintContext.TextOptions options) Measures a literal string using the public paint options, including their wrapping width.floatmeasureTextWidth(net.minecraft.network.chat.Component text, GuiPaintContext.TextOptions options) Measures a styled Minecraft text value using the same options as custom paint.doublefloatfloat
-
Method Details
-
viewportWidth
public float viewportWidth()- Returns:
- host viewport width in design pixels
-
viewportHeight
public float viewportHeight()- Returns:
- host viewport height in design pixels
-
deviceScale
public float deviceScale()- Returns:
- physical pixels per design pixel
-
timeSeconds
public double timeSeconds()- Returns:
- the host's current controlled animation sample
-
measureTextWidth
Measures a literal string using the public paint options, including their wrapping width. -
measureTextWidth
public float measureTextWidth(net.minecraft.network.chat.Component text, GuiPaintContext.TextOptions options) Measures a styled Minecraft text value using the same options as custom paint. -
measureTextHeight
Measures a literal string's height, including wrapped lines when a maximum width is supplied. -
measureTextHeight
public float measureTextHeight(net.minecraft.network.chat.Component text, GuiPaintContext.TextOptions options) Measures a styled Minecraft text value's height. -
layoutText
Shapes rich text and returns immutable metrics and caret/selection geometry.
-