   function that returns width in pixels of a single char based on .ttf file and size
  is there by chance a library that contains a function that would return the width in pixels of a single char based on font from a .ttf file and font size. so that you might call it like GetCharWidth("x",DotTTFfile,10); and DotTTFfile could be any thing from a string to a char pointer to specialized class for said library. thanks.   
  Font rendering libraries contain such functions. The size in pixels depends on too many factors, usually some rendering context (whatever that means for particular library), just font-size is not enough.Unless font is monospaced, then the size depends on surrounding characters as well.For example.   