Unfortunately, that suggestion is no better. The rendered width of each
character varies, so the there is no single value that can place the
cursor in the correct place. If the character 'h' is 10 pixels and 'i'
is 9 pixels, then 'hih' will be 29 pixels and the cursor would need to
be placed at 0, 10, 19 and 29 pixels to make sense.

My solution for the labels, which works fine, is to find the rendered
length of the first character, then the length of the first two
characters, then the length of the first 3 characters and so on. Storing
all these values allows me to work out the correct position.

Because there's quite a bit of repetition, this can take a little bit of
CPU time. My only concern with the input box, is that it needs to
recalculate all of this, everytime the user types something, and it is
designed for use in games where a fraction of a millisecond can still be
important to keep the game running smoothly.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1001033

Title:
  Monospaced font is not monospaced

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/freetype/+bug/1001033/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to