e0cbe102023b194746a4102d6a193c713cd74944,quotekiosk.py,AutoSizerWindow,draw_text,#AutoSizerWindow#,140

Before Change



        fontsize = 100

        while fontsize:
            font = f"{self.fontname} {fontsize}"
            desc = Pango.font_description_from_string(font)
            layout.set_font_description(desc)
            pxsize = layout.get_pixel_size()
            if pxsize.width < self.width - self.border_size*2 and \
               pxsize.height < self.height - self.border_size*2:
                break
            fontsize -= 1

        ctx.move_to(self.border_size, self.border_size)
        PangoCairo.show_layout(ctx, layout)

    def read_pixbuf(self, filename):

After Change


        // Set color and alpha
        ctx.set_source_rgba(*self.text_color, self.alpha)

        if not self.layout: // or not self.d_alpha or self.alpha == 0:
            // print("Laying out text")
            self.layout = PangoCairo.create_layout(ctx)
            self.layout.set_text(self.content, -1)

            // For some reason pango width has to be 1024 times the width.
            // Why? Where does this 1024 come from?
            // No one explains this anywhere.
            self.layout.set_width(1024 * (self.width - self.border_size*2))
            self.layout.set_wrap(Pango.WrapMode.WORD_CHAR)

            fontsize = 100

            while fontsize:
                font = f"{self.fontname} {fontsize}"
                desc = Pango.font_description_from_string(font)
                self.layout.set_font_description(desc)
                pxsize = self.layout.get_pixel_size()
                if pxsize.width < self.width - self.border_size*2 and \
                   pxsize.height < self.height - self.border_size*2:
                    break
                fontsize -= 1

        ctx.move_to(self.border_size, self.border_size)

        PangoCairo.show_layout(ctx, self.layout)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: akkana/scripts
Commit Name: e0cbe102023b194746a4102d6a193c713cd74944
Time: 2020-01-17
Author: akkana@shallowsky.com
File Name: quotekiosk.py
Class Name: AutoSizerWindow
Method Name: draw_text


Project Name: WheatonCS/Lexos
Commit Name: 859ea294b86b621dba43e43a0bf50f3e39244708
Time: 2015-06-02
Author: jingxian.liu@gmail.com
File Name: prepare/cutter.py
Class Name:
Method Name: stripLeadingWhiteSpace


Project Name: WheatonCS/Lexos
Commit Name: 043728e6cf16fb5880976655c83bb0cfa8a3145a
Time: 2017-08-01
Author: darias0826@gmail.com
File Name: lexos/processors/prepare/cutter.py
Class Name:
Method Name: strip_leading_blank_lines