Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(581)

Side by Side Diff: printing/pdf_ps_metafile_linux.h

Issue 196071: Embed fonts information into resulting PDF file for printing. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | printing/pdf_ps_metafile_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PRINTING_PDF_PS_METAFILE_LINUX_H_ 5 #ifndef PRINTING_PDF_PS_METAFILE_LINUX_H_
6 #define PRINTING_PDF_PS_METAFILE_LINUX_H_ 6 #define PRINTING_PDF_PS_METAFILE_LINUX_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // TODO(myhuang): I plan to also do page setup here (margins, the header 57 // TODO(myhuang): I plan to also do page setup here (margins, the header
58 // and the footer). At this moment, only pre-defined margins for US letter 58 // and the footer). At this moment, only pre-defined margins for US letter
59 // paper are hard-coded here. 59 // paper are hard-coded here.
60 // |shrink| decides the scaling factor to fit raw printing results into 60 // |shrink| decides the scaling factor to fit raw printing results into
61 // printable area. 61 // printable area.
62 bool FinishPage(float shrink); 62 bool FinishPage(float shrink);
63 63
64 // Closes resulting PDF/PS file. No further rendering is allowed. 64 // Closes resulting PDF/PS file. No further rendering is allowed.
65 void Close(); 65 void Close();
66 66
67 // Selects the font associated with |font_id| in |context|.
68 // Return true on success.
69 static bool SelectFontById(cairo_t* context, uint32_t font_id);
70
67 // Returns size of PDF/PS contents stored in buffer |all_pages_|. 71 // Returns size of PDF/PS contents stored in buffer |all_pages_|.
68 // This function should ONLY be called after PDF/PS file is closed. 72 // This function should ONLY be called after PDF/PS file is closed.
69 unsigned int GetDataSize() const; 73 unsigned int GetDataSize() const;
70 74
71 // Copies PDF/PS contents stored in buffer |all_pages_| into |dst_buffer|. 75 // Copies PDF/PS contents stored in buffer |all_pages_| into |dst_buffer|.
72 // This function should ONLY be called after PDF/PS file is closed. 76 // This function should ONLY be called after PDF/PS file is closed.
73 // Returns true only when success. 77 // Returns true only when success.
74 bool GetData(void* dst_buffer, size_t dst_buffer_size) const; 78 bool GetData(void* dst_buffer, size_t dst_buffer_size) const;
75 79
76 // Saves PDF/PS contents stored in buffer |all_pages_| into |filename| on 80 // Saves PDF/PS contents stored in buffer |all_pages_| into |filename| on
77 // the disk. 81 // the disk.
78 // This function should ONLY be called after PDF/PS file is closed. 82 // This function should ONLY be called after PDF/PS file is closed.
79 bool SaveTo(const FilePath& filename) const; 83 bool SaveTo(const FilePath& filename) const;
80 84
81 private: 85 private:
82 // Cleans up all resources. 86 // Cleans up all resources.
83 void CleanUp(); 87 void CleanUpAll();
84 88
85 FileFormat format_; 89 FileFormat format_;
86 90
87 // Cairo surface and context for entire PDF/PS file. 91 // Cairo surface and context for entire PDF/PS file.
88 cairo_surface_t* surface_; 92 cairo_surface_t* surface_;
89 cairo_t* context_; 93 cairo_t* context_;
90 94
91 // Cairo surface and context for current page only. 95 // Cairo surface and context for current page only.
92 cairo_surface_t* page_surface_; 96 cairo_surface_t* page_surface_;
93 cairo_t* page_context_; 97 cairo_t* page_context_;
94 98
95 // Buffer stores PDF/PS contents for entire PDF/PS file. 99 // Buffer stores PDF/PS contents for entire PDF/PS file.
96 std::string all_pages_; 100 std::string all_pages_;
97 101
98 // Buffer stores PDF/PS contents for current page only. 102 // Buffer stores PDF/PS contents for current page only.
99 std::string current_page_; 103 std::string current_page_;
100 104
101 DISALLOW_COPY_AND_ASSIGN(PdfPsMetafile); 105 DISALLOW_COPY_AND_ASSIGN(PdfPsMetafile);
102 }; 106 };
103 107
104 } // namespace printing 108 } // namespace printing
105 109
106 #endif // PRINTING_PDF_PS_METAFILE_LINUX_H_ 110 #endif // PRINTING_PDF_PS_METAFILE_LINUX_H_
OLDNEW
« no previous file with comments | « no previous file | printing/pdf_ps_metafile_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698