Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(44)  |  Call(15)  |  Derive(0)  |  Import(29)
Attempts to break a word which lacks spaces into two parts, the first of which
fits in the remaining space.  It is allowed to add hyphens or whatever it wishes.

This is intended as a wrapper for some language- and user-choice-specific splitting
algorithms.  It should only be called after line breaking on spaces, which covers western
languages and is highly optimised already.  It works on the 'last unsplit word'.

Presumably with further study one could write a Unicode splitting algorithm for text
fragments whick was much faster.
(more...)

        def wordSplit(word, maxWidths, fontName, fontSize, encoding='utf8'):
    """Attempts to break a word which lacks spaces into two parts, the first of which
    fits in the remaining space.  It is allowed to add hyphens or whatever it wishes.

    This is intended as a wrapper for some language- and user-choice-specific splitting
    algorithms.  It should only be called after line breaking on spaces, which covers western
    languages and is highly optimised already.  It works on the 'last unsplit word'.

    Presumably with further study one could write a Unicode splitting algorithm for text
    fragments whick was much faster.

    Courier characters should be 6 points wide.
    >>> wordSplit('HelloWorld', 30, 'Courier', 10)
    [[0.0, 'Hello'], [0.0, 'World']]
    >>> wordSplit('HelloWorld', 31, 'Courier', 10)
    [[1.0, 'Hello'], [1.0, 'World']]
    """
    if not isUnicode(word):
        uword = word.decode(encoding)
    else:
        uword = word

    charWidths = getCharWidths(uword, fontName, fontSize)
    lines = dumbSplit(uword, charWidths, maxWidths)

    if not isUnicode(word):
        lines2 = []
        #convert back
        for (extraSpace, text) in lines:
            lines2.append([extraSpace, text.encode(encoding)])
        lines = lines2

    return lines
        


src/d/j/django-admin-report-HEAD/example/lib/sx/pisa3/reportlab_paragraph.py   django-admin-report(Download)
from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY
from reportlab.lib.utils import _className
from reportlab.lib.textsplit import wordSplit, ALL_CANNOT_START
from copy import deepcopy
from reportlab.lib.abag import ABag
            text = ''.join(getattr(f,'words',[]))
 
        from reportlab.lib.textsplit import wordSplit
        lines = wordSplit(text, maxWidths[0], f.fontName, f.fontSize)
        #the paragraph drawing routine assumes multiple frags per line, so we need an

src/d/j/django-admin-report-HEAD/example/lib/reportlab/platypus/paragraph.py   django-admin-report(Download)
from reportlab.lib.utils import _className
from reportlab.lib.geomutils import normalizeTRBL
from reportlab.lib.textsplit import wordSplit, ALL_CANNOT_START
from copy import deepcopy
from reportlab.lib.abag import ABag
                text = ''.join(getattr(f,'words',[]))
 
            from reportlab.lib.textsplit import wordSplit
            lines = wordSplit(text, maxWidths[0], f.fontName, f.fontSize)
            #the paragraph drawing routine assumes multiple frags per line, so we need an

src/w/e/web2py-appreport-HEAD/modules/plugin_appreport/libs/appreport/libs/pisa/xhtml2pdf/sx/pisa3/reportlab_paragraph.py   web2py-appreport(Download)
from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY
from reportlab.lib.utils import _className
from reportlab.lib.textsplit import wordSplit, ALL_CANNOT_START
from copy import deepcopy
from reportlab.lib.abag import ABag
            text = ''.join(getattr(f,'words',[]))
 
        from reportlab.lib.textsplit import wordSplit
        lines = wordSplit(text, maxWidths[0], f.fontName, f.fontSize)
        #the paragraph drawing routine assumes multiple frags per line, so we need an

