0

I managed to draw the letters but I noticed that letters like gP, the distance between the bottom of the g and the top of the P is 10px tall, so the line should be 10 px tall?,is this always like this, if I want to draw 10pt letters, the line should be 12?

  • 1
    There are 72 points per inch. – stark Jul 21 '21 at 15:24
  • isn't that the DPI?, the dpi is set to 100. –  Jul 21 '21 at 15:29
  • No. Number of pixels is DPI * points / 72. So 100 dpi * 10 pt / 72 is 13 pixels. But you need space (leading) between lines of text. – stark Jul 21 '21 at 15:33
  • What API are you using to render/manage the fonts? it should probably have some means of querying the font's metrics -- max-ascender/decender etc. You might also want to read [this post](https://stackoverflow.com/questions/42026239/what-does-font-size-really-correspond-to). – G.M. Jul 21 '21 at 16:30
  • 1
    Points are a unit of physical length, not number of pixels, so necessarily you have to use the resolution (DPI) in converting points to pixels. It can't be the same conversion for all screens. – Nate Eldredge Jul 21 '21 at 16:35
  • The letters are going to be written to a frame of a video, usually the resolution of the videos are 1920 x 1080 but they may vary, what dpi should I use?, the videos are going to be seen in multiple screens , is there an special way of doing this for videos? @NateEldredge –  Jul 21 '21 at 17:45
  • @G.M. that post was useful thank you, I think I understand, the formula is result_size = (ascent + |descent|) / em_size * font_size, ascent and descent are in the FT_Face in freetype –  Jul 21 '21 at 18:05

0 Answers0