Merge lp:~vikoadi/pantheon-print/fix-markup-print into lp:~elementary-apps/pantheon-print/trunk

Proposed by Viko Adi Rahmawan
Status: Merged
Approved by: Cody Garver
Approved revision: 12
Merged at revision: 10
Proposed branch: lp:~vikoadi/pantheon-print/fix-markup-print
Merge into: lp:~elementary-apps/pantheon-print/trunk
Diff against target: 28 lines (+2/-4)
1 file modified
src/pantheon-print.vala (+2/-4)
To merge this branch: bzr merge lp:~vikoadi/pantheon-print/fix-markup-print
Reviewer Review Type Date Requested Status
Cody Garver (community) Approve
Niclas Lockner (community) Approve
elementary Apps team test with actual printer Pending
Review via email: mp+229720@code.launchpad.net

Commit message

Use set_text to ensure escaped text (lp:1086015)

Description of the change

pantheon-print cannot print text with markup
for example try to print html text.
so this replace greater than and lower than with &gt and &lt

nb:I cannot try with printer as i have none, but at least it work in print to file

To post a comment you must log in.
Revision history for this message
Niclas Lockner (niclasl) wrote :

The markup shouldn't be manually escaped, but escaped with Markup.escape_text. After that change, printing from Scratch to a PDF works for me.

review: Needs Fixing
11. By Viko Adi Rahmawan

use set_text instead of set_markup

Revision history for this message
Niclas Lockner (niclasl) wrote :

Printing works as in I can print the generated pantheon-print.c, a simple text file with some åäö%"/€ characters, and a simple html page. I get the same result with set_text as with set_markup, so it's OK for me to just use set_text.

Remove the lines you commented out.

review: Needs Fixing
12. By Viko Adi Rahmawan

remove commented code

Revision history for this message
Niclas Lockner (niclasl) :
review: Approve
Revision history for this message
Cody Garver (codygarver) wrote :

Works with real printer too

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/pantheon-print.vala'
--- src/pantheon-print.vala 2014-04-03 19:04:01 +0000
+++ src/pantheon-print.vala 2014-08-06 07:58:55 +0000
@@ -45,8 +45,6 @@
45 }45 }
46 } 46 }
4747
48 content = content.replace("&", "&");
49
50 var setup = new Gtk.PageSetup ();48 var setup = new Gtk.PageSetup ();
5149
52 setup.set_top_margin (15, Gtk.Unit.MM);50 setup.set_top_margin (15, Gtk.Unit.MM);
@@ -71,7 +69,7 @@
71 layout.set_width (Pango.SCALE*width);69 layout.set_width (Pango.SCALE*width);
72 height = (int)print_context.get_height (); 70 height = (int)print_context.get_height ();
73 71
74 layout.set_markup (content, -1); 72 layout.set_text (content, -1);
75 line_count = layout.get_line_count ();73 line_count = layout.get_line_count ();
76 Pango.LayoutLine layout_line;74 Pango.LayoutLine layout_line;
7775
@@ -131,4 +129,4 @@
131 var operation = new CustomOperation (args, main_window);129 var operation = new CustomOperation (args, main_window);
132130
133 operation.run (Gtk.PrintOperationAction.PRINT_DIALOG, main_window);131 operation.run (Gtk.PrintOperationAction.PRINT_DIALOG, main_window);
134}132}
135\ No newline at end of file133\ No newline at end of file

Subscribers

People subscribed via source and target branches