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
1=== modified file 'src/pantheon-print.vala'
2--- src/pantheon-print.vala 2014-04-03 19:04:01 +0000
3+++ src/pantheon-print.vala 2014-08-06 07:58:55 +0000
4@@ -45,8 +45,6 @@
5 }
6 }
7
8- content = content.replace("&", "&");
9-
10 var setup = new Gtk.PageSetup ();
11
12 setup.set_top_margin (15, Gtk.Unit.MM);
13@@ -71,7 +69,7 @@
14 layout.set_width (Pango.SCALE*width);
15 height = (int)print_context.get_height ();
16
17- layout.set_markup (content, -1);
18+ layout.set_text (content, -1);
19 line_count = layout.get_line_count ();
20 Pango.LayoutLine layout_line;
21
22@@ -131,4 +129,4 @@
23 var operation = new CustomOperation (args, main_window);
24
25 operation.run (Gtk.PrintOperationAction.PRINT_DIALOG, main_window);
26-}
27+}
28\ No newline at end of file

Subscribers

People subscribed via source and target branches