Skip to content

Main content

Glyph Baseline Shift Transform

Shift known glyph ink boxes vertically by an explicit baseline offset while preserving advances and missing-box evidence; no font-size or shaping changes.

Loading tool…

Description

Shift known glyph ink boxes vertically by an explicit baseline offset while preserving advances and missing-box evidence; no font-size or shaping changes.

A glyph’s advance moves the next placement origin; its ink box describes visible bounds relative to that origin. Ink can overhang the advance, and an unknown box differs from a known empty box. These tools use caller-supplied glyph IDs and metrics, placing a horizontal run by cumulative advances without shaping text.

Shift known glyph ink boxes vertically by an explicit baseline offset while preserving advances and missing-box evidence; no font-size or shaping changes.

When to use this tool

Use this tool to shift known glyph ink boxes vertically by an explicit baseline offset while preserving advances and missing-box evidence; no font-size or shaping changes.

How to use the tool and how it works

  1. Enter glyphsJson, shift using the input definitions below. Serialize the JSON text fields in the decoded shape shown below.
  2. Run the operation. Resolve malformed-input errors before interpreting the result.
  3. Read result.glyphs. Interpret signs, units, ordering and null values using the rules below.

Add shift to each known box’s minimum and maximum y coordinates. Preserve glyph ID, cluster, advance and null boxes; accumulated placement x is not emitted.1

Input fieldMeaning and unitsAccepted input
glyphsJsonJSON array of {id, advance, cluster, box} glyph records. id is a string; advance is finite and may be signed; cluster is an integer 0–8192; box is null or [minX,minY,maxX,maxY] with ordered finite bounds.Text, at most 8,192 UTF-16 code units; the stated grammar and narrower limits also apply.
shiftSigned vertical box offset in the supplied metric units.Finite number satisfying the stated comparisons.

These decoded examples show the structure of the JSON text fields. Supply each as its corresponding serialized JSON string.

json
{
  "glyphsJson": [
    {
      "id": "a",
      "advance": 4,
      "cluster": 0,
      "box": [
        0,
        -1,
        3,
        2
      ]
    },
    {
      "id": "b",
      "advance": 5,
      "cluster": 1,
      "box": null
    }
  ]
}
Output fieldInterpretation
resultObject containing the fields below.
result.glyphsTransformed {id,advance,cluster,box} records in original order, retaining null boxes.
json
{
  "input": {
    "glyphsJson": "[{\"id\": \"a\", \"advance\": 4, \"cluster\": 0, \"box\": [0, -1, 3, 2]}, {\"id\": \"b\", \"advance\": 5, \"cluster\": 1, \"box\": null}]",
    "shift": 2
  },
  "output": {
    "result": {
      "glyphs": [
        {
          "id": "a",
          "advance": 4,
          "cluster": 0,
          "box": [
            0,
            1,
            3,
            4
          ]
        },
        {
          "id": "b",
          "advance": 5,
          "cluster": 1,
          "box": null
        }
      ]
    }
  }
}

Limitations and assumptions

  • The offset uses the caller’s y-axis direction and metric units; no font resizing or reshaping occurs.
  • All advances, box coordinates, shifts and positional tolerances must share caller-defined metric units. Signed advances are accepted. Glyph records contain id, advance, integer cluster 0–8192 and box = null or [minX,minY,maxX,maxY] with ordered bounds.
  • Every declared top-level input is required and unknown fields are rejected. Ordinary strings are limited to 8,192 UTF-16 code units and lists to 128 entries, with tighter operation-specific bounds where stated. JSON text has bounded nesting and node counts.
  • Numeric outputs must be finite and within the absolute safe-integer magnitude; exact larger integers use decimal text. Source positions are zero-based UTF-16 offsets and span ends are exclusive unless a different convention is explicitly stated.

Alternative or Complementary methods

Obtain metrics and cluster mappings from the intended font/shaping system, then inspect the supplied observations. Use actual rendering when hinting, fallback choice or visible pixel extents matter.

References

  1. Tool behavior and example: Glyph Baseline Shift Transform — tool.io

Similar or alternative tools

  • Glyph Advance Scale Transform

    Scale explicit glyph advances and known box coordinates by a nonnegative uniform factor; no hinted rasterization or font metric inference.

  • Glyph Advance Run Tab Stop Placement

    Place glyph-run tab positions at the next strictly greater explicit stop, then repeat a supplied positive interval after the last stop; no text shaping.