cairo 1.15.3-x86-mingw32 → 1.15.4-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of cairo might be problematic. Click here for more details.

Files changed (118) hide show
  1. checksums.yaml +4 -4
  2. data/NEWS +24 -0
  3. data/Rakefile +3 -3
  4. data/ext/cairo/rb_cairo.h +11 -1
  5. data/ext/cairo/rb_cairo_constants.c +56 -1
  6. data/ext/cairo/rb_cairo_context.c +100 -1
  7. data/ext/cairo/rb_cairo_exception.c +45 -0
  8. data/ext/cairo/rb_cairo_surface.c +126 -1
  9. data/lib/2.2/cairo.so +0 -0
  10. data/lib/2.3/cairo.so +0 -0
  11. data/lib/2.4/cairo.so +0 -0
  12. data/lib/cairo.rb +2 -0
  13. data/samples/link.rb +19 -0
  14. data/test/cairo-test-utils.rb +1 -0
  15. data/test/test_context.rb +22 -0
  16. data/test/test_pdf_surface.rb +131 -0
  17. data/vendor/local/bin/fc-cache.exe +0 -0
  18. data/vendor/local/bin/fc-cat.exe +0 -0
  19. data/vendor/local/bin/fc-list.exe +0 -0
  20. data/vendor/local/bin/fc-match.exe +0 -0
  21. data/vendor/local/bin/fc-pattern.exe +0 -0
  22. data/vendor/local/bin/fc-query.exe +0 -0
  23. data/vendor/local/bin/fc-scan.exe +0 -0
  24. data/vendor/local/bin/fc-validate.exe +0 -0
  25. data/vendor/local/bin/libcairo-2.dll +0 -0
  26. data/vendor/local/bin/libcairo-gobject-2.dll +0 -0
  27. data/vendor/local/bin/libcairo-script-interpreter-2.dll +0 -0
  28. data/vendor/local/bin/libfontconfig-1.dll +0 -0
  29. data/vendor/local/bin/libfreetype-6.dll +0 -0
  30. data/vendor/local/bin/libpixman-1-0.dll +0 -0
  31. data/vendor/local/bin/libpng-config +1 -1
  32. data/vendor/local/bin/libpng16-16.dll +0 -0
  33. data/vendor/local/bin/libpng16-config +1 -1
  34. data/vendor/local/bin/libxml2-2.dll +0 -0
  35. data/vendor/local/bin/png-fix-itxt.exe +0 -0
  36. data/vendor/local/bin/pngfix.exe +0 -0
  37. data/vendor/local/bin/xmlcatalog.exe +0 -0
  38. data/vendor/local/bin/xmllint.exe +0 -0
  39. data/vendor/local/bin/zlib1.dll +0 -0
  40. data/vendor/local/include/cairo/cairo-pdf.h +68 -0
  41. data/vendor/local/include/cairo/cairo-version.h +1 -1
  42. data/vendor/local/include/cairo/cairo.h +19 -0
  43. data/vendor/local/include/libpng16/png.h +13 -12
  44. data/vendor/local/include/libpng16/pngconf.h +1 -1
  45. data/vendor/local/include/libpng16/pnglibconf.h +1 -1
  46. data/vendor/local/include/png.h +13 -12
  47. data/vendor/local/include/pngconf.h +1 -1
  48. data/vendor/local/include/pnglibconf.h +1 -1
  49. data/vendor/local/lib/libcairo-gobject.a +0 -0
  50. data/vendor/local/lib/libcairo-gobject.dll.a +0 -0
  51. data/vendor/local/lib/libcairo-gobject.la +2 -2
  52. data/vendor/local/lib/libcairo-script-interpreter.a +0 -0
  53. data/vendor/local/lib/libcairo-script-interpreter.dll.a +0 -0
  54. data/vendor/local/lib/libcairo-script-interpreter.la +2 -2
  55. data/vendor/local/lib/libcairo.a +0 -0
  56. data/vendor/local/lib/libcairo.dll.a +0 -0
  57. data/vendor/local/lib/libcairo.la +2 -2
  58. data/vendor/local/lib/libfontconfig.dll.a +0 -0
  59. data/vendor/local/lib/libfreetype.a +0 -0
  60. data/vendor/local/lib/libfreetype.dll.a +0 -0
  61. data/vendor/local/lib/libpixman-1.dll.a +0 -0
  62. data/vendor/local/lib/libpng.a +0 -0
  63. data/vendor/local/lib/libpng.dll.a +0 -0
  64. data/vendor/local/lib/libpng.la +2 -2
  65. data/vendor/local/lib/libpng16.a +0 -0
  66. data/vendor/local/lib/libpng16.dll.a +0 -0
  67. data/vendor/local/lib/libpng16.la +2 -2
  68. data/vendor/local/lib/libxml2.dll.a +0 -0
  69. data/vendor/local/lib/libz.dll.a +0 -0
  70. data/vendor/local/lib/pkgconfig/cairo-fc.pc +1 -1
  71. data/vendor/local/lib/pkgconfig/cairo-ft.pc +1 -1
  72. data/vendor/local/lib/pkgconfig/cairo-gobject.pc +1 -1
  73. data/vendor/local/lib/pkgconfig/cairo-pdf.pc +1 -1
  74. data/vendor/local/lib/pkgconfig/cairo-png.pc +1 -1
  75. data/vendor/local/lib/pkgconfig/cairo-ps.pc +1 -1
  76. data/vendor/local/lib/pkgconfig/cairo-script.pc +2 -2
  77. data/vendor/local/lib/pkgconfig/cairo-svg.pc +1 -1
  78. data/vendor/local/lib/pkgconfig/cairo-win32-font.pc +1 -1
  79. data/vendor/local/lib/pkgconfig/cairo-win32.pc +1 -1
  80. data/vendor/local/lib/pkgconfig/cairo.pc +2 -2
  81. data/vendor/local/lib/pkgconfig/libpng.pc +1 -1
  82. data/vendor/local/lib/pkgconfig/libpng16.pc +1 -1
  83. data/vendor/local/share/gtk-doc/html/cairo/cairo-Error-handling.html +30 -2
  84. data/vendor/local/share/gtk-doc/html/cairo/cairo-FreeType-Fonts.html +1 -1
  85. data/vendor/local/share/gtk-doc/html/cairo/cairo-Image-Surfaces.html +1 -1
  86. data/vendor/local/share/gtk-doc/html/cairo/cairo-PDF-Surfaces.html +343 -4
  87. data/vendor/local/share/gtk-doc/html/cairo/cairo-PNG-Support.html +8 -4
  88. data/vendor/local/share/gtk-doc/html/cairo/cairo-Paths.html +3 -3
  89. data/vendor/local/share/gtk-doc/html/cairo/cairo-PostScript-Surfaces.html +6 -6
  90. data/vendor/local/share/gtk-doc/html/cairo/cairo-Raster-Sources.html +2 -2
  91. data/vendor/local/share/gtk-doc/html/cairo/cairo-Recording-Surfaces.html +3 -3
  92. data/vendor/local/share/gtk-doc/html/cairo/cairo-Regions.html +10 -10
  93. data/vendor/local/share/gtk-doc/html/cairo/cairo-SVG-Surfaces.html +3 -3
  94. data/vendor/local/share/gtk-doc/html/cairo/cairo-Tags-and-Links.html +415 -0
  95. data/vendor/local/share/gtk-doc/html/cairo/cairo-User-Fonts.html +14 -14
  96. data/vendor/local/share/gtk-doc/html/cairo/cairo-Win32-Fonts.html +1 -1
  97. data/vendor/local/share/gtk-doc/html/cairo/cairo-Win32-Surfaces.html +5 -5
  98. data/vendor/local/share/gtk-doc/html/cairo/cairo-XLib-Surfaces.html +1 -1
  99. data/vendor/local/share/gtk-doc/html/cairo/cairo-XLib-XRender-Backend.html +1 -1
  100. data/vendor/local/share/gtk-doc/html/cairo/cairo-cairo-device-t.html +5 -5
  101. data/vendor/local/share/gtk-doc/html/cairo/cairo-cairo-font-face-t.html +6 -6
  102. data/vendor/local/share/gtk-doc/html/cairo/cairo-cairo-font-options-t.html +2 -2
  103. data/vendor/local/share/gtk-doc/html/cairo/cairo-cairo-pattern-t.html +35 -35
  104. data/vendor/local/share/gtk-doc/html/cairo/cairo-cairo-scaled-font-t.html +14 -14
  105. data/vendor/local/share/gtk-doc/html/cairo/cairo-cairo-surface-t.html +14 -14
  106. data/vendor/local/share/gtk-doc/html/cairo/cairo-cairo-t.html +10 -10
  107. data/vendor/local/share/gtk-doc/html/cairo/cairo-drawing.html +3 -0
  108. data/vendor/local/share/gtk-doc/html/cairo/cairo-fonts.html +2 -2
  109. data/vendor/local/share/gtk-doc/html/cairo/cairo-text.html +11 -11
  110. data/vendor/local/share/gtk-doc/html/cairo/cairo.devhelp2 +15 -0
  111. data/vendor/local/share/gtk-doc/html/cairo/index-all.html +22 -0
  112. data/vendor/local/share/gtk-doc/html/cairo/index.html +4 -1
  113. data/vendor/local/share/gtk-doc/html/cairo/index.sgml +22 -0
  114. data/vendor/local/share/license/libpng/README +1 -1
  115. data/vendor/local/share/man/man3/libpng.3 +9 -9
  116. data/vendor/local/share/man/man3/libpngpf.3 +2 -2
  117. data/vendor/local/share/man/man5/png.5 +1 -1
  118. metadata +9 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4e7dd1d8cc4793ff484daed2c850e3cf8a0c1993
