o ‡ÎÖa~ã@s:dZddlmZddlmZmZdgZGdd„deƒZdS)zØ pygments.formatters.rtf ~~~~~~~~~~~~~~~~~~~~~~~ A formatter that generates RTF files. :copyright: Copyright 2006-2021 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. é)Ú Formatter)Ú get_int_optÚ surrogatepairÚ RtfFormatterc@s@eZdZdZdZdgZdgZdd„Zdd„Zd d „Z d d „Z d S)raˆ Format tokens as RTF markup. This formatter automatically outputs full RTF documents with color information and other useful stuff. Perfect for Copy and Paste into Microsoft(R) Word(R) documents. Please note that ``encoding`` and ``outencoding`` options are ignored. The RTF format is ASCII natively, but handles unicode characters correctly thanks to escape sequences. .. versionadded:: 0.6 Additional options accepted: `style` The style to use, can be a string or a Style subclass (default: ``'default'``). `fontface` The used font family, for example ``Bitstream Vera Sans``. Defaults to some generic font which is supposed to have fixed width. `fontsize` Size of the font used. Size is specified in half points. The default is 24 half-points, giving a size 12 font. .. versionadded:: 2.0 ÚRTFÚrtfz*.rtfcKs4tj|fi|¤Ž| d¡pd|_t|ddƒ|_dS)a’ Additional options accepted: ``fontface`` Name of the font used. Could for example be ``'Courier New'`` to further specify the default which is ``'\fmodern'``. The RTF specification claims that ``\fmodern`` are "Fixed-pitch serif and sans serif fonts". Hope every RTF implementation thinks the same about modern... ÚfontfaceÚÚfontsizerN)rÚ__init__Úgetrrr )ÚselfÚoptions©rú9/usr/lib/python3/dist-packages/pygments/formatters/rtf.pyr 2s zRtfFormatter.__init__cCs| dd¡ dd¡ dd¡S)Nú\z\\ú{z\{ú}z\})Úreplace)r ÚtextrrrÚ_escapeBs þzRtfFormatter._escapecCs”|sdS| |¡}g}|D]3}t|ƒ}|dkr| t|ƒ¡q d|kr)dkr3nn| d|¡q d|kr@| dt|ƒ¡q d |¡ dd¡S)Nr é€iz{\u%d}z {\u%d}{\u%d}Ú z\par )rÚordÚappendÚstrrÚjoinr)r rÚbufÚcÚcnrrrÚ _escape_textGs €zRtfFormatter._escape_textc Csò| d|jrd| |j¡pd¡i}d}|jD]?\}}|d|d|dfD]/}|rW||vrW|||<| dt|d d …d ƒt|d d …d ƒt|d d …d ƒf¡|d7}q(q| d¡|jri| d|j¡|D]†\}} |j |¡s„|jr„|j}|j |¡s„|jsx|j |¡}g} |dr›|   d||d¡|drª|   d||d¡|dr³|   d¡|dr¼|   d¡|drÅ|   d¡|drÔ|   d||d¡d  | ¡} | râ| d| ¡| |  | ¡¡| rñ| d¡qk| d¡dS)NzJ{\rtf1\ansi\uc0\deff0{\fonttbl{\f0\fmodern\fprq1\fcharset0%s;}}{\colortbl;ú r éÚcolorÚbgcolorÚborderz\red%d\green%d\blue%d;rééééz}\f0 z\fs%dz\cb%dz\cf%dÚboldz\bÚitalicz\iÚ underlinez\ulz\chbrdr\chcfpat%dz{%s r) ÚwriterrÚstyleÚintr Ú styles_tokenÚparentÚstyle_for_tokenrrr ) r Ú tokensourceÚoutfileÚ color_mappingÚoffsetÚ_r.r#ÚttypeÚvaluerÚstartrrrÚformat_unencoded_sfÿü ý€ø  ÿ     ÿ  €zRtfFormatter.format_unencodedN) Ú__name__Ú __module__Ú __qualname__Ú__doc__ÚnameÚaliasesÚ filenamesr rr r;rrrrrs N)r?Úpygments.formatterrÚ pygments.utilrrÚ__all__rrrrrÚs