summaryrefslogtreecommitdiffstats
path: root/examples/pdf-create.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-04-03 22:10:27 +0200
committerJay Berkenbilt <ejb@ql.org>2022-04-05 20:56:19 +0200
commit77e889495f7c513ba8677df5fe662f08053709eb (patch)
tree06191e152c3d7a4e398837ebc4f87038b1797bc9 /examples/pdf-create.cc
parent12f1eb15ca3fed6310402847559a7c99d3c77847 (diff)
downloadqpdf-77e889495f7c513ba8677df5fe662f08053709eb.tar.zst
Update some code manually to get better formatting results
Add comments to force line breaks, parenthesize function arguments that are contatenated strings, etc. -- these kinds of changes improve clang-format's results and also cause emacs cc-mode to match clang-format. After this type of change, most of the time, when clang-format and emacs disagree, clang-format is better.
Diffstat (limited to 'examples/pdf-create.cc')
-rw-r--r--examples/pdf-create.cc28
1 files changed, 16 insertions, 12 deletions
diff --git a/examples/pdf-create.cc b/examples/pdf-create.cc
index 5274d0a2..b070b3aa 100644
--- a/examples/pdf-create.cc
+++ b/examples/pdf-create.cc
@@ -180,11 +180,13 @@ add_page(
size_t width = p->getWidth();
size_t height = p->getHeight();
QPDFObjectHandle image = QPDFObjectHandle::newStream(&pdf);
- auto image_dict = "<<"
- " /Type /XObject"
- " /Subtype /Image"
- " /BitsPerComponent 8"
- ">>"_qpdf;
+ auto image_dict =
+ // line-break
+ "<<"
+ " /Type /XObject"
+ " /Subtype /Image"
+ " /BitsPerComponent 8"
+ ">>"_qpdf;
image_dict.replaceKey("/ColorSpace", newName(color_space));
image_dict.replaceKey("/Width", newInteger(width));
image_dict.replaceKey("/Height", newInteger(height));
@@ -352,13 +354,15 @@ create_pdf(char const* filename)
// Add an indirect object to contain a font descriptor for the
// built-in Helvetica font.
- QPDFObjectHandle font = pdf.makeIndirectObject("<<"
- " /Type /Font"
- " /Subtype /Type1"
- " /Name /F1"
- " /BaseFont /Helvetica"
- " /Encoding /WinAnsiEncoding"
- ">>"_qpdf);
+ QPDFObjectHandle font = pdf.makeIndirectObject(
+ // line-break
+ "<<"
+ " /Type /Font"
+ " /Subtype /Type1"
+ " /Name /F1"
+ " /BaseFont /Helvetica"
+ " /Encoding /WinAnsiEncoding"
+ ">>"_qpdf);
std::vector<std::string> color_spaces;
color_spaces.push_back("/DeviceCMYK");