Jump to content

Font size in pixels is larger than expected


Recommended Posts

Hello

According to this post:

On 13.03.2012 at 11:05 PM, Rick Brewster said:

Font sizes in Paint.NET follow the pixels and don't take your image's DPI (aka resolution) into consideration.

 

I would expect font size to actually have the height that I've set for it in pixels, yet if you try to type "The dog" in Arial 40px and then try to wrap the entire text in selection rectangle, you would notice the rectangle height to be ~50px. If I try to do the same in CSS, the browser shows the font with the right size in pixels.

This thread on stackexchange also suggests that what paint.net does is incorrect.

Am i missing something or has this been overlooked?

Edited by Danat
Link to comment
Share on other sites

3 hours ago, Danat said:

Am i missing something or has this been overlooked?

Now messure once the "T" and once the "g" with it's lower length: surprise... 40px. "Fontsize" means the size of a single letter, not the size of a word. And ... PDN isn't a browser...

 

Similar to a word processing software, the primary task of a web browser is to display (text) content independently of the screen size, window size and individual settings of the user for the font presentation in a layout which is as uniform as possible and to adapt immediately to each change.

An image processing software like Paint.NET simply has to convert once the letters of a font into a pixel bitmap.

 

You should read more attentive the linked thread for yourself.

Edited by IRON67
Link to comment
Share on other sites

1 hour ago, IRON67 said:

 "Fontsize" means the size of a single letter

...

You should read more attentive the linked thread for yourself.

Well from that same thread:

Quote

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.

Quote
 

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 g) to the highest ascender (such as the top of the letter h):

Which is also how browser works. Seems like the common definition of "font size" is not what you said. So, what did I miss ?

 

1 hour ago, IRON67 said:

Similar to a word processing software, the primary task of a web browser is to display (text) content independently of the screen size, window size and individual settings of the user for the font presentation in a layout which is as uniform as possible and to adapt immediately to each change.

 

An image processing software like Paint.NET simply has to convert once the letters of a font into a pixel bitmap.

So you agree that paint.net uses its own definition of what font-size means right?

 

EDIT: I'll explain what I'm doing. I need to reproduce the text I have in a webpage. The text has 40px font size in CSS. In paint.net I also specify 40px font size but get significantly larger text which is not what I think a user would expect in this situation considering there seems to be a general agreement on what "font size" means.

Edited by Danat
Link to comment
Share on other sites

No. Why you quote something about "em height"? In Paint.NET and most other image software this is completely irrelevant. You want 40px and you GET 40px. So what?

Edited by IRON67
Link to comment
Share on other sites

2 hours ago, IRON67 said:

Now messure once the "T" and once the "g" with it's lower length: surprise... 40px. "Fontsize" means the size of a single letter, not the size of a word.

Okay I did another test. Try the same example with "The jar" and measure "j" - it will have 48px height, although the font size is 40px. So, what does the "font size" mean?

Link to comment
Share on other sites

7 minutes ago, IRON67 said:

No. Why you quote something about "em height"? In Paint.NET and most other image software this is completely irrelevant. You want 40px and you GET 40px. So what?

I quoted how "font size" is defined ("The "font size" of a font refers ...", "The size of type ...")

Edited by Danat
Link to comment
Share on other sites

12 minutes ago, Danat said:

Okay I did another test. Try the same example with "The jar" and measure "j" - it will have 48px height, although the font size is 40px. So, what does the "font size" mean?

 

Why should I do? You insist on a very strict definition of "fontsize", but hardly anyone thinks. You expect in my eyes just too much of an image processing software.

 

Quote

Seems like the common definition of "font size" is not what you said. So, what did I miss ?

 

The word COMMON, usually and so on..

If you are so keen to get what you expect, you should simply use a program that meets these expectations - maybe GIMP. People like me would just make another attempt in such a case until the size fits.

 

Quote

I need to reproduce the text I have in a webpage.

 

What about screenshots? How important is Arial instead of another font?

Edited by IRON67
Link to comment
Share on other sites

1 minute ago, IRON67 said:

 

Why should I do?

Well its not that you should, but I've managed to provide a counter argument to what you said about font size, using paint.net itself.

 

3 minutes ago, IRON67 said:

You insist on a very strict definition of "fontsize", but hardly anyone thinks.

I'm sure most web designers think that way otherwise everything web related would prove them wrong anyways. Also that linked forum is dedicated to "Graphic Design" which means this font size definition is probably valid in most graphic-related tools. So I don't get your "hardly anyone thinks".

 

