Merge "Measure text with the appropriate text encoding. Bug #4546327"