Re: GtkSource.PrintCompositor: How to possible printing plain text documents without lost blank lines and indentations?




 
Hi Attila,

I don't know the internals of how Pango deals with the different fonts for putting them on a layout. I have 
bumped into utf8_casefold() and utf8_normalize() before so I know fonts can get complicated. Maybe someone 
with more knowledge than I have about this can help. The first thing that I would try out is to change the 
font that is being drawn to see if that works. Maybe you can get a font that Pango will draw correctly so 
that it can be converted from txt to pdf and back again. Have you tested a few different fonts to see if they 
do the same thing? Something like the following. I am doing some guessing here.

Eric

...
def begin_print(self, operation, gtk_context):
        self.page_width = gtk_context.get_width()
        self.page_height = gtk_context.get_height()
        pango_context = self.get_pango_context()
        description = pango_context.get_font_description()
        font = description.to_string()
        print(font)
        #Test some fonts.
        new_font = Pango.FontDescription("Arial 20")
        self.pango_layout = gtk_context.create_pango_layout()
        self.pango_layout.set_font_description(new_font)
        self.pango_layout.set_width(int(self.page_width*Pango.SCALE));
        self.pango_layout.set_wrap(Pango.WrapMode.CHAR)
...

 




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]