diff options
author | Sebastian Geerken <devnull@localhost> | 2012-12-13 22:43:15 +0100 |
---|---|---|
committer | Sebastian Geerken <devnull@localhost> | 2012-12-13 22:43:15 +0100 |
commit | f5380a56b1a6b83fea9b1c97140d4b1c8fe4ba49 (patch) | |
tree | 93a792dc006a046b4187acf95c6c8b79df97a920 /dw/hyphenator.cc | |
parent | 1471c240d49b60ef081f50230f2eee8852793716 (diff) |
New function nextUtf8Char; usage in dw::Hyphenator and (partly) dw::Textblock.
Diffstat (limited to 'dw/hyphenator.cc')
-rw-r--r-- | dw/hyphenator.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/dw/hyphenator.cc b/dw/hyphenator.cc index 4fe9433b..cc92b77f 100644 --- a/dw/hyphenator.cc +++ b/dw/hyphenator.cc @@ -16,6 +16,7 @@ using namespace lout::object; using namespace lout::container::typed; using namespace lout::misc; +using namespace lout::unicode; namespace dw { @@ -204,7 +205,7 @@ bool Hyphenator::isCharPartOfActualWord (char *s) (unsigned char)s[1] == 0x9f /* ß */ )); #endif - return lout::unicode::isAlpha (lout::unicode::decodeUtf8 (s)); + return isAlpha (decodeUtf8 (s)); } /** @@ -315,9 +316,10 @@ void Hyphenator::hyphenateSingleWord(core::Platform *platform, // No hyphens in the first two chars or the last two. // Characters are not bytes, so UTF-8 characters must be counted. - int numBytes1Start = platform->nextGlyph (wordLc, 0); - int numBytes2Start = platform->nextGlyph (wordLc, numBytes1Start); - for (int i = 0; i < numBytes2Start; i++) + const char *bytesStart = nextUtf8Char (nextUtf8Char (wordLc)); + // TODO Check bytesStart == NULL; + int numBytesStart = bytesStart - wordLc; + for (int i = 0; i < numBytesStart; i++) points.set (i + 1, 0); int len = strlen (wordLc); |