khtml Library API Documentation

break_lines.h

00001 #ifndef BREAK_LINES_H
00002 #define BREAK_LINES_H
00003 
00004 #include <qstring.h>
00005 
00006 namespace khtml {
00007     inline bool isBreakable( const QChar *str, int pos, int /*len*/ )
00008     {
00009         const QChar *c = str+pos;
00010         unsigned short ch = c->unicode();
00011         if ( ch > 0xff ) {
00012             // not latin1, need to do more sophisticated checks for asian fonts
00013             unsigned char row = c->row();
00014             if ( row == 0x0e ) {
00015                 // 0e00 - 0e7f == Thai
00016                 if ( c->cell() < 0x80 ) {
00017                     // we don't a have a thai line breaking lib at the moment, allow
00018                     // breaks everywhere except directly before punctuation.
00019                     return true;
00020                 } else
00021                     return false;
00022             }
00023             if ( row > 0x2d && row < 0xfb || row == 0x11 )
00024                 // asian line breaking. Everywhere allowed except directly
00025                 // in front of a punctuation character.
00026                 return true;
00027             else // no asian font
00028                 return c->isSpace();
00029         } else {
00030             if ( ch == ' ' || ch == '\n' )
00031                 return true;
00032         }
00033         return false;
00034     }
00035 
00036 }
00037 
00038 #endif
KDE Logo
This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:33:28 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001