10 minutes ago, IRON67 said:

If you are so keen to get what you expect, you should simply use a program that meets these expectations.

It's kinda funny that you previously said:

18 minutes ago, IRON67 said:

You want 40px and you GET 40px. So what?

So now paint.net is not a program that gives me what I want ? ;)

Link to comment
Share on other sites

11 minutes ago, Danat said:

I'm sure most web designers think that way otherwise everything web related would prove them wrong anyways.

 

Again: Paint.NET isn't made for webdesign. Is it so hard to understand?

 

BTW: I'm pretty sure, that your webpage in MY browser will definitely not show me the text in 40px, because my browser adjustments don't allow this.

 

It is an old story that many web designers do not really know how real visitors of a web page actually perceive them in their browsers and what they expect. Web designers tend to live in their own small layout world. I've been around for over 20 years and have designed websites for myself - so I know very well what I'm talking about. Just look at that less doggedly. Is better for the nerves.

Edited by IRON67
Link to comment
Share on other sites

2 minutes ago, IRON67 said:

Again: Paint.NET isn't made for webdesign. Is it so hard to understand?

well its not about web-design really. Its about text and the commonly accepted definition of "font size".

In paint.net you specify font size 40px, yet you get letters that have 48px height - there is no valid explanation for this logic unless I'm missing something which is what the topic is about.

I dont see any point continuing this discussion though. It seems after your own definition of font size has been counter-argumented you decided to just keep on saying that "paint.net is as is" which gets us nowhere. I'll try to PM the author I guess after a day or so. It's not that I use paint.net a lot, but I decided to bring this inconsistency to his attention in case he cares.

Link to comment
Share on other sites

Yes, PDN is as is and other programs too. I wish you good luck for discussing all the inconsistences there with the autors. PDN has only ONE author/developer and I suppose, that text-related inconsistences don't have a high priority for him.

Edited by IRON67
Link to comment
Share on other sites

Yeah I also don't think its critical or smth, I actually was hoping that somebody would explain why it works that way or show a setting that fixes it, because its weird that paint.net exists for so long and yet has so easily discoverable inconsistency.

Forgot to say that I did find a simple workaround for this, in case someone stumbles on this as well:

Just subtract 10 from font size to get what you need:

50px font in browser = 40px font in paint.net

40px font in browser = 30px font in paint.net

...

EDIT: workaround is invalid, read below for the right answer.

Edited by Danat
Link to comment
Share on other sites

32 minutes ago, Danat said:

Yeah I also don't think its critical or smth, I actually was hoping that somebody would explain why it works that way or show a setting that fixes it, because its weird that paint.net exists for so long and yet has so easily discoverable inconsistency.

 

Nobody cares about such inconsistences, if he isn't a webdesigner ;) Most people just want be able to read the text. They are happy, if the letters are not to small, the font is not to crazy, the contrast is not to weak and the grammar is adequate.

Never forget: form follows function.

 

Spoiler

font.jpg

 

Some words about "definition"..

 

Quote

...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.
...which isn't necessarily the same as the height of particular characters...
Usually the em height of a font adheres to the same basic idea - it'll be roughly set to the distance from...

 

Did this look like a serious definition to you? For me it doesn't. BTW: Even browser renders fonts different.

Edited by IRON67
Link to comment
Share on other sites

...

there is no valid explanation for this logic ...

First of all: statements like this should almost always be translated to "I don't understand this and I don't want to figure out why." It's a lazy rhetorical device and it should be avoided. In my opinion.

 

Anyway. I don't think y'all are understanding how text rendering and font measurement stuff works.

 

That's not an insult -- this stuff is actually quite complicated and confusing.

 

So you agree that paint.net uses its own definition of what font-size means right?

Incorrect. 

 

If you type in 40 for a font size in Paint.NET, it sends that size over to DirectWrite. DW then grabs glyphs from the font and does stuff. Whatever DW says the measurements are, that's what Paint.NET uses, and DirectWrite is very serious about getting this stuff correct. And the font is VERY much in control of things, too. There are some super crazy fancy cursive fonts that go all over the place, and asking for "size 40" in that case does NOT mean that anything you type will fit into a 40 pixel tall box. That's just not what "size 40" means.

 

And for the Arial example with "The dog", it's 50 pixels tall because the "g" has a descender (as pointed out almost immediately by IRON67). Without that, the text is about 40 pixels tall, although you might see things +/-1 pixels due to antialiasing spillover/under.

 

