0

Given the following letters, all are absolutely aligned vertically to the bottom, however I need to align them to their baseline.

enter image description here

How can that calculate the letter vertical offset?

  • Each letter is currently displayed vertically with y = bottomY - fontSize (all in pixels)
  • fontSize is proportional to h (i.e. fontSize = h * 0.5 for 50%)
  • the descent value d is a variable obtained per font family, e.g. d = h * 0.22

I know that, for a scaling of 1 (100%), the offset should be 0, and it seems like for 0.5 (50%), the offset seems to offset = d / 2, but what about when the scaling is 0.1 (10%)?

Thank you for helping me understand the math behind this.

Hans Lundmark
  • 53,395
  • What does this have to do with the tag linear-programming? – Hans Lundmark Jun 21 '21 at 13:57
  • I don't know. I had to add a tag, and did not know what to put. I'm a programmer, and when I ask on SO, I know what tag goes there but I'm not a mathematician. – Yanick Rochon Jun 21 '21 at 14:09
  • If you read the tag description, you'll see that linear programming has a very specific meaning which is completely different from your problem here. That said, it's not so easy to say what topic your question belongs to. I'll change it to plane-geometry, and we'll see if anyone else comes up with something better. – Hans Lundmark Jun 21 '21 at 14:14
  • I've been on StackOverflow for over 11 years, and your comment is why I'm always relunctant to come here; either change the tags if you find it innapopriate, or answer the question. All this is irrelevant, and does not help anything. – Yanick Rochon Jun 21 '21 at 14:38

0 Answers0