-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
How to draw text based on pixel height? #8737
-
I figured maintainers know a thing or two about texts and fonts. I'm trying to draw text on a 1920x1080 image with a given pixel height. This pixel height is from the top pixel in the line of text to the bottom pixel in the line of text.
How do I efficiently convert the pixel height to a font size to draw in that area (top - bottom)?
Beta Was this translation helpful? Give feedback.
All reactions
https://app.uxcel.com/courses/design-lingo/typography-605/font-size-2298
Font size is the height of a typeface. Let's first define typographical terms like ascender and descender before moving on to a more detailed explanation.
- Ascender is the vertical stroke found on lowercase letters (b, d, f, h, k, l, t) that extends above the typeface's x-height.
- Descender is the part of a lowercase letter that extends below the baseline.
Font size equals the distance between the top of the ascender height to the bottom of the descender height.
So my expectation is that they would be the same. If you find otherwise, I suspect you're not considering ascenders and descenders.
I don't think this is a...
Replies: 1 comment
-
https://app.uxcel.com/courses/design-lingo/typography-605/font-size-2298
Font size is the height of a typeface. Let's first define typographical terms like ascender and descender before moving on to a more detailed explanation.
- Ascender is the vertical stroke found on lowercase letters (b, d, f, h, k, l, t) that extends above the typeface's x-height.
- Descender is the part of a lowercase letter that extends below the baseline.
Font size equals the distance between the top of the ascender height to the bottom of the descender height.
So my expectation is that they would be the same. If you find otherwise, I suspect you're not considering ascenders and descenders.
I don't think this is a Skia question yet - if you had just kept this as a generic question about fonts, I would have presumed that you were still using Pillow. As a general rule though, it would be helpful if questions and problems posted here were kept to Pillow-related ones. This is partly for other users, so that when they search for information, they don't find unrelated content. It is also partly for those of us who answer questions - there already isn't enough time available to address Pillow matters without increasing scope.
Beta Was this translation helpful? Give feedback.