Get jquery to return font size in points

when i use .css ('font-size') in jquery it returns the value in pixels, is there any way to get it to give it in points? because i want to use it in php gd and it requires the font size to be in dots

+3
source share
3 answers

Try the following:

var fontSize = ...
var points = parseInt(fontSize) * 72 / 96
+6
source

If your is font-sizedefined in pt, you can access the property fontSize element.styleas follows ...

var element = document.getElementById('my_element'),
    //return size as it is defined 
    fontSize = element.style.fontSize;
+2
source

: (parseFloat ($ (this).css( "font-size" )) * 72.0/96.0). toFixed (2)

+1
source

Source: https://habr.com/ru/post/1778572/


All Articles