src/m/w/mwlib.ext-0.13.2/upstream-src/src/reportlab/platypus/paragraph.py   mwlib.ext(Download)
from reportlab.lib.utils import _className
from reportlab.lib.geomutils import normalizeTRBL
from reportlab.lib.textsplit import wordSplit, ALL_CANNOT_START
from copy import deepcopy
from reportlab.lib.abag import ABag
                text = ''.join(getattr(f,'words',[]))
 
            from reportlab.lib.textsplit import wordSplit
            lines = wordSplit(text, maxWidths, f.fontName, f.fontSize)
            #the paragraph drawing routine assumes multiple frags per line, so we need an

src/r/e/reportlab-3.1.8/src/reportlab/platypus/paragraph.py   reportlab(Download)
from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY
from reportlab.lib.geomutils import normalizeTRBL
from reportlab.lib.textsplit import wordSplit, ALL_CANNOT_START
from copy import deepcopy
from reportlab.lib.abag import ABag
                text = ''.join(getattr(f,'words',[]))
 
            from reportlab.lib.textsplit import wordSplit
            lines = wordSplit(text, maxWidths, f.fontName, f.fontSize)
            #the paragraph drawing routine assumes multiple frags per line, so we need an

src/r/e/ReportLab-HEAD/src/reportlab/platypus/paragraph.py   ReportLab(Download)
from reportlab.lib.utils import _className
from reportlab.lib.geomutils import normalizeTRBL
from reportlab.lib.textsplit import wordSplit, ALL_CANNOT_START
from copy import deepcopy
from reportlab.lib.abag import ABag
                text = ''.join(getattr(f,'words',[]))
 
            from reportlab.lib.textsplit import wordSplit
            lines = wordSplit(text, maxWidths[0], f.fontName, f.fontSize)
            #the paragraph drawing routine assumes multiple frags per line, so we need an

src/i/e/iellos-HEAD/lib/sx/pisa3/reportlab_paragraph.py   iellos(Download)
from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY
from reportlab.lib.utils import _className
from reportlab.lib.textsplit import wordSplit, ALL_CANNOT_START
from copy import deepcopy
from reportlab.lib.abag import ABag
            text = ''.join(getattr(f,'words',[]))
 
        from reportlab.lib.textsplit import wordSplit
        lines = wordSplit(text, maxWidths[0], f.fontName, f.fontSize)
        #the paragraph drawing routine assumes multiple frags per line, so we need an

src/i/e/iellos-HEAD/lib/reportlab/platypus/paragraph.py   iellos(Download)
from reportlab.lib.utils import _className
from reportlab.lib.geomutils import normalizeTRBL
from reportlab.lib.textsplit import wordSplit, ALL_CANNOT_START
from copy import deepcopy
from reportlab.lib.abag import ABag
                text = ''.join(getattr(f,'words',[]))
 
            from reportlab.lib.textsplit import wordSplit
            lines = wordSplit(text, maxWidths[0], f.fontName, f.fontSize)
            #the paragraph drawing routine assumes multiple frags per line, so we need an

src/w/m/wms-HEAD/sx/pisa3/reportlab_paragraph.py   wms(Download)
from reportlab.lib.enums import TA_LEFT, TA_RIGHT, TA_CENTER, TA_JUSTIFY
from reportlab.lib.utils import _className
from reportlab.lib.textsplit import wordSplit, ALL_CANNOT_START
from copy import deepcopy
from reportlab.lib.abag import ABag
            text = ''.join(getattr(f,'words',[]))
 
        from reportlab.lib.textsplit import wordSplit
        lines = wordSplit(text, maxWidths[0], f.fontName, f.fontSize)
        #the paragraph drawing routine assumes multiple frags per line, so we need an

src/w/m/wms-HEAD/reportlab/platypus/paragraph.py   wms(Download)
from reportlab.lib.utils import _className
from reportlab.lib.geomutils import normalizeTRBL
from reportlab.lib.textsplit import wordSplit, ALL_CANNOT_START
from copy import deepcopy
from reportlab.lib.abag import ABag
            text = ''.join(getattr(f,'words',[]))
 
        from reportlab.lib.textsplit import wordSplit
        lines = wordSplit(text, maxWidths[0], f.fontName, f.fontSize)
        #the paragraph drawing routine assumes multiple frags per line, so we need an

  1 | 2  Next