Actual pixel bounds of rendered reference glyphs.
From font file metadata. Same for any text in this font/size.
Bounds for reference characters (Ć , p).
Browsers don't expose font metrics directly via CSS or the DOM. While the Canvas API provides
TextMetrics with properties like actualBoundingBoxAscent, these values
can be inconsistent across browsers and don't always match the rendered output. This tool takes
a different approach: it measures the actual rendered pixels.
For each metric, we render a specific reference character to an offscreen canvas, then scan the pixel data to find the topmost and bottommost non-transparent pixels. This gives us the true visual bounds of the glyph as the browser actually renders it.
Reference characters used:
x ā its bottom edge defines the baseline, top edge defines x-heightH ā a flat-topped capital with no overshootĆ
ā captures the highest point including diacriticsp ā captures the descender depthfunction getVerticalBounds(ctx, width, height) { const imageData = ctx.getImageData(0, 0, width, height); let top = height, bottom = 0; for (let y = 0; y < height; y++) { for (let x = 0; x < width; x++) { const alpha = imageData.data[(y * width + x) * 4 + 3]; if (alpha >= 128) { // threshold for anti-aliased edges top = Math.min(top, y); bottom = Math.max(bottom, y); } } } return { top, bottom }; }
The Canvas TextMetrics API does provide ascent/descent values, but they represent
the font's declared metrics from the font file, not the actual rendered bounds. These
can differ due to font hinting, rendering engine differences, or glyphs that extend beyond the
declared metrics. Pixel-scanning shows what you actually see.
The dropdown includes common web-safe fonts. You can also type any font name in the custom input field ā if the font is installed on your system, it will be used. In Chrome and Edge, the "Load System Fonts" button uses the Local Font Access API to enumerate all installed fonts (requires permission).