With this script for Adobe InDesing you can determine the x-height of a text passage. And it is also a good example of a simple ScriptUI dialog.
https://www.rolanddreger.net/de/503/x-hoehe-ermittlen
Free Script for private and commercial use Creativ Commons Licence: Roland Dreger, CC BY 3.0 AT
Use at your own risk.