title: Freetype correct size rendering
body: <p>I'm currently writing an OpenGL application that render a lot of text. Text rendering was previously done with Qt but for performence reason we change all by OpenGL rendering.</p>
  
  <p>I made all the shader / rendering pipeline, it's working well.
  But after reading the doc of freetype again, I still don't understand how to render correctly at the right size.</p>
  
  <p>For now I use the function </p>
  
  <pre><code>FT_Set_Pixel_Sizes(face, 0, mFontSize);
  </code></pre>
  
  <p>To set the size of my font, but I know that it's incorrect, because Qt was rendering in 'point' (I guess..), so all the text is now smaller.</p>
  
  <p>I read about using the function </p>
  
  <pre><code>FT_Set_Char_Size(
        face,    /* handle to face object           */
        0,       /* char_width in 1/64th of points  */
        16*64,   /* char_height in 1/64th of points */
        300,     /* horizontal device resolution    */
        300 );   /* vertical device resolution      */
  </code></pre>
  
  <p>And here come my first question, what I should put in the resolution? I can't know the DPI of the screen... What standard I should use?</p>
  
  <p>Also, I need the text to be at fixed size on the screen, at whatever the zoom is. For now, I pre-compute my glyph's vertex on CPU side as on this tutorial <a href="https://learnopengl.com/In-Practice/Text-Rendering" rel="nofollow noreferrer">https://learnopengl.com/In-Practice/Text-Rendering</a>
  But for the parameter "scale", I use 1.f / font_size.</p>
  
  <p>And then, on the shader I do </p>
  
  <pre><code>(camera * vec3(char_position.xy, 1)).xy + vertex.xy / viewport * font_size.
  </code></pre>
  
  <p>With this I can have fixed size on the screen, with a maximum of 45 pixel as I asked to freetype. But it's not correct from the point of view of what was rendered by Qt.</p>
  
  <p>But I don't see how to do it with the DPI 'solution'</p>