I´m making a PHP script that prints a MySQL table on the screen, but I need to format the fields in a table with a fixed width since the table will then be printed by the user and I want the report to print correctly in all cases. The problem I have is that some fields will be longer and won´t fit in the widht I want. I don´t want the field to wrap either, so I need to cut the string before sending it. Since the nice fonts are all variable width, most fields look as if more characters could fit in the space because I´m trimming the string by a certain number of characters and depending on the characters, the width will vary. Is there a function I could use that can trim a string based on the number of pixels that the string will occupy when printed ?