|
| 1 | +# Foreign Ponder Labels |
| 2 | + |
| 3 | +When a mod injects ponder scenes into another mod's items, a small attribution label can appear next to the scene title — rendered in Azimuth's built-in microfont. Labels only show when the scene's namespace differs from the pondered item's namespace, so a mod's own scenes stay clean. |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +## Registering a label |
| 8 | + |
| 9 | +Call `PonderForeignLabelRegistry.register` during client init, alongside any other ponder registration: |
| 10 | + |
| 11 | +```java |
| 12 | +import com.cake.azimuth.ponder.PonderForeignLabelRegistry; |
| 13 | + |
| 14 | +// Plain string — rendered in microfont (A–Z only) |
| 15 | +PonderForeignLabelRegistry.register("bits_n_bobs", "BITS N BOBS"); |
| 16 | +``` |
| 17 | + |
| 18 | +The first argument is the mod's namespace (the one used when registering ponder scenes). The second is the label text, automatically uppercased. |
| 19 | + |
| 20 | +### Localised labels |
| 21 | + |
| 22 | +For languages that need characters outside the microfont charset (CJK, Cyrillic, accented Latin, digits, etc.), pass a `Component` instead: |
| 23 | + |
| 24 | +```java |
| 25 | +import net.minecraft.network.chat.Component; |
| 26 | + |
| 27 | +PonderForeignLabelRegistry.register( |
| 28 | + "bits_n_bobs", |
| 29 | + Component.translatable("bits_n_bobs.ponder.label") // resolved at render time |
| 30 | +); |
| 31 | +``` |
| 32 | + |
| 33 | +When any character in the resolved string falls outside the microfont's glyph set, Azimuth automatically falls back to Minecraft's built-in font scaled to match the microfont size. The switch is all-or-nothing per label — no mixing of fonts within a single string. |
| 34 | + |
| 35 | +> The microfont charset is **A–Z**, **<**, **>**, **/**, and **space**. Anything else triggers the fallback. |
| 36 | +
|
| 37 | +## Microfont |
| 38 | + |
| 39 | +The microfont is a 3×4 pixel spritesheet font available for general use beyond ponder labels. Static methods live on `Microfont`: |
| 40 | + |
| 41 | +| Method | Description | |
| 42 | +|---|---| |
| 43 | +| `render(GuiGraphics, String, x, y, color)` | Sprite-only render — unsupported chars produce blank gaps | |
| 44 | +| `renderHighlighted(GuiGraphics, String, x, y, color, bgColor)` | Same as above with a filled background rectangle | |
| 45 | +| `renderSmart(GuiGraphics, Font, String, x, y, color)` | Auto-detects charset; falls back to MC font at 0.5× scale | |
| 46 | +| `calculateWidth(String)` | Pixel width using sprite metrics | |
| 47 | +| `calculateSmartWidth(Font, String)` | Width accounting for possible fallback font | |
| 48 | + |
| 49 | +Custom font sheets can be created with `FontSheet.Builder` for different textures or glyph sets. |
0 commit comments