4
- data.tar.gz: 5f0061492fda792afa2a526581f46a3d375d9401
3
+ metadata.gz: 8e7f0e449fafb91c273782dd8e08bc861611579a
4
+ data.tar.gz: 3173e412c067e96014bc3f7429cc248ac07713a8
5
5
  SHA512:
6
- metadata.gz: 214ca261fdc832d0d3152d33858028b78b1ed6a508c12e75856cee5fa91b3a3cb504d52950ba014eebfb719a2bdadaf3910864ae05f8eecf842055141f6256e0
7
- data.tar.gz: cf88f37304e03755a436b4642e7413dc74c43bbe64f48c751452633f5328dfd3d87fc875ff1e9f7d1ac2eb22899b1a9e701632c1ec969f4fbfd3f967ae81867c
6
+ metadata.gz: bdbe95aaa9965fd846017f303ba8e52aed204dcc4f48f9351a8ead39331d9f3076cbdf8a1cacc363196cd8c438e9f6652a85183ec983aebdb26dcb60b9065475
7
+ data.tar.gz: 418ad66f5f1b6128deba1c883abc9fcfe525c8b91839403f4806afe9c8620fab6400f950f0a70e5f04aa4af919be7562e5f6d35853b9b9fa547ce961201c8a16
data/NEWS CHANGED
@@ -1,3 +1,27 @@
1
+ Release 1.15.4 (2017-01-07) Kouhei Sutou <kou@cozmixng.org>
2
+ ===========================================================
3
+
4
+ Improvements
5
+ ------------
6
+
7
+ * Supported cairo 1.15.4:
8
+ * Added Cairo::PNGError.
9
+ * Added Cairo::FreeTypeError.
10
+ * Added Cairo::Win32GDIError.
11
+ * Added Cairo::TagError.
12
+ * Added Cairo::Tag::DEST.
13
+ * Added Cairo::Tag::LINK.
14
+ * Added Cairo::Context#tag.
15
+ * Added Cairo::Context#begin_tag.
16
+ * Added Cairo::Context#end_tag.
17
+ * Added Cairo::PDFOutlineFlags.
18
+ * Added Cairo::PDFOutline.
19
+ * Added Cairo::PDFSurface#add_outline.
20
+ * Added Cairo::PDFMetadata.
21
+ * Added Cairo::PDFSurface#set_metadata.
22
+ * Added Cairo::PDFSurface#page_label=.
23
+ * Added Cairo::PDFSurface#set_thumbnail_size.
24
+
1
25
  Release 1.15.3 (2016-11-15) Kouhei Sutou <kou@cozmixng.org>
