Re: [svgwg] `baseline-y` in SVG (#1075)

Sorry but I don't think this is by any means feasible or likely to be adopted by any application vendor in the end. 

The main problem: the browser (or any other application) renderer usually has no idea of the actual font geometry or tight bounding box (OK there are some methods e.g canvas `measureText()`  coming close).  
All existing alignment concepts are based on the globally defined font metrics – this also applies to properties like `dominant-baseline`. The app doesn't really calculate anything like the center  or middle of the actual glyph it simply relies on the stored metrics data.

In your specific case the render would actually need to calculate the centroid of the polygon  (the average x/y values of all vertices not half of the width and height) – what about other glyphs in the font?    
In other words: for the desired vertical alignment the renderer would need to switch between glyph based geometry centroids.

Theoretically, what you're asking for could be an addition to the OpenType spec – so a font designer could store custom alignment points (like centroids) which could be used by a layout engine. 
But quite frankly that's rather unlikely to happen.  
In fact we OpenType already  has concepts for anchor points but mainly used for other purposes such as diacritic alignments. We usually can't access these data in an applications layout engine (unless we write our own).  

Currently, your best options would be to either:  
* tweak the baseline alignment manually via `dominant-baseline` and `dy` 
* design a custom font where symbols are visually centered around the baseline (in font coordinate systems y=0)
* don't use fonts at all for this and use geometry elements directly (`<path>` would be my recommendation as you can more conveniently shift it when using all-relative commands).


-- 
GitHub Notification of comment by herrstrietzel
Please view or discuss this issue at https://github.com/w3c/svgwg/issues/1075#issuecomment-4102356129 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Saturday, 21 March 2026 05:38:43 UTC