Class Strokes

java.lang.Object
limn.components.Strokes

public final class Strokes extends Object
Quantities that are pixel-locked: identical at every ControlSize step.

A quantity belongs here if it expresses a weight, a rasterization correction derived from a weight, a device fact, or a human motor constant. It belongs in SizeTokens instead if it expresses an extent or an optical gap.

The separation is structural, not editorial: these are public static final float and SizeTokens has no row for any of them, so there is nowhere to put the five columns a scaled value would need. No member of this class may be indexed by a ControlSize.

Trap when migrating a literal. The four text-cluster components draw one rounded rect whose stroke width is the expression BORDER + (FOCUS_RING - BORDER) * focus, so the border thickens continuously as the focus transition runs. Writing focus > 0 ? FOCUS_RING : BORDER instead deletes that animation. A test that records stroke widths over these components must paint at a settled transition (focus exactly 0, then exactly 1) or it records frame-dependent fractional widths.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final float
    Antialiasing fringe allowance for a text clip.
    static final float
    Icon line weight: the glyph grows, the pen does not.
    static final float
    Every border and hairline separator.
    static final float
    The text caret.
    static final float
    The check-mark pen.
    static final float
    Slack so a 1 pt caret clears a hard-edged clip.
    static final float
    Caret damage margin: antialiasing plus hairline snap.
    static final float
    Hand jitter: a motor constant.
    static final float
    A 2 pt stroke centred 2 pt out leaves exactly 1 pt clear.
    static final float
    Focus gap for the indicator-scale toggles, which are in declared lockstep and must not differ here.
    static final float
    Slider's focus gap.
    static final float
    tabHoverInset > FOCUS_GAP_TAB must hold at every step.
    static final float
    Visible-focus indicator weight.
    static final float
    The declared paint reach of a ring drawn at −2 with a 2 pt centred stroke: the ring spans −3…−1.
    static final float
    The thin focus weight, for indicator-scale controls.
    static final float
    Alias: the same weight, read as a separator rather than an outline.
    static final float
    Half of BORDER.
    static final float
    Icon glyphs have no ascender/descender slack and must be drawn slightly larger than the text box to read at the same weight.
    static final float
    IME preedit underline, resting weight.
    static final float
    IME preedit underline for the converting block.
    static final float
    Checkbox box, RadioButton ring and Slider knob outline: 1.5 pt at every step.
    static final float
    The ±1 pt overshoot that makes a caret bracket its glyphs and a selection band clear the tallest ascender.
    static final float
    Menu tick.
    static final float
    The popup's scroll-hint band.
    static final float
    WCAG 2.2 SC 2.5.8 (AA): the accessibility floor does not scale.
    static final float
    Visibility floor so a zero-width selection on an empty line still shows (Math.max(2, x1 - x0)).
    static final float
    The colour picker's cursor ring, drawn twice one point apart in black and white so it stays legible on whatever colour it lands on.
    static final float
    Row clip inset whose value is the border width.
    static final float
    The gap that stops two highlighted rows fusing.
    static final float
    Scrollbar chrome breathing room, and what keeps thickness() = WIDE + 4 trivial.
    static final float
    Spinner hover fill inset.
    static final float
    Exactly twice BORDER: it exists to hide the seam between two columns' borders.
    static final float
    The tab strip's sliding indicator.
    static final float
    A wheel detent is a device unit: the same physical flick must move the same physical distance in a dense list and a roomy one.
  • Method Summary

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • BORDER

      public static final float BORDER
      Every border and hairline separator. A toolbar and the buttons inside it share one border weight, and scaling either one breaks that read.
      See Also:
    • HAIRLINE

      public static final float HAIRLINE
      Alias: the same weight, read as a separator rather than an outline.
      See Also:
    • HALF_PIXEL_INSET

      public static final float HALF_PIXEL_INSET
      Half of BORDER. Lands a 1 pt stroke on a whole device pixel instead of straddling two and going grey: drawRoundRect(0.5f, 0.5f, w - 1, h - 1, …). A function of the stroke, not of the size: at XLARGE it is still 0.5.
      See Also:
    • FOCUS_RING

      public static final float FOCUS_RING
      Visible-focus indicator weight. WCAG-style focus indicators are specified in absolute thickness, and a form mixing size steps must afford focus uniformly.
      See Also:
    • FOCUS_RING_THIN

      public static final float FOCUS_RING_THIN
      The thin focus weight, for indicator-scale controls. Two named weights, not an accident.
      See Also:
    • FOCUS_GAP_BUTTON

      public static final float FOCUS_GAP_BUTTON
      A 2 pt stroke centred 2 pt out leaves exactly 1 pt clear.
      See Also:
    • FOCUS_GAP_INDICATOR

      public static final float FOCUS_GAP_INDICATOR
      Focus gap for the indicator-scale toggles, which are in declared lockstep and must not differ here. A gap must be at least as wide as the thinner stroke it separates: between an INDICATOR_BORDER and a FOCUS_RING_THIN, both 1.5, a 1 pt gap reads as a seam rather than as clearance.
      See Also:
    • FOCUS_GAP_SLIDER

      public static final float FOCUS_GAP_SLIDER
      Slider's focus gap. Accepted consequence: Slider's height derives from 2 × (knobHover + gap + BORDER), so pinning the gap makes the small steps proportionally taller than the knob ramp predicts. The ring needs absolute room.
      See Also:
    • FOCUS_GAP_TAB

      public static final float FOCUS_GAP_TAB
      tabHoverInset > FOCUS_GAP_TAB must hold at every step.
      See Also:
    • FOCUS_RING_OUTSET

      public static final float FOCUS_RING_OUTSET
      The declared paint reach of a ring drawn at −2 with a 2 pt centred stroke: the ring spans −3…−1. Locked because the ring is. Consumed by paintOutset() overrides, whose whole purpose is to change which pixels are repainted.
      See Also:
    • INDICATOR_BORDER

      public static final float INDICATOR_BORDER
      Checkbox box, RadioButton ring and Slider knob outline: 1.5 pt at every step.
      See Also:
    • CHECK_MARK

      public static final float CHECK_MARK
      The check-mark pen. The mark's extent scales with the indicator; the pen does not. At XSMALL the mark still keeps 1.83 pt of clearance from the box border's inner ink edge (1.75 at MEDIUM), so one pen is optically sound at every step.
      See Also:
    • ARROW_PEN

      public static final float ARROW_PEN
      Icon line weight: the glyph grows, the pen does not. Sound only because every locked-pen glyph is floored at its MEDIUM extent for XSMALL and SMALL, which keeps pen ÷ glyphMinExtent ≤ 0.45 at all five steps.
      See Also:
    • PICKER_CURSOR

      public static final float PICKER_CURSOR
      The colour picker's cursor ring, drawn twice one point apart in black and white so it stays legible on whatever colour it lands on. Not FOCUS_RING: it happens to be the same weight today, and it means something else: a retune of the focus ring must not silently move a marker that is not one.
      See Also:
    • TAB_INDICATOR

      public static final float TAB_INDICATOR
      The tab strip's sliding indicator. Locked rather than tabled: 2.5 pt reads correctly across the strip's 2.1× range, and locking keeps the indicator inside height() for free (y = height() − thickness), so no paintOutset question arises. Bottom-anchored, so the centred-stroke parity rule does not apply.
      See Also:
    • CARET

      public static final float CARET
      The text caret.
      See Also:
    • INK_BLEED

      public static final float INK_BLEED
      The ±1 pt overshoot that makes a caret bracket its glyphs and a selection band clear the tallest ascender. An optical correction (the metrics.height() term it is added to already scales) and only meaningful from the ink box.
      See Also:
    • AA_BLEED

      public static final float AA_BLEED
      Antialiasing fringe allowance for a text clip. An absolute device effect: scaling it would let 2 pt of the leading pad be overwritten at XLARGE.
      See Also:
    • DAMAGE_MARGIN

      public static final float DAMAGE_MARGIN
      Caret damage margin: antialiasing plus hairline snap. Growing it at large steps inflates per-blink damage and defeats partial rendering.
      See Also:
    • CLIP_CLEARANCE

      public static final float CLIP_CLEARANCE
      Slack so a 1 pt caret clears a hard-edged clip. TextField's two uses of this must stay identical or the caret oscillates per keystroke.
      See Also:
    • MIN_SELECTION_SLIVER

      public static final float MIN_SELECTION_SLIVER
      Visibility floor so a zero-width selection on an empty line still shows (Math.max(2, x1 - x0)). The minimum that survives antialiasing at any size.
      See Also:
    • IME_UNDERLINE

      public static final float IME_UNDERLINE
      IME preedit underline, resting weight. Platform IMEs draw a hairline regardless of text size.
      See Also:
    • IME_UNDERLINE_ACTIVE

      public static final float IME_UNDERLINE_ACTIVE
      IME preedit underline for the converting block. The 1-vs-2 contrast carries the meaning; a scaled 0.5-vs-1 pair at XSMALL would erase it.
      See Also:
    • ROW_CLIP

      public static final float ROW_CLIP
      Row clip inset whose value is the border width.
      See Also:
    • ROW_GUTTER

      public static final float ROW_GUTTER
      The gap that stops two highlighted rows fusing. Scaled to 3 pt at XLARGE it would read as a deliberate stripe.
      See Also:
    • SPINNER_HOVER_INSET

      public static final float SPINNER_HOVER_INSET
      Spinner hover fill inset. Its value is the divider width, which the fill must not cover.
      See Also:
    • SCROLLBAR_MARGIN

      public static final float SCROLLBAR_MARGIN
      Scrollbar chrome breathing room, and what keeps thickness() = WIDE + 4 trivial. ScrollBar reads it for both its track geometry and its drag arithmetic, which is what keeps the two in lockstep: a bar that painted with one margin and dragged with another would put the thumb a pixel away from the pointer.
      See Also:
    • WHEEL_STEP

      public static final float WHEEL_STEP
      A wheel detent is a device unit: the same physical flick must move the same physical distance in a dense list and a roomy one. Accepted consequence: a notch covers ~1.7 menu rows at MEDIUM and ~2.0 at XSMALL.
      See Also:
    • MIN_HIT_TARGET

      public static final float MIN_HIT_TARGET
      WCAG 2.2 SC 2.5.8 (AA): the accessibility floor does not scale.

      The height ramp pays this floor in paint (XSMALL is 24), so no control needs a pointer target wider than its painted box: there is no hit outset and no two-pass hit test, only a Math.max clamp at the few sites where an axis can fall short. A clamp that can never bind is a defect rather than defensive coding: it claims an axis can fall below the floor when it cannot, and the next reader has to re-derive the ramp to find out.

      See Also:
    • DRAG_SLOP

      public static final float DRAG_SLOP
      Hand jitter: a motor constant. Growing it at XLARGE would make small deliberate drags read as clicks.
      See Also:
    • ICON_OPTICAL_BUMP

      public static final float ICON_OPTICAL_BUMP
      Icon glyphs have no ascender/descender slack and must be drawn slightly larger than the text box to read at the same weight. A constant correction, not a proportion.
      See Also: