javascript – Find out the line length for a given font

Question:

Can I use JS through canvas or in some other way to find out the line length for a given font and its size in millimeters? Through the measureText () method, you can get the length in pixels.

Answer:

Through the measureText () method, you get the length value in pixels, and then multiply by 0.2645833333333, this is the standard pixel size in millimeters. In the case of retina displays divide by 2. What is the problem and the solution. What for you do not understand millimeters. Maybe you make monitors – how do I know that.

Scroll to Top