This is something I've spent a lot of time on to ensure correctness on. There is no bug in Paint.NET here. This is not an "inconsistency" and it's not because "there's only 1 developer" or that "text related inconsistencies aren't a priority for [me]". I promise you that things are correct, and it's only your lack of knowledge that makes things seem "wrong" (and again, even if I sound like a jerk when I say that, I promise you it's not meant to be an insult!).

 

Just subtract 10 from font size to get what you need:

Incorrect.

 

As you increase the font size, your magical "10" will have to increase. As you decrease the font size, you'll have to decrease your magic number. You simply have a discrepancy between what you think you're asking for and what you're actually getting.

  • Upvote 2

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

BTW, here is the DirectWrite interface that handles text layout: https://msdn.microsoft.com/en-us/library/windows/desktop/dd316718(v=vs.85).aspx

 

In particular, Paint.NET makes use of GetMetrics and GetOverhangMetrics quite a bit.

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

 

Hi Rick. Thank you for replying.

6 hours ago, Rick Brewster said:

First of all: statements like this should almost always be translated to "I don't understand this and I don't want to figure out why." It's a lazy rhetorical device and it should be avoided. In my opinion.

It's kinda unfair that you cut the second part of my quote saying "unless I'm missing something which is what the topic is about" and said the same thing yourself ;). Also I did try to figure out, as I provided links to my findings about what "font size" should specify.

 

6 hours ago, Rick Brewster said:

And for the Arial example with "The dog", it's 50 pixels tall because the "g" has a descender (as pointed out almost immediately by IRON67). Without that, the text is about 40 pixels tall, although you might see things +/-1 pixels due to antialiasing spillover/under.

Ok, now its my turn to sound like a jerk ;) . Its 40px tall because T is in uppercase, "t" is 40px tall but thats because it has an ascender, so if we use "ace" as text it will be 30px tall. Why are we even considering descenders as something non-normal in context of font height and ascenders are ok? Also thats not what IRON67 said - he said individual letters are 40px tall and thats what the font-size means which is plain wrong.

 

6 hours ago, Rick Brewster said:

Incorrect.

 

As you increase the font size, your magical "10" will have to increase. As you decrease the font size, you'll have to decrease your magic number. You simply have a discrepancy between what you think you're asking for and what you're actually getting.

Yeah my bad on this one.

 

6 hours ago, Rick Brewster said:

That's just not what "size 40" means.

Well I've just figured out that 40 probably means 40pt under 96 DPI which can be easily converted to pixel-based font size using a lookup table, or the following formula from this link

FLOAT ConvertPointSizeToDIP(FLOAT points)
{
	return (points/72.0f)*96.0f;
}

Thats why in my example 30 font size in PDN meant (30/72)*96 = 40px font size. I've tested font with different sizes in PDN and it seems my assumption is correct. The statement I quoted in my first post confused me into thinking "font size 40" actually means "font size 40px" because you referred to font sizes as "following pixels". Though I still don't understand why did not you just say in this topic that "its points duh" ;). It's not complicated at all at this point contrary to what you stated. Sure, I'm a dev myself and I remember the pain I had when trying to use GDI to measure the text size properly, but we're merely talking about units of font size here.

Now it feels this thread has gotten way longer than it might have been ;) . Well, unless I'm again missing something.

Edited by Danat
Link to comment
Share on other sites

1 hour ago, Danat said:

IRON67 said - he said individual letters are 40px tall and thats what the font-size means which is plain wrong.

 

OMG ... that one pixel more or less... and NO, that's what most people accepted what it's meant approximately. Because all the definitions don't fit always and under all circumstances.

 

40px.png

 

In the end I think it would be a good idea to make a little more meaningful statement in the FAQ for PDN about "fontsize" to avoid further discussions by us uninformed unknowing people.

 

@Danat: Do you know a program that solves your problem better?

 

The time when I put my nose a bit into the programming of software is long gone. But over the years, I've picked up enough to understand that it's rarely as easy to solve as it seems because you're dependent on many factors that you can not influence as a developer.
But I'm not Rick Brewster and as long as he did not explain it in detail, I gave my lay opinion.
As a developer I would have expected from you, Danat somewhat less narrow-mindedness.

Edited by IRON67
Link to comment
Share on other sites

2 hours ago, IRON67 said:

 

OMG ... that one pixel more or less... and NO, that's what most people accepted what it's meant approximately. Because all the definitions don't fit always and under all circumstances.

