Fix editor TextField cursor alignment

Whenever I increase the font size of my TextField it makes the cursor and highlight shift down. Is there a way to fix this?

39404-screen-shot-2015-01-23-at-23201-pm.png
39405-screen-shot-2015-01-23-at-23251-pm.png

I’m using this custom GUIStyle:

  MyStyle = new GUIStyle(EditorStyles.textField);
  MyStyle.fixedHeight = 64;
  MyStyle.alignment = TextAnchor.MiddleLeft;
  MyStyle.fontSize = 32;

And I’m rendering the TextField like this:

  query = EditorGUILayout.TextField(query, MyStyle,
      GUILayout.Height(MyStyle.fixedHeight));

Removing the GUILayout.Height and fixedHeight don’t seem to have an effect outside of layout (the cursor and highlight is still offset the same way).

This turned out to be a font scaling issue. The solution is to create a font in the size needed since even dynamic fonts are not handled properly for text fields.