Need help to understand SVG Font data

15 views
Skip to first unread message

xutia...@gmail.com

unread,
May 17, 2017, 9:18:16 AM5/17/17
to MathJax Users
Hi,

Can anyone explain a bit about svg font data structure for me?

Let's take this character as an example

jax\output\SVG\fonts\Latin-Modern\SansSerif\Regular\main.js

0x1D7E6: [656,0,500,28,471,'471 171h-99v-171h-79v171h-265v61l253 424h91v-424h99v-61zM299 232v380c-1 -57 -141 -294 -193 -380h193']

The above is to present the svg path of a number '4' in Latin-Modern SansSerif font style
This data has two parts

1) 656,0,500,28,471
and
2) '471 171h-99v-171h-79v171h-265v61l253 424h91v-424h99v-61zM299 232v380c-1 -57 -141 -294 -193 -380h193'

Can anyone please explain what they are and how to covert 2) part to a standard svg path easily?

Regards,
John Xu 

Davide Cervone

unread,
May 20, 2017, 6:52:52 AM5/20/17
to mathja...@googlegroups.com
> Let's take this character as an example
>
> jax\output\SVG\fonts\Latin-Modern\SansSerif\Regular\main.js
>
> 0x1D7E6: [656,0,500,28,471,'471 171h-99v-171h-79v171h-265v61l253 424h91v-424h99v-61zM299 232v380c-1 -57 -141 -294 -193 -380h193']
>
> The above is to present the svg path of a number '4' in Latin-Modern SansSerif font style
> This data has two parts
>
> 1) 656,0,500,28,471
> and
> 2) '471 171h-99v-171h-79v171h-265v61l253 424h91v-424h99v-61zM299 232v380c-1 -57 -141 -294 -193 -380h193'
>
> Can anyone please explain what they are and how to covert 2) part to a standard svg path easily?

Put an M at the beginning and Z at the end and you will have the SVG path.

The numbers are the height, depth, width, left bearing, and right bearing, in units of em-times-1000, so 656 means .656em.

The height is the extent of the character above the baseline, the depth is the extend below the baseline, the width is the advance width, meaning how much horizontal space to reserve for the character, the left bearing is where the "ink" for the glyph begins in relation to the start of the horizontal space, and the right-bearing is where the "ink" ends at the right in relation to the beginning of the horizontal space. So in this case, the character extends .656em above the baseline, and does not descend below the baseline; it takes up .5em of horizontal space, and the character itself extends from .028em to .471em within that .5em space (so there is .28em of blank space on the left of the glyph and .29em of blank space on the right).

Davide

Reply all
Reply to author
Forward
0 new messages