Пример #1
0
    import sys, os, os.path as op
    
    from t4.psg.drawing.engine_two.styles import lists
    from t4.psg.drawing.engine_two.styles.computer_modern \
      import cmu_sans_serif as cmuss, style
    from t4.psg.util.colors import red
    from t4.psg.drawing.engine_two.processors import render_to_filename

    from ll.xist.ns import html, chars

    demo = html.html(html.p(u"Hallo ", html.strong("schöne "), u"Welt!"),
                     html.p(u"DiesesWort",
                            html.strong(u"Keine"),
                            u"Leerzeichen."),
                     html.p(u"Dieses",
                            html.big(" Leerzeichen "),
                            u"ist groß."),
                     html.p(u"Dieses ",
                            html.big("Leerzeichen"),
                            u" ist klein."))

    richtext = convert(demo, {"p": {"margin": (12, 0, 0, 0)}})
    
    print
    richtext.__print__()

    render_to_filename(richtext, "xist.ps")

        
    
Пример #2
0
                           name="h3"),
               "bullet_list": style({
                   "list-style": lists.disk(),}, name="list"),
               "bold": style({"font-weight": "bold"},
                             name="bold"),
               "italic": style({"text-style": "italic"},
                               name="italic"),
               "bold-italic": style({"font-weight": "bold",
                                     "text-style": "italic"},
                                    name="bold-italic"),
               "highlighted": style({"font-size": 14,
                                     "font-weight": "bold",
                                     "line-height": 16,
                                     "color": red},
                                    name="highlighted") }        
    
    richtext = convert(u"Dies ist ein @@kleiner@@ Test innen''drinn''fett.",
                       styles)
    # richtext.__print__()
    # render(richtext, "hello_world.ps")
    
    # richtext = convert(u"Hallo @@bunte@@ Welt!", styles)
    #richtext.__print__()

    docstring = __doc__.replace("§", unicodedata.lookup("soft hyphen"))
    richtext = convert(docstring, styles)

    # This will load the required font information to RAM.
    richtext.__print__()
    render_to_filename(richtext, "docstring.ps")