I have a 40 pixel font that I'm trying to translate into custom images. I'm trying to match the size of the image exactly, but I'm having some problems getting exactly the right size. Basically, what it comes down to is this. When a font says it is X pixels, what does this physically mean?
This is an excellent question, which has a rather unsatisfactory answer.
The size of type, whether specified in pixels, points (1/72") or millimetres, is the height of an em-square, an invisible box which is typically a bit larger than the distance from the tallest ascender to the lowest descender.
Given this is a somewhat arbitrary measure which
it's not very meaningful or useful, other than as an approximation.
In your case, work out what size you need to specify in Photoshop to match the browser's rendering by experimentation. You should find this to be a constant ratio for any font, but I wouldn't expect this to be the case if you change browser or OS.
Are you sure your font is measured in pixels? Most of the time fonts are measured in points. A point is 1/72 of an inch. So a 40 pt font is 40/72" or 5/9" tall. The kicker is that that is the dimension from the top of the ascenders on tall letters to the bottom of the descenders on letters that hang below the baseline. That's why the x-height is sometimes used, as mentioned above. That is the height of the lower-case letters that don't stick up or down.
Either way, the measurements are never exact anyway, unfortunately. You'll just have to some measuring and figuring (and/or trial-and-error) to accomplish what you're trying.
ASCII Time! Pretend the two boxes below are pieces of lead type from 1900 or so. Back then, typefaces were cast in lead (or routed in wood). For the type to be set into a printing lock-up, they had to be connected to solid blocks. This is where the dimension of the type (in points) comes from:
Note the two letters above are different sizes, but their bounding box is the same. As such, in terms of points, both of those fonts are the same size.
Nowadays, we don't make much type in lead and wood and most of it is digital. However, the concept of the point sizing still exists in that there is a virtual box that is the same height for every letter that the type is placed on. Again, it's this virtual box that defines the point size rather than the physical measurements of the letterforms themselves. The actual size of the letterforms are often smaller than the point size (but can also be larger as well).
Measuring type in pixels doesn't work because of that, however, you can 'set' type in pixels in CSS and the like. The browser does a translation as best it can between the px size declared. But it's always a fuzzy estimation.
Ultimately, there's no accurate way to get two typefaces letterforms exactly the same size short of looking at them visually and changing the size of each until you see them as being the same size.
Try typing in the vertical bar character ('|') and measure that. If I duplicated your situation correctly and your antialiasing isn't blurring it too much, it should be 22px.
22px represents the height of the block of type. But each character fills the block differently. A 'g' or 'q' will occupy the lower region of that 22px, while capital letters and lowercase letters like 'b' or 'd' will occupy the upper portions.
I don't know about how to compare to your CSS settings, but that explains how Photoshop interprets text height.
The "font size" of a font refers to the font's "em height", which isn't necessarily the same as the height of particular characters in the font.
Usually the em height of a font adheres to the same basic idea - it'll be roughly set to the distance from the lowest descender (such as the bottom of the letter
As you can see, none of the individual letters cover that whole span.
With digital fonts, the "em height" of a font is a choice made by the font designer, and does not have to conform to this convention at all: a digital type designer can pick any foundation for their em size. However, fonts still tend to adhere, at least roughly, to the sort of convention described above. In old days when type consisted of metal blocks, the "em height" was the height of one of those blocks, which needed to be high enough not only for any character in that typeface but also for any ascenders, descenders, and accents.
Now, many modern typefaces include accents on capital letters too (such as
The line gap in body text is a space left between the descender of one line of text and the ascender of the line below it - that is, the "font size" does not include this line gap measurement. It can be influenced by the CSS field
Now, even if a designer does follow a predictable convention for their em height, this still doesn't tell you the size of capital letters (cap-height) or the size of say an
I doubt I'm going to exactly answer the question, but I think I know how to do what you are trying to do. The thing is, it has nothing to do with Photoshop, unless Photoshop can crop images the way PowerPoint can.
Why not make one image of the word or words you are working with and then duplicate and crop each duplication. Like this:
protected by Darth_Vader♦ Jul 22 '15 at 18:39
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.
Would you like to answer one of these unanswered questions instead?