I wasn't referring to 1 pixel difference, but to the fact that "j" or "a" letter size in no way fits your definition of fontsize as  "the size of a single letter", otherwise they would also had to be of the 40px height. Even "T" letter in 200 font size in PDN is 192 pixels tall, so 200 can't be interpreted as an approximate size of capital letters either.

 

2 hours ago, IRON67 said:

In the end I think it would be a good idea to make a little more meaningful statement in the FAQ for PDN about "fontsize" to avoid further discussions by us uninformed unknowing people.

Yes. That's my goal - to make sure there would not be misunderstandings about font size in PDN in the future. That is the sole reason I created this topic, since I couldn't find any info explaining my issue and thought it would be a good contribution for others to use as well. Yet I have a feeling like I'm portrayed as the bad guy here ;).

 

2 hours ago, IRON67 said:

Do you know a program that solves your problem better?

I've already solved my problem yesterday with my "workaround". Like I said, I rarely work with graphics (and thus with PDN), so its not like I need a program which lets me specify font size in pixels. Given the formula quoted in my post above, figuring out what's the resulting font pixel size is no longer an issue.

 

2 hours ago, IRON67 said:

As a developer I would have expected from you, Danat somewhat less narrow-mindedness.

Eh ? Was I supposed to just guess from

On 13.03.2012 at 11:05 PM, Rick Brewster said:

Font sizes in Paint.NET follow the pixels and don't take your image's DPI (aka resolution) into consideration.

...

It's focused on working with still images ... and in that domain it is pixels that run the show.

that font size is not specified in pixels although that is the word being used in explanation ? Sure, there are hints in Rick's post about it being points, but I understand them only now when I already know the answer: it's units which are equal to "pt" under 96 DPI. I'm a web dev at the moment and I'm used to thinking that "pt" and "em" are DPI dependent, so when I've read "pixels" and "don't take your image's DPI into consideration" the assumption was that it must be pixels that specify the font size.

Edited by Danat
Link to comment
Share on other sites

Quote

Yes. That's my goal - to make sure there would not be misunderstandings about font size in PDN in the future.

Your first posting says something different. I can't see there any ask for a general explanation for all users but for a solution of YOUR personal problem.

 

I wrote my last posting with the intention of finally find an end. But for the fact that the subject is supposedly solved for you, you are quite strong and you hang up on details. What do you really want?
I have already told you at the very beginning that such subtleties do not interest the average user. He is experimenting until it fits, instead of talking about "inconsistencies".
I have also asked you some other questions that you have not dealt with. Instead, you want to prove to me how problematic the specification of the font size in PDN is and how much you struggle to get behind the secret.
An effective strategy looks different in my opinion. Much fun yet. For me, this is the end.

Edited by IRON67
Link to comment
Share on other sites

27 minutes ago, IRON67 said:

I can't see there any ask for a general explanation for all users but for a solution of YOUR personal problem.

Yes, resolving the issue I posted would serve as help/reference for other users that have similar issues. That's how I usually find answers to my questions - by searching for topics that directly/indirectly address the issue I'm having. I didn't find one here, so I've decided to create it since the question is broad enough (how font size in PDN works).

 

1 hour ago, IRON67 said:

But for the fact that the subject is supposedly solved for you, you are quite strong and you hang up on details. What do you really want?

Didn't I say I want this topic to be a good contribution for others ? I've made the (now invalid) workaround in large font for this purpose as well. Btw, I think I'll use strike-through style now there to avoid confusion.

 

1 hour ago, IRON67 said:

I have already told you at the very beginning that such subtleties do not interest the average user.

You seem to enjoy providing invalid points ;) . Even the thread that I got my quote from in the first post suggests that users are interested in how font size works.

 

1 hour ago, IRON67 said:

He is experimenting until it fits

That's rather inefficient if you do it every time, when you can just ask about how it works on the forum.

 

1 hour ago, IRON67 said:

I have also asked you some other questions that you have not dealt with.

The only question that I noticed i missed is "why Arial font". The answer is - its just a standard font that any user of this forum probably have and hence can reproduce my results. I was actually using a non-standard font for my issue but the result is still the same.

 

1 hour ago, IRON67 said:

you want to prove to me how problematic the specification of the font size in PDN is and how much you struggle to get behind the secret.

Nah, you were just insisting that the font size meaning I've found is incorrect/invalid/irrelevant which, if true, would render the point of this topic meaningless, so I kept on defending my statements.

 

1 hour ago, IRON67 said:

An effective strategy looks different in my opinion

Well as a result of me posting here I've learned the right formula today so now I can effectively do the conversions and also shared it in this topic, so I think overall it was a success.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...