Closed ghost closed 1 year ago
The font size shown in the UI (in photoshop and photopea) is multiplied by transform scale so the relative sizes between text boxes still match after you transform some of them.
Thanks, could you give me the the calculation and properties to multiply by.
I don't know exact calculation but the field is text.transform
I suspect they use either horizontal or vertical scale or maybe average of both. There are methods for extracting scale from a matrix.
I have found a function which extracts scale from a matrix :
`function decomposeMatrix(m) { var E = (m[0] + m[3]) / 2; var F = (m[0] - m[3]) / 2; var G = (m[2] + m[1]) / 2; var H = (m[2] - m[1]) / 2;
var Q = Math.sqrt(E E + H H); var R = Math.sqrt(F F + G G); return { scaleX: Q + R, scaleY: Q - R, }; }`
But in the transform object the first fours items are [1,0,0,1] which means the function returns 1, multiplying by this obviously doesn't change the font size.
Hmm, that's weird. If the transform doesn't have any scaling then the font sizes should match. Unless they're in different units for some reason.
No they're both using px. Would you like me to send you the PSD?
sure, that would help to find the issue.
I'm getting ERR_CONNECTION_REFUSED
error
I am so sorry, the font size is correct, it was using a different font. I am an idiot !
No problem, glad it's working now.
The parsed font size is larger than the one I set in my PSD editor (Photopea).