SVG text metrics
Measures SVG text extents and glyph positions.
In one line
Can measure picture text sizes to learn about your fonts and system
Measures SVG text extents and glyph positions.
SVG layout uses a separate text path from HTML, so metrics add fonts and rasterizer detail even under HTML-layout defenses.
What it can and can't do
What the user does: Nothing. It happens when the page loads
It can
- Measure how wide and tall text drawn in pictures is
- Learn font and drawing differences even when normal text checks are blocked
- Add that number to a device profile
It cannot
- Show you anything on the screen
- See your files
- Ask permission first
- Know who you are by itself
Browser support
| Browser | Status | First version | Released | Note |
|---|---|---|---|---|
| Chrome | Supported | 1 | 2008-12-11 | None |
| Edge | Supported | 79 | 2020-01-15 | None |
| Firefox | Supported | 1.5 | 2005-11-29 | None |
| Safari | Supported | 3 | 2007-10-26 | None |
| Safari on iPhone | Supported | 3 | 2009-06-17 | None |
| Chrome on Android | Supported | 1 | Not listed | None |
| Samsung Internet | Supported | 5.0 | 2016-12-15 | None |
How a site asks for it
| API | SVGTextContentElement.getComputedTextLength(); getSubStringLength(); getBBox() |
| How access is granted | none |
| What the user sees | Not listed |
| Needs a secure context (HTTPS) | No |
| Needs a user gesture | No |
| How long it lasts | Not listed |
| How to take it back | Not listed |
| Inside an iframe | Not listed |
Typical flow
- Create SVG text elements
- Read lengths and boxes
- Hash
Data you get
What comes back: Floats per text sample
Shape: hash
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
computedTextLength | float | user units | 0 to 1000 | double precision |
Technical limits
- Same limits as DOMRect
The story
What it is
A script measures the exact size and spacing of text drawn as an SVG graphic.
For you
You never see it. The page draws text as a vector picture and measures where each letter lands. Those numbers vary with your fonts and system.
For makers
Chart and map makers need these numbers to place labels. Trackers use the same numbers as another way to see your fonts and rendering, even when other methods are blocked.
Where you see it
| Type | Example | Apps |
|---|---|---|
| analytics | A charting site like a dashboard tool places labels on a graph by measuring each text label first. | None named |
| maps | A web map measures place names to avoid overlapping labels on your screen. | Google Maps, Mapbox |
| creative | A web drawing tool with text on curves measures each letter to place it along a path. | Figma |
| ads | A tracker draws text in SVG and records exact widths, which works even if canvas is blocked. | None named |
| security | A fraud tool compares SVG text size to what the device claims, to find a spoofed setup. | None named |
| education | An interactive science page labels diagram parts and measures text to avoid overlap. | None named |
| games | A web strategy game places unit names on a map and measures them so they do not collide. | None named |
Risks
- Hard to block without breaking charts
- Reveals fonts
What the platform says
- MDN: SVG text. Describes how SVG text works and which measuring tools sites can use to lay it out.
Good uses and abuse
Legitimate uses
- None
Known abuse
- Font and engine signature
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 2 of 5 | How revealing the data is |
| Utility | 1 of 5 | How useful it is to honest apps |
| Friction | 0 of 5 | How much the user has to do |
| Fingerprint bits | 3 | Rough identifying entropy, when known |
Related capabilities
Related
- DOMRect and getClientRects metrics. Can measure text and emoji boxes to spot your fonts and system
Sources
How well checked: Based on official documentation.