title: LibGDX scaling fonts when not using pixels as device units
body: <p>So, LibGDX rants in a bunch of <a href="https://github.com/libgdx/libgdx/wiki/Orthographic-camera" rel="nofollow">tutorials</a> about how it is not recommended to use device pixels as coordinates in your world. I can understand the logic and it seems reasonable, so I am updating my camera code to do this:</p>
  
  <pre><code>    float w = Gdx.graphics.getWidth();
      float h = Gdx.graphics.getHeight();
  
      aspect = h / w;
  
      camera = new OrthographicCamera(1.0f, aspect);
      camera.setToOrtho(true, 1.0f, aspect);
  </code></pre>
  
  <p>However a large part of what I do is working with fonts. Currently my font loader looks like this:</p>
  
  <pre><code>    glyphLayout = new GlyphLayout();
  
      FreeTypeFontGenerator generator = new FreeTypeFontGenerator(Gdx.files.internal("myfont.ttf"));
      FreeTypeFontGenerator.FreeTypeFontParameter parameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
  
      parameter.size = 100;
      parameter.characters = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.!'()&gt;?:";
      parameter.flip = true;
      font = generator.generateFont(parameter);
  </code></pre>
  
  <p>This results in huge sized fonts. I am confused by the apparently conflicting coordinates systems in LibGDX - why do they not recommend using pixels, and yet all font functions deal with pixels? </p>
  
  <p>How can I update this font loading code, so I get fonts which are approximately 20% of the screen size?</p>