2
26
  ===========================================================
3
27
 
data/Rakefile CHANGED
@@ -452,8 +452,8 @@ windows_task = WindowsTask.new(spec) do |task|
452
452
  },
453
453
  {
454
454
  :name => "libpng",
455
- :version => "1.6.26",
456
- :download_base_url => "http://downloads.sourceforge.net/project/libpng/libpng16/1.6.26",
455
+ :version => "1.6.27",
456
+ :download_base_url => "http://downloads.sourceforge.net/project/libpng/libpng16/1.6.27",
457
457
  :windows => {
458
458
  :built_file => "bin/libpng16-16.dll",
459
459
  },
@@ -503,7 +503,7 @@ windows_task = WindowsTask.new(spec) do |task|
503
503
  },
504
504
  {
505
505
  :name => "cairo",
506
- :version => "1.15.2",
506
+ :version => "1.15.4",
507
507
  :download_site => :cairo_snapshots,
508
508
  :windows => {
509
509
  :built_file => "bin/libcairo-2.dll",
data/ext/cairo/rb_cairo.h CHANGED
@@ -73,7 +73,7 @@ RB_CAIRO_BEGIN_DECLS
73
73
 
74
74
  #define RB_CAIRO_VERSION_MAJOR 1
75
75
  #define RB_CAIRO_VERSION_MINOR 15
76
- #define RB_CAIRO_VERSION_MICRO 3
76
+ #define RB_CAIRO_VERSION_MICRO 4
77
77
 
78
78
  RB_CAIRO_VAR VALUE rb_mCairo;
79
79
  RB_CAIRO_VAR VALUE rb_cCairo_Context;
@@ -160,6 +160,8 @@ RB_CAIRO_VAR VALUE rb_mCairo_TextClusterFlag;
160
160
  RB_CAIRO_VAR VALUE rb_mCairo_ScriptMode;
161
161
  RB_CAIRO_VAR VALUE rb_mCairo_MimeType;
162
162
  RB_CAIRO_VAR VALUE rb_mCairo_RegionOverlap;
163
+ RB_CAIRO_VAR VALUE rb_mCairo_PDFOutlineFlags;
164
+ RB_CAIRO_VAR VALUE rb_mCairo_PDFMetadata;
163
165
  RB_CAIRO_VAR VALUE rb_mCairo_Color;
164
166
  RB_CAIRO_VAR VALUE rb_cCairo_Color_Base;
165
167
  RB_CAIRO_VAR VALUE rb_cCairo_Paper;
@@ -298,6 +300,10 @@ VALUE rb_cairo_device_to_ruby_object (cairo_device_t *de
298
300
  #if CAIRO_CHECK_VERSION(1, 10, 0)
299
301
  #define RVAL2CRREGIONOVERLAP(obj) (rb_cairo_region_overlap_from_ruby_object(obj))
300
302
  #endif
303
+ #if CAIRO_CHECK_VERSION(1, 15, 4)
304
+ #define RVAL2CRPDFOUTLINEFLAGS(obj) (rb_cairo_pdf_outline_flags_from_ruby_object(obj))
305
+ #define RVAL2CRPDFMETADATA(obj) (rb_cairo_pdf_metadata_from_ruby_object(obj))
306
+ #endif
301
307
 
302
308
  cairo_operator_t rb_cairo_operator_from_ruby_object (VALUE obj);
303
309
  cairo_antialias_t rb_cairo_antialias_from_ruby_object (VALUE obj);
@@ -336,6 +342,10 @@ cairo_script_mode_t rb_cairo_script_mode_from_ruby_object (VALUE obj);
336
342
  #if CAIRO_CHECK_VERSION(1, 10, 0)
337
343
  cairo_region_overlap_t rb_cairo_region_overlap_from_ruby_object(VALUE obj);
338
344
  #endif
345
+ #if CAIRO_CHECK_VERSION(1, 15, 4)
346
+ cairo_pdf_outline_flags_t rb_cairo_pdf_outline_flags_from_ruby_object(VALUE obj);
347
+ cairo_pdf_metadata_t rb_cairo_pdf_metadata_from_ruby_object(VALUE obj);
348
+ #endif
339
349
 
340
350
  void rb_cairo_check_status (cairo_status_t status);
341
351
  void rb_cairo_surface_check_status (cairo_surface_t *surface);
@@ -5,7 +5,7 @@
5
5
  * $Author: kou $
6
6
  * $Date: 2008-09-19 12:56:27 $
7
7
  *
8
- * Copyright 2005-2012 Kouhei Sutou <kou@cozmixng.org>
8
+ * Copyright 2005-2017 Kouhei Sutou <kou@cozmixng.org>
9
9
  * Copyright 2005 Øyvind Kolås <pippin@freedesktop.org>
10
10
  * Copyright 2004-2005 MenTaLguY <mental@rydia.com>
11
11
  *
@@ -39,6 +39,8 @@ VALUE rb_mCairo_PDFVersion = Qnil;
39
39
  VALUE rb_mCairo_ScriptMode = Qnil;
40
40
  VALUE rb_mCairo_MimeType = Qnil;
41
41
  VALUE rb_mCairo_RegionOverlap = Qnil;
42
+ VALUE rb_mCairo_PDFOutlineFlags = Qnil;
43
+ VALUE rb_mCairo_PDFMetadata = Qnil;
42
44
 
43
45
  #define CAIRO_OPERATOR_MIN CAIRO_OPERATOR_CLEAR
44
46
  #if CAIRO_CHECK_VERSION(1, 10, 0)
@@ -125,6 +127,17 @@ VALUE rb_mCairo_RegionOverlap = Qnil;
125
127
  #define CAIRO_REGION_OVERLAP_MIN CAIRO_REGION_OVERLAP_IN
126
128
  #define CAIRO_REGION_OVERLAP_MAX CAIRO_REGION_OVERLAP_PART
127
129
 
130
+ #if CAIRO_CHECK_VERSION(1, 15, 6)
131
+ # define CAIRO_PDF_OUTLINE_FLAGS_MIN CAIRO_PDF_OUTLINE_FLAG_OPEN
132
+ # define CAIRO_PDF_OUTLINE_FLAGS_MAX CAIRO_PDF_OUTLINE_FLAG_ITALIC
133
+ #else
134
+ # define CAIRO_PDF_OUTLINE_FLAGS_MIN CAIRO_BOOKMARK_FLAG_OPEN
135
+ # define CAIRO_PDF_OUTLINE_FLAGS_MAX CAIRO_BOOKMARK_FLAG_ITALIC
136
+ #endif
137
+
138
+ #define CAIRO_PDF_METADATA_MIN CAIRO_PDF_METADATA_TITLE
139
+ #define CAIRO_PDF_METADATA_MAX CAIRO_PDF_METADATA_MOD_DATE
140
+
128
141
  #define DEFINE_RVAL2ENUM(name, const_name) \
129
142
  cairo_ ## name ## _t \
130
143
  rb_cairo_ ## name ## _from_ruby_object (VALUE rb_ ## name) \
@@ -194,6 +207,11 @@ DEFINE_RVAL2ENUM(script_mode, SCRIPT_MODE)
194
207
  DEFINE_RVAL2ENUM(region_overlap, REGION_OVERLAP)
195
208
  #endif
196
209
 
210
+ #if CAIRO_CHECK_VERSION(1, 15, 4)
211
+ DEFINE_RVAL2ENUM(pdf_outline_flags, PDF_OUTLINE_FLAGS)
212
+ DEFINE_RVAL2ENUM(pdf_metadata, PDF_METADATA)
213
+ #endif
214
+
197
215
  #if defined(RB_CAIRO_PLATFORM_WIN32) && !defined(PS_LEVEL_ENUM_DEFINED)
198
216
  void
199
217
  rb_cairo_ps_level_from_ruby_object (VALUE rb_ps_level)
@@ -670,4 +688,41 @@ Init_cairo_constants (void)
670
688
  rb_define_const (rb_mCairo_RegionOverlap, "PART",
671
689
  INT2FIX (CAIRO_REGION_OVERLAP_PART));
672
690
  #endif
691
+
692
+ #if CAIRO_CHECK_VERSION(1, 15, 4)
693
+ rb_mCairo_PDFOutlineFlags =
694
+ rb_define_module_under (rb_mCairo, "PDFOutlineFlags");
695
+ # if CAIRO_CHECK_VERSION(1, 15, 6)
696
+ rb_define_const (rb_mCairo_PDFOutlineFlags, "OPEN",
697
+ INT2NUM (CAIRO_PDF_OUTLINE_FLAG_OPEN));
698
+ rb_define_const (rb_mCairo_PDFOutlineFlags, "BOLD",
699
+ INT2NUM (CAIRO_PDF_OUTLINE_FLAG_BOLD));
700
+ rb_define_const (rb_mCairo_PDFOutlineFlags, "ITALIC",
701
+ INT2NUM (CAIRO_PDF_OUTLINE_FLAG_ITALIC));
702
+ # else
703
+ rb_define_const (rb_mCairo_PDFOutlineFlags, "OPEN",
704
+ INT2NUM (CAIRO_BOOKMARK_FLAG_OPEN));
705
+ rb_define_const (rb_mCairo_PDFOutlineFlags, "BOLD",
706
+ INT2NUM (CAIRO_BOOKMARK_FLAG_BOLD));
707
+ rb_define_const (rb_mCairo_PDFOutlineFlags, "ITALIC",
708
+ INT2NUM (CAIRO_BOOKMARK_FLAG_ITALIC));
709
+ # endif
710
+
711
+ rb_mCairo_PDFMetadata =
712
+ rb_define_module_under (rb_mCairo, "PDFMetadata");
713
+ rb_define_const (rb_mCairo_PDFMetadata, "TITLE",
714
+ INT2NUM (CAIRO_PDF_METADATA_TITLE));
715
+ rb_define_const (rb_mCairo_PDFMetadata, "AUTHOR",
716
+ INT2NUM (CAIRO_PDF_METADATA_AUTHOR));
717
+ rb_define_const (rb_mCairo_PDFMetadata, "SUBJECT",
718
+ INT2NUM (CAIRO_PDF_METADATA_SUBJECT));
719
+ rb_define_const (rb_mCairo_PDFMetadata, "KEYWORDS",
720
+ INT2NUM (CAIRO_PDF_METADATA_KEYWORDS));
721
+ rb_define_const (rb_mCairo_PDFMetadata, "CREATOR",
722
+ INT2NUM (CAIRO_PDF_METADATA_CREATOR));
723
+ rb_define_const (rb_mCairo_PDFMetadata, "CREATE_DATE",
724
+ INT2NUM (CAIRO_PDF_METADATA_CREATE_DATE));
725
+ rb_define_const (rb_mCairo_PDFMetadata, "MOD_DATE",
726
+ INT2NUM (CAIRO_PDF_METADATA_MOD_DATE));
727
+ #endif
673
728
  }
@@ -5,7 +5,7 @@
5
5
  * $Author: kou $
6
6
  * $Date: 2008-09-26 13:52:08 $
7
7
  *
8
- * Copyright 2005-2014 Kouhei Sutou <kou@cozmixng.org>
8
+ * Copyright 2005-2016 Kouhei Sutou <kou@cozmixng.org>
9
9
  * Copyright 2005 Øyvind Kolås <pippin@freedesktop.org>
10
10
  * Copyright 2004-2005 MenTaLguY <mental@rydia.com>
11
11
  *
@@ -1549,6 +1549,90 @@ cr_copy_append_path (VALUE self, VALUE path)
1549
1549
  return self;
1550
1550
  }
1551
1551
 
1552
+ #if CAIRO_CHECK_VERSION(1, 15, 4)
1553
+ /* Logical structure tagging functions */
1554
+ typedef struct rb_cairo_context_tag_ensure_data {
1555
+ VALUE self;
1556
+ const char *name;
1557
+ } rb_cairo_context_tag_ensure_data_t;
1558
+
1559
+ static VALUE
1560
+ cr_tag_ensure (VALUE user_data)
1561
+ {
1562
+ rb_cairo_context_tag_ensure_data_t *data =
1563
+ (rb_cairo_context_tag_ensure_data_t *)user_data;
1564
+ VALUE self;
1565
+
1566
+ self = data->self;
1567
+ cairo_tag_end (_SELF, data->name);
1568
+ cr_check_status (_SELF);
1569
+
1570
+ return Qnil;
1571
+ }
1572
+
1573
+ static VALUE
1574
+ cr_tag (int argc, VALUE *argv, VALUE self)
1575
+ {
1576
+ VALUE rb_name;
1577
+ VALUE rb_attributes;
1578
+ const char *name;
1579
+ const char *attributes = NULL;
1580
+
1581
+ rb_scan_args (argc, argv, "11", &rb_name, &rb_attributes);
1582
+
1583
+ name = RVAL2CSTR (rb_name);
1584
+ if (!NIL_P (rb_attributes))
1585
+ attributes = RVAL2CSTR (rb_attributes);
1586
+
1587
+ cairo_tag_begin (_SELF, name, attributes);
1588
+ cr_check_status (_SELF);
1589
+ if (rb_block_given_p ())
1590
+ {
1591
+ rb_cairo_context_tag_ensure_data_t data;
1592
+ data.self = self;
1593
+ data.name = name;
1594
+ return rb_ensure (rb_yield, self,
1595
+ cr_tag_ensure, (VALUE)&data);
1596
+ }
1597
+ else
1598
+ {
1599
+ return Qnil;
1600
+ }
1601
+ }
1602
+
1603
+ static VALUE
1604
+ cr_begin_tag (int argc, VALUE *argv, VALUE self)
1605
+ {
1606
+ VALUE rb_name;
1607
+ VALUE rb_attributes;
1608
+ const char *name;
1609
+ const char *attributes = NULL;
1610
+
1611
+ rb_scan_args (argc, argv, "11", &rb_name, &rb_attributes);
1612
+
1613
+ name = RVAL2CSTR (rb_name);
1614
+ if (!NIL_P (rb_attributes))
1615
+ attributes = RVAL2CSTR (rb_attributes);
1616
+
1617
+ cairo_tag_begin (_SELF, name, attributes);
1618
+ cr_check_status (_SELF);
1619
+
1620
+ return Qnil;
1621
+ }
1622
+
1623
+ static VALUE
1624
+ cr_end_tag (VALUE self, VALUE rb_name)
1625
+ {
1626
+ const char *name;
1627
+
1628
+ name = RVAL2CSTR (rb_name);
1629
+ cairo_tag_end (_SELF, name);
1630
+ cr_check_status (_SELF);
1631
+
1632
+ return Qnil;
1633
+ }
1634
+ #endif
1635
+
1552
1636
  static int
1553
1637
  cr_destroy_all_guarded_contexts_at_end_iter (VALUE key, VALUE value, VALUE data)
1554
1638
  {
@@ -1737,5 +1821,20 @@ Init_cairo_context (void)
1737
1821
 
1738
1822
  rb_define_method (rb_cCairo_Context, "to_ptr", cr_to_ptr, 0);
1739
1823
 
1824
+ #if CAIRO_CHECK_VERSION(1, 15, 4)
1825
+ /* Logical structure tagging functions */
1826
+ {
1827
+ VALUE rb_mCairo_Tag;
1828
+
1829
+ rb_mCairo_Tag = rb_define_module_under (rb_mCairo, "Tag");
1830
+ rb_define_const (rb_mCairo_Tag, "DEST", rb_str_new_cstr (CAIRO_TAG_DEST));
1831
+ rb_define_const (rb_mCairo_Tag, "LINK", rb_str_new_cstr (CAIRO_TAG_LINK));
1832
+
1833
+ rb_define_method (rb_cCairo_Context, "tag", cr_tag, -1);
1834
+ rb_define_method (rb_cCairo_Context, "begin_tag", cr_begin_tag, -1);
1835
+ rb_define_method (rb_cCairo_Context, "end_tag", cr_end_tag, 1);
1836
+ }
1837
+ #endif
1838
+
1740
1839
  RB_CAIRO_DEF_SETTERS (rb_cCairo_Context);
1741
1840
  }
@@ -5,6 +5,7 @@
5
5
  * $Author: kou $
6
6
  * $Date: 2008-08-16 12:52:16 $
7
7
  *
8
+ * Copyright 2010-2017 Kouhei Sutou <kou@cozmixng.org>
8
9
  * Copyright 2005 Øyvind Kolås <pippin@freedesktop.org>
9
10
  * Copyright 2004-2005 MenTaLguY <mental@rydia.com>
10
11
  *
@@ -64,6 +65,12 @@ static VALUE rb_eCairo_DeviceFinished;
64
65
  #if CAIRO_CHECK_VERSION(1, 14, 0)
65
66
  static VALUE rb_eCairo_JBIG2GlobalMissing;
66
67
  #endif
68
+ #if CAIRO_CHECK_VERSION(1, 15, 4)
69
+ static VALUE rb_eCairo_PNGError;
70
+ static VALUE rb_eCairo_FreeTypeError;
71
+ static VALUE rb_eCairo_Win32GDIError;
72
+ static VALUE rb_eCairo_TagError;
73
+ #endif
67
74
 
68
75
  void
69
76
  rb_cairo_check_status (cairo_status_t status)
@@ -200,6 +207,20 @@ rb_cairo_check_status (cairo_status_t status)
200
207
  rb_raise (rb_eCairo_JBIG2GlobalMissing, "%s", string);
201
208
  break;
202
209
  #endif
210
+ #if CAIRO_CHECK_VERSION(1, 15, 4)
211
+ case CAIRO_STATUS_PNG_ERROR:
212
+ rb_raise (rb_eCairo_PNGError, "%s", string);
213
+ break;
214
+ case CAIRO_STATUS_FREETYPE_ERROR:
215
+ rb_raise (rb_eCairo_FreeTypeError, "%s", string);
216
+ break;
217
+ case CAIRO_STATUS_WIN32_GDI_ERROR:
218
+ rb_raise (rb_eCairo_Win32GDIError, "%s", string);
219
+ break;
220
+ case CAIRO_STATUS_TAG_ERROR:
221
+ rb_raise (rb_eCairo_TagError, "%s", string);
222
+ break;
223
+ #endif
203
224
  #if CAIRO_CHECK_VERSION(1, 10, 0)
204
225
  case CAIRO_STATUS_LAST_STATUS:
205
226
  #else
@@ -297,6 +318,16 @@ rb_cairo__exception_to_status (VALUE exception)
297
318
  else if (rb_cairo__is_kind_of (exception, rb_eCairo_JBIG2GlobalMissing))
298
319
  return CAIRO_STATUS_JBIG2_GLOBAL_MISSING;
299
320
  #endif
321
+ #if CAIRO_CHECK_VERSION(1, 15, 4)
322
+ else if (rb_cairo__is_kind_of (exception, rb_eCairo_PNGError))
323
+ return CAIRO_STATUS_PNG_ERROR;
324
+ else if (rb_cairo__is_kind_of (exception, rb_eCairo_FreeTypeError))
325
+ return CAIRO_STATUS_FREETYPE_ERROR;
326
+ else if (rb_cairo__is_kind_of (exception, rb_eCairo_Win32GDIError))
327
+ return CAIRO_STATUS_WIN32_GDI_ERROR;
328
+ else if (rb_cairo__is_kind_of (exception, rb_eCairo_TagError))
329
+ return CAIRO_STATUS_TAG_ERROR;
330
+ #endif
300
331
 
301
332
  return -1;
302
333
  }
