'Add text to the current paragraph taking CSS into account.
@param tag: Either a BeautifulSoup tag or a string
@param css: A dict'

def add_text(self, tag, css, pseudo_css, force_span_use=False):

    src = (tag.string if hasattr(tag, 'string') else tag)
    if (len(src) > 32760):
        pos = 0
        while (pos < len(src)):
            self.add_text(src[pos:(pos + 32760)], css, pseudo_css, force_span_use)
            pos += 32760
        return
    src = src.replace('\r\n', '\n').replace('\r', '\n')
    if (pseudo_css.has_key('first-letter') and (len(src) > 1)):
        src = src.lstrip()
        f = src[0]
        next = 1
        if (f in ("'", '"', u'\u201c', u'\u2018', u'\u201d', u'\u2019')):
            if (len(src) >= 2):
                next = 2
                f = src[:2]
        src = src[next:]
        ncss = css.copy()
        ncss.update(pseudo_css.pop('first-letter'))
        self.add_text(f, ncss, {}, force_span_use)
    collapse_whitespace = ((not css.has_key('white-space')) or (css['white-space'] != 'pre'))
    if (self.process_alignment(css) and collapse_whitespace):
        src = src.lstrip()
    def append_text(src):
        (fp, key, variant) = self.font_properties(css)
        for (x, y) in [(u'\xad', ''), (u'\xa0', '    '), (u'\ufb00', 'ff'), (u'\ufb01', 'fi'), (u'\ufb02', 'fl'), (u'\ufb03', 'ffi'), (u'\ufb04', 'ffl')]:
            src = src.replace(x, y)
        valigner = (lambda x: x)
        if ('vertical-align' in css):
            valign = css['vertical-align']
            if (valign in ('sup', 'super', 'sub')):
                fp['fontsize'] = int(((int(fp['fontsize']) * 5) / 3.0))
                valigner = (Sub if (valign == 'sub') else Sup)
        normal_font_size = int(fp['fontsize'])
        if (variant == 'small-caps'):
            dump = Span(fontsize=(normal_font_size - 30))
            temp = []
            for c in src:
                if c.isupper():
                    if temp:
                        dump.append(valigner(''.join(temp)))
                        temp = []
                    dump.append(Span(valigner(c), fontsize=normal_font_size))
                else:
                    temp.append(c.upper())
            src = dump
            if temp:
                src.append(valigner(''.join(temp)))
        else:
            src = valigner(src)
        if (key in ['italic', 'bi']):
            already_italic = False
            for fonts in self.fonts.values():
                it = (fonts['italic'][1] if fonts.has_key('italic') else '')
                bi = (fonts['bi'][1] if fonts.has_key('bi') else '')
                if (fp['fontfacename'] in (it, bi)):
                    already_italic = True
                    break
            if (not already_italic):
                src = Italic(src)
        unneeded = []
        for prop in fp:
            if (fp[prop] == self.current_block.textStyle.attrs[prop]):
                unneeded.append(prop)
        for prop in unneeded:
            fp.pop(prop)
        attrs = {}
        if (('color' in css) and (not self.ignore_colors)):
            attrs['textcolor'] = lrs_color(css['color'])
        attrs.update(fp)
        elem = (Span(text=src, **attrs) if (attrs or force_span_use) else src)
        if css.has_key('text-decoration'):
            dec = css['text-decoration'].lower()
            linepos = ('after' if (dec == 'underline') else ('before' if (dec == 'overline') else None))
            if (linepos is not None):
                elem = EmpLine(elem, emplineposition=linepos)
        self.current_para.append(elem)
    if collapse_whitespace:
        src = re.sub('\\s{1,}', '    ', src)
        if (self.stripped_space and (len(src) == len(src.lstrip(u'    \n\r DCTB ')))):
            src = (self.stripped_space + src)
        (src, orig) = (src.rstrip(u'    \n\r DCTB '), src)
        self.stripped_space = orig[len(src):]
        if (len(self.previous_text) != len(self.previous_text.rstrip(u'    \n\r DCTB '))):
            src = src.lstrip(u'    \n\r DCTB ')
        if len(src):
            self.previous_text = src
            append_text(src)
    else:
        srcs = src.split('\n')
        for src in srcs[:(-1)]:
            append_text(src)
            self.line_break()
        last = srcs[(-1)]
        if len(last):
            append_text(last)
