Class FallbackText
java.lang.Object
privbot.ui.overlay.FallbackText
Text drawn in runs, so characters the chosen font has no glyph for (an emoji, a pickaxe) are drawn
in "Segoe UI Emoji", then "Dialog", at the same size and style instead of as a missing-glyph box.
The fallback glyphs are single-colour: they take the graphics' current colour like any other text.
Text the primary font can draw whole takes the plain drawString path. Fallback fonts are
derived once per (family, style, size) and cached; prepare(Font) warms the cache off the
render thread so paint never creates a font.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voiddraw(Graphics2D g, String s, float x, float y, Font primary) Drawsswith its baseline at (x,y) inprimary, falling back per character run.static voidDerives (and caches) the fallback fonts forprimary's size and style.static intwidth(Graphics2D g, String s, Font primary) The advance width ofsasdraw(java.awt.Graphics2D, java.lang.String, float, float, java.awt.Font)lays it out.
-
Method Details
-
draw
Drawsswith its baseline at (x,y) inprimary, falling back per character run. -
width
The advance width ofsasdraw(java.awt.Graphics2D, java.lang.String, float, float, java.awt.Font)lays it out. -
prepare
Derives (and caches) the fallback fonts forprimary's size and style. Call off the render thread.
-