﻿# Text advance is not the ink boundary in generated table images

A practical investigation of text advance is not the ink boundary in generated table images, with explicit observations, control cases and evidence limits.

Author: Retrivium team
Updated: 2026-11-06
Canonical URL: https://retrivium.ai/journal/field-synthetic-pillow-table-text-advance-ink-bounds/
Language: en

## The generated-data scenario

A table-image generator assigns a word box from its starting position and textlength, then renders an italic or accented value. The saved annotation can omit visible glyph overhang even though the next text position was computed correctly. This investigation separates layout advance from rendered text bounds before those boxes become synthetic supervision for document extraction or cell assignment.

## The generation mechanism

Pillow documents textlength as the offset for following text, whereas textbbox returns bounds relative to the drawing anchor. The bounding box can include additional margins for some fonts, including italics or accents. Text anchors determine how the supplied position relates to the text. Therefore a cursor location and advance alone do not define the full annotated rendering rectangle.

## Define the dataset contract

Define whether the target represents a cell rectangle, a text bounding rectangle or exact ink coverage. These objects are different even when one encloses another. Record font identity, size, anchor, stroke and relevant shaping settings with the generated value. Use identical measurement and rendering settings; otherwise a correct geometry API call may describe a different string appearance from the saved image.

## A step-by-step protocol

Construct a table fixture with distinctive values, varied supported glyph forms and explicit cell boundaries. Measure text using the actual drawing configuration, render the image, and overlay the proposed annotation. Compare advance-based boxes against textbbox-derived boxes as a diagnostic control. Inspect clipping at cell edges separately; a valid pre-clipping box does not establish that every intended glyph remained visible.

## Evidence required for acceptance

Acceptance requires the exact image, draw parameters and annotation coordinate convention, plus reviewed examples at boundaries. Preserve any crop or resize applied after drawing and update geometry accordingly. If the target is cell structure, do not replace cell boxes with glyph boxes simply because the latter fit visible text more tightly. Evaluate the representation the intended student actually consumes.

## Failure cases and limits

A text bounding rectangle is not necessarily a pixel-perfect segmentation mask, and the documented margins should not be described as such. Fonts, shaping support and missing glyph behavior can require further controls. No OCR benchmark is reported here. The result sought is a reproducible connection between generated text appearance and its stated annotation object, not a universal typography-quality guarantee.

## Primary references and related reading

Measure rendered text bounds with the same font and anchor used to draw the cell. [Pillow text ink bounding boxes versus text advance](https://pillow.readthedocs.io/en/stable/reference/ImageDraw.html); [Pillow text anchor alignment](https://pillow.readthedocs.io/en/stable/handbook/text-anchors.html).

The proposed investigation of pillow table text advance ink bounds is a proposed dataset-contract review; no production dataset was generated or evaluated. Related reading: [Table Transformer: detection boxes, table structure, and cell text are separate](/journal/fg2-table-transformer-detection-structure-text-stages/); [Pillow EXIF orientation: transform image annotations with the pixels](/journal/data-guide-image-exif-box-coordinate/).
