SDL's TextWrapper and TextSplitter

From LinuxMCE
Revision as of 05:32, 25 August 2009 by Ray N (Talk | contribs)

(diff) ←Older revision | view current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search
This page was written by Pluto and imported with their permission when LinuxMCE branched off in February, 2007. In general any information should apply to LinuxMCE. However, this page should be edited to reflect changes to LinuxMCE and remove old references to Pluto.
The logic with text wrapping in Orbiter SDL is changed now. TextSplitter will slit a text in words. If between words there were spaces, the spaces will be preserved in the word, if not, no space will be added in the list with words. In TextWrapper, when the words are rendered, not extra space will be rendered.

Examples: 1) if the text is "I am cool", will have three words: "I ", "am " and "cool". 2) if the text is "I_am_busy right now", the words can be: "I_am", "busy ", "right ", "now ".

This change avoids the logic flaw from the old behavior when extra spaces appeared after non alpha-numeric chars. ("I_am_busy right now" was splitted as "I_", "am_", "busy", "right", "now", which was rendered as: "I_ am_ busy right now".

(files location: src/Splitter/TextSplitter.cpp src/Splitter/TextWrapper.cpp)