0
\$\begingroup\$

The background of the situation:

  1. I need to render text. Text will be moving aroud the screen and user will have ability to interact with it by erasing with a finger, shifting the order of the words, deleting letters and so on.
  2. Text will be in many different languages.
  3. Kering and other typing tricks should be implemented when rendering.

So the problem for me:

I don't know the most efficient way to render all the text AND at the same time to have information about the location of each and every letter on the screen, plus each letter should know the word it belongs.

Now, if I make a big class of strings, where each letter is a child of each word, and words are the children of sentences, then interaction part seems trivial to implement, but rendering becomes a problem since

  • either I render each letter to the pipeline individually and store it's location in screen coordinates.

  • or I prepare one big string by gathering letters from all the above mentioned classes and render it in one run, but I loose the ability to store the coordinates of each letter in the screen coodrinates.

Is there a way to have both :) Fast rendering in one string and coodinates of each letter stored?

\$\endgroup\$
  • \$\begingroup\$ Can't you just use the relative location of your letters in a word? \$\endgroup\$ – realUser404 Oct 27 '16 at 13:34
  • \$\begingroup\$ But this location depends on the the font isn't it? +kering(a special rendering when letters are typed closer to each other than to other letters) will mix things up, +line breaks and so on. \$\endgroup\$ – coobit Oct 27 '16 at 13:48
  • \$\begingroup\$ So I want to be font independent as much as possible. Text itself will be in many different languages. \$\endgroup\$ – coobit Oct 27 '16 at 13:51
  • \$\begingroup\$ Why not render rasterrize the font in a font texture and render each letter on a polygon. Then just hit-test the text polygons and then do a pixel test on the font texture. Hit's a filled pixel then it hit the actual letter? \$\endgroup\$ – Coburn Oct 27 '16 at 14:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.