Skip to content

Main content

Entomology Specimen Pin Label Budget Tool

Check an explicit line and Unicode code-point column budget; typography and physical print size are not inferred.

Loading tool…

Description

Count Unicode code points in each line using Array.from.

Specimen labels must fit a physical medium, while software can count characters by several conventions. Unicode code points, grapheme clusters, rendered glyph widths and actual printed columns need not agree.

Count Unicode code points in each line using Array.from.

When to use this tool

Use Entomology Specimen Pin Label Budget when checking a label against caller-supplied code-point and line budgets.

How to use the tool and how it works

  1. Enter lines, maximumColumns, maximumLines. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read lineCount, longestLine, fits. Inspect fits before interpreting the associated values.

Require positive whole maximumColumns and maximumLines. Count Unicode code points in each line using Array.from. Return lineCount, longestLine (zero for no lines), and fits when both the line count and every code-point width fit the supplied bounds.1

Input fieldMeaning and unitsAccepted input
linesLinesRequired. Array of text; maximum UTF-16 length 8192; maximum items 256.
maximumColumnsCode-point budget per supplied line, not rendered glyph or display-cell width.Required. Safe integer; minimum 1.
maximumLinesMaximum LinesRequired. Safe integer; minimum 1.
Output fieldInterpretationReturned shape
lineCountLine CountRequired. Safe integer.
longestLineLongest LineRequired. Safe integer.
fitsFitsRequired. Boolean.
json
{
  "input": {
    "lines": [
      "Species A",
      "Site 2"
    ],
    "maximumColumns": 12,
    "maximumLines": 3
  },
  "output": {
    "lineCount": 2,
    "longestLine": 9,
    "fits": true
  }
}

Limitations and assumptions

  • Code points are not grapheme clusters, printed glyph widths or terminal display cells. No wrapping, font measurement or label-content validation occurs.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
  • Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.

Alternative or Complementary methods

Measure the actual font and label layout when physical printing fit matters, and review required specimen information separately.

References

  1. Calculation and input contract: entomology/entomology-specimen-pin-label-budget — tool.io

Similar or alternative tools