@@ -443,4 +474,18 @@ Init_cairo_exception ()
443
474
  rb_define_class_under (rb_mCairo, "JBIG2GlobalMissing",
444
475
  rb_eCairo_Error);
445
476
  #endif
477
+ #if CAIRO_CHECK_VERSION(1, 15, 4)
478
+ rb_eCairo_PNGError =
479
+ rb_define_class_under (rb_mCairo, "PNGError",
480
+ rb_eCairo_Error);
481
+ rb_eCairo_FreeTypeError =
482
+ rb_define_class_under (rb_mCairo, "FreeTypeError",
483
+ rb_eCairo_Error);
484
+ rb_eCairo_Win32GDIError =
485
+ rb_define_class_under (rb_mCairo, "Win32GDIError",
486
+ rb_eCairo_Error);
487
+ rb_eCairo_TagError =
488
+ rb_define_class_under (rb_mCairo, "TagError",
489
+ rb_eCairo_Error);
490
+ #endif
446
491
  }
@@ -2,7 +2,7 @@
2
2
  /*
3
3
  * Ruby Cairo Binding
4
4
  *
5
- * Copyright 2005-2015 Kouhei Sutou <kou@cozmixng.org>
5
+ * Copyright 2005-2017 Kouhei Sutou <kou@cozmixng.org>
6
6
  * Copyright 2014 Patrick Hanevold <patrick.hanevold@gmail.com>
7
7
  * Copyright 2005 Øyvind Kolås <pippin@freedesktop.org>
8
8
  * Copyright 2004-2005 MenTaLguY <mental@rydia.com>
@@ -1177,6 +1177,111 @@ cr_pdf_surface_restrict_to_version (VALUE self, VALUE version)
1177
1177
  return Qnil;
1178
1178
  }
1179
1179
  # endif
1180
+
1181
+ # if CAIRO_CHECK_VERSION(1, 15, 4)
1182
+ static VALUE
1183
+ cr_pdf_surface_add_outline (VALUE self,
1184
+ VALUE rb_parent_id,
1185
+ VALUE rb_name,
1186
+ VALUE rb_destination,
1187
+ VALUE rb_flags)
1188
+ {
1189
+ cairo_surface_t *surface;
1190
+ int parent_id;
1191
+ const char *name;
1192
+ const char *destination;
1193
+ cairo_pdf_outline_flags_t flags;
1194
+ int id;
1195
+
1196
+ surface = _SELF;
1197
+ if (NIL_P (rb_parent_id))
1198
+ parent_id = 0;
1199
+ else
1200
+ parent_id = NUM2INT (rb_parent_id);
1201
+ name = RVAL2CSTR (rb_name);
1202
+ destination = RVAL2CSTR (rb_destination);
1203
+ if (NIL_P (rb_flags))
1204
+ flags = 0;
1205
+ else
1206
+ flags = RVAL2CRPDFOUTLINEFLAGS (rb_flags);
1207
+ id = cairo_pdf_surface_add_outline (surface,
1208
+ parent_id,
1209
+ name,
1210
+ destination,
1211
+ flags);
1212
+ rb_cairo_surface_check_status (surface);
1213
+
1214
+ if (id == 0)
1215
+ return Qnil;
1216
+ else
1217
+ return INT2NUM (id);
1218
+ }
1219
+
1220
+ static VALUE
1221
+ cr_pdf_surface_set_metadata (VALUE self,
1222
+ VALUE rb_metadata,
1223
+ VALUE rb_value)
1224
+ {
1225
+ cairo_surface_t *surface;
1226
+ cairo_pdf_metadata_t metadata;
1227
+ const char *value;
1228
+
1229
+ surface = _SELF;
1230
+ metadata = RVAL2CRPDFMETADATA (rb_metadata);
1231
+ switch (metadata)
1232
+ {
1233
+ case CAIRO_PDF_METADATA_CREATE_DATE:
1234
+ case CAIRO_PDF_METADATA_MOD_DATE:
1235
+ if (rb_cairo__is_kind_of (rb_value, rb_cTime))
1236
+ {
1237
+ ID id_iso8601;
1238
+ CONST_ID(id_iso8601, "iso8601");
1239
+ rb_value = rb_funcall (rb_value, id_iso8601, 0);
1240
+ }
1241
+ break;
1242
+ default:
1243
+ break;
1244
+ }
1245
+ value = RVAL2CSTR (rb_value);
1246
+ cairo_pdf_surface_set_metadata (surface, metadata, value);
1247
+ rb_cairo_surface_check_status (surface);
1248
+
1249
+ return Qnil;
1250
+ }
1251
+
1252
+ static VALUE
1253
+ cr_pdf_surface_set_page_label (VALUE self,
1254
+ VALUE rb_label)
1255
+ {
1256
+ cairo_surface_t *surface;
1257
+ const char *label;
1258
+
1259
+ surface = _SELF;
1260
+ label = RVAL2CSTR (rb_label);
1261
+ cairo_pdf_surface_set_page_label (surface, label);
1262
+ rb_cairo_surface_check_status (surface);
1263
+
1264
+ return Qnil;
1265
+ }
1266
+
1267
+ static VALUE
1268
+ cr_pdf_surface_set_thumbnail_size (VALUE self,
1269
+ VALUE rb_width,
1270
+ VALUE rb_height)
1271
+ {
1272
+ cairo_surface_t *surface;
1273
+ int width;
1274
+ int height;
1275
+
1276
+ surface = _SELF;
1277
+ width = NUM2INT (rb_width);
1278
+ height = NUM2INT (rb_height);
1279
+ cairo_pdf_surface_set_thumbnail_size (surface, width, height);
1280
+ rb_cairo_surface_check_status (surface);
1281
+
1282
+ return Qnil;
1283
+ }
1284
+ # endif
1180
1285
  #endif
1181
1286
 
1182
1287
  #ifdef CAIRO_HAS_PS_SURFACE
@@ -1980,6 +2085,26 @@ Init_cairo_surface (void)
1980
2085
  cr_pdf_surface_restrict_to_version, 1);
1981
2086
  # endif
1982
2087
 
2088
+ # if CAIRO_CHECK_VERSION(1, 15, 4)
2089
+ {
2090
+ VALUE rb_mCairo_PDFOutline;
2091
+
2092
+ rb_mCairo_PDFOutline =
2093
+ rb_define_module_under (rb_mCairo, "PDFOutline");
2094
+ rb_define_const (rb_mCairo_PDFOutline, "ROOT",
2095
+ INT2NUM (CAIRO_PDF_OUTLINE_ROOT));
2096
+
2097
+ rb_define_method (rb_cCairo_PDFSurface, "add_outline",
2098
+ cr_pdf_surface_add_outline, 4);
2099
+ rb_define_method (rb_cCairo_PDFSurface, "set_metadata",
2100
+ cr_pdf_surface_set_metadata, 2);
2101
+ rb_define_method (rb_cCairo_PDFSurface, "set_page_label",
2102
+ cr_pdf_surface_set_page_label, 1);
2103
+ rb_define_method (rb_cCairo_PDFSurface, "set_thumbnail_size",
2104
+ cr_pdf_surface_set_thumbnail_size, 2);
2105
+ }
2106
+ # endif
2107
+
1983
2108
  RB_CAIRO_DEF_SETTERS (rb_cCairo_PDFSurface);
1984
2109
  #endif
1985
2110