cairo 1.15.7-x86-mingw32 → 1.15.8-x86-mingw32

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/NEWS +24 -0
  3. data/Rakefile +8 -3
  4. data/ext/cairo/cairo.def +1 -0
  5. data/ext/cairo/extconf.rb +4 -1
  6. data/ext/cairo/rb_cairo.h +2 -1
  7. data/ext/cairo/rb_cairo_font_face.c +172 -0
  8. data/lib/2.2/cairo.so +0 -0
  9. data/lib/2.3/cairo.so +0 -0
  10. data/lib/2.4/cairo.so +0 -0
  11. data/test/cairo-test-utils.rb +4 -0
  12. data/test/test_font_face.rb +46 -0
  13. data/vendor/local/bin/fc-cache.exe +0 -0
  14. data/vendor/local/bin/fc-cat.exe +0 -0
  15. data/vendor/local/bin/fc-list.exe +0 -0
  16. data/vendor/local/bin/fc-match.exe +0 -0
  17. data/vendor/local/bin/fc-pattern.exe +0 -0
  18. data/vendor/local/bin/fc-query.exe +0 -0
  19. data/vendor/local/bin/fc-scan.exe +0 -0
  20. data/vendor/local/bin/fc-validate.exe +0 -0
  21. data/vendor/local/bin/libcairo-2.dll +0 -0
  22. data/vendor/local/bin/libcairo-gobject-2.dll +0 -0
  23. data/vendor/local/bin/libcairo-script-interpreter-2.dll +0 -0
  24. data/vendor/local/bin/libfontconfig-1.dll +0 -0
  25. data/vendor/local/bin/libfreetype-6.dll +0 -0
  26. data/vendor/local/bin/libpixman-1-0.dll +0 -0
  27. data/vendor/local/bin/libpng16-16.dll +0 -0
  28. data/vendor/local/bin/libxml2-2.dll +0 -0
  29. data/vendor/local/bin/png-fix-itxt.exe +0 -0
  30. data/vendor/local/bin/pngfix.exe +0 -0
  31. data/vendor/local/bin/xmlcatalog.exe +0 -0
  32. data/vendor/local/bin/xmllint.exe +0 -0
  33. data/vendor/local/bin/zlib1211.dll +0 -0
  34. data/vendor/local/include/libpng16/pnglibconf.h +1 -1
  35. data/vendor/local/include/pnglibconf.h +1 -1
  36. data/vendor/local/include/zconf.h +32 -9
  37. data/vendor/local/include/zlib.h +298 -154
  38. data/vendor/local/lib/libcairo-gobject.dll.a +0 -0
  39. data/vendor/local/lib/libcairo-script-interpreter.a +0 -0
  40. data/vendor/local/lib/libcairo-script-interpreter.dll.a +0 -0
  41. data/vendor/local/lib/libcairo.a +0 -0
  42. data/vendor/local/lib/libcairo.dll.a +0 -0
  43. data/vendor/local/lib/libfontconfig.dll.a +0 -0
  44. data/vendor/local/lib/libfreetype.a +0 -0
  45. data/vendor/local/lib/libfreetype.dll.a +0 -0
  46. data/vendor/local/lib/libpixman-1.dll.a +0 -0
  47. data/vendor/local/lib/libpng.a +0 -0
  48. data/vendor/local/lib/libpng.dll.a +0 -0
  49. data/vendor/local/lib/libpng16.a +0 -0
  50. data/vendor/local/lib/libpng16.dll.a +0 -0
  51. data/vendor/local/lib/libxml2.a +0 -0
  52. data/vendor/local/lib/libxml2.dll.a +0 -0
  53. data/vendor/local/lib/libz.a +0 -0
  54. data/vendor/local/lib/libz.dll.a +0 -0
  55. data/vendor/local/lib/pkgconfig/zlib.pc +1 -1
  56. data/vendor/local/share/license/zlib/README +3 -3
  57. metadata +7 -7
  58. data/vendor/local/bin/zlib1.dll +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7b7bd61722cd05c8d73dadd860b842daebc145f9
4
- data.tar.gz: 369e3dc6b75837a1b2f9767307045883bd910bcc
3
+ metadata.gz: f10c27fb9dbe05914f50f6e7c2edd21295a71851
4
+ data.tar.gz: 780d853d9379e8bd62163e9f4a0602b5ee89e74d
5
5
  SHA512:
6
- metadata.gz: 38bcd1db96e26154213e322f171432dc5b507a04bbccc390921657b59f9f3daa4c10ea64141ce396fd62db90a887ed3edc7541e3812fcaeccb121f223e37c33d
7
- data.tar.gz: 05d299524903c6770c22d12d7abf9605f14a866a4abcf134d225b3bdd43e85018157521c2f75d1594beb25dbca2d45eeac4e0ec1e48067e29b72e6c484229def
6
+ metadata.gz: b03973bc0acf52a7c52002cd66dad28c3c528d6f97c3ad96ded9a46e76826ea640767928e2fb2ee726024a3dca654163b63b24049634c29d811fd564c3443ca3
7
+ data.tar.gz: 059161759143b53ffb558428f033f3640c73a863017dbb26910140df0ec085db07ac415772584ecd54b2703635a265dd4a81de4ad2b0e69155bd2a7cbc7af4de
data/NEWS CHANGED
@@ -1,3 +1,27 @@
1
+ Release 1.15.8 (2017-05-29) Kouhei Sutou <kou@cozmixng.org>
2
+ ===========================================================
3
+
4
+ Improvements
5
+ ------------
6
+
7
+ * Added Cairo::FreeTypeFotnFace.
8
+ [GitHub#45][Patch by Stafford Brunk]
9
+
10
+ * Windows: Supported Ruby 2.4.
11
+ [ruby-list:50525][Reported by 5.5]
12
+
13
+ * Windows: Supported MSYS2.
14
+
15
+ * Windows: Updated bundled libraries:
16
+ * zlib: 1.2.8 -> 1.2.11
17
+
18
+ Thanks
19
+ ------
20
+
21
+ * Stafford Brunk
22
+
23
+ * 5.5
24
+
1
25
  Release 1.15.7 (2017-05-01) Kouhei Sutou <kou@cozmixng.org>
2
26
  ===========================================================
3
27
 
data/Rakefile CHANGED
@@ -420,8 +420,11 @@ class ZlibBuilder
420
420
  include Rake::DSL
421
421
 
422
422
  def build(package, install_dir)
423
+ version_for_path = package.version.gsub(".", "")
424
+ dll_name = "zlib#{version_for_path}.dll"
423
425
  sh("make",
424
426
  "PREFIX=#{package.windows.build_host}-",
427
+ "SHAREDLIB=#{dll_name}",
425
428
  "-f",
426
429
  "win32/Makefile.gcc")
427
430
  include_path = install_dir + "include"
@@ -432,6 +435,7 @@ class ZlibBuilder
432
435
  "LIBRARY_PATH=#{library_path}",
433
436
  "BINARY_PATH=#{binary_path}",
434
437
  "SHARED_MODE=1",
438
+ "SHAREDLIB=#{dll_name}",
435
439
  "-f",
436
440
  "win32/Makefile.gcc",
437
441
  "install")
@@ -439,16 +443,17 @@ class ZlibBuilder
439
443
  end
440
444
 
441
445
  windows_task = WindowsTask.new(spec) do |task|
446
+ zlib_version = "1.2.11"
442
447
  task.packages = [
443
448
  {
444
449
  # We should use the same version as Ruby Installer.
445
450
  :name => "zlib",
446
- :version => "1.2.8",
447
- :download_base_url => "https://downloads.sourceforge.net/project/libpng/zlib/1.2.8",
451
+ :version => zlib_version,
452
+ :download_base_url => "https://downloads.sourceforge.net/project/libpng/zlib/#{zlib_version}",
448
453
  :compression_method => "gz",
449
454
  :windows => {
450
455
  :builder => ZlibBuilder.new,
451
- :built_file => "bin/zlib1.dll",
456
+ :built_file => "bin/zlib#{zlib_version.gsub(".", "")}.dll",
452
457
  },
453
458
  },
454
459
  {
data/ext/cairo/cairo.def CHANGED
@@ -22,6 +22,7 @@ EXPORTS
22
22
  rb_cCairo_RasterSourcePattern DATA
23
23
 
24
24
  rb_cCairo_FontFace DATA
25
+ rb_cCairo_FreeTypeFontFace DATA
25
26
  rb_cCairo_ToyFontFace DATA
26
27
  rb_cCairo_UserFontFace DATA
27
28
  rb_cCairo_UserFontFace_TextToGlyphsData DATA
data/ext/cairo/extconf.rb CHANGED
@@ -61,10 +61,13 @@ unless required_pkg_config_package([package, major, minor, micro],
61
61
  :debian => "libcairo2-dev",
62
62
  :redhat => "cairo-devel",
63
63
  :homebrew => "cairo",
64
- :macports => "cairo")
64
+ :macports => "cairo",
65
+ :msys2 => "cairo")
65
66
  exit(false)
66
67
  end
67
68
 
69
+ PKGConfig.have_package("cairo-ft")
70
+
68
71
  checking_for(checking_message("Mac OS X")) do
69
72
  case RUBY_PLATFORM
70
73
  when /darwin/
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 7
76
+ #define RB_CAIRO_VERSION_MICRO 8
77
77
 
78
78
  RB_CAIRO_VAR VALUE rb_mCairo;
79
79
  RB_CAIRO_VAR VALUE rb_cCairo_Context;
@@ -96,6 +96,7 @@ RB_CAIRO_VAR VALUE rb_cCairo_RadialPattern;
96
96
  RB_CAIRO_VAR VALUE rb_cCairo_MeshPattern;
97
97
  RB_CAIRO_VAR VALUE rb_cCairo_RasterSourcePattern;
98
98
  RB_CAIRO_VAR VALUE rb_cCairo_FontFace;
99
+ RB_CAIRO_VAR VALUE rb_cCairo_FreeTypeFontFace;
99
100
  RB_CAIRO_VAR VALUE rb_cCairo_ToyFontFace;
100
101
  RB_CAIRO_VAR VALUE rb_cCairo_UserFontFace;
101
102
  RB_CAIRO_VAR VALUE rb_cCairo_UserFontFace_TextToGlyphsData;
@@ -17,10 +17,20 @@
17
17
  #include "rb_cairo_private.h"
18
18
 
19
19
  VALUE rb_cCairo_FontFace;
20
+ VALUE rb_cCairo_FreeTypeFontFace = Qnil;
20
21
  VALUE rb_cCairo_ToyFontFace = Qnil;
21
22
  VALUE rb_cCairo_UserFontFace = Qnil;
22
23
  VALUE rb_cCairo_UserFontFace_TextToGlyphsData = Qnil;
23
24
 
25
+ #ifdef CAIRO_HAS_FT_FONT
26
+ # include <cairo-ft.h>
27
+
28
+ static cairo_user_data_key_t cr_freetype_face_key;
29
+ static FT_Library cr_freetype_library;
30
+ static int cr_freetype_n_faces = 0;
31
+ static cairo_bool_t cr_freetype_finishing = CR_FALSE;
32
+ #endif
33
+
24
34
  #if CAIRO_CHECK_VERSION(1, 7, 6)
25
35
  static cairo_user_data_key_t ruby_object_key;
26
36
  static ID cr_id_call;
@@ -84,6 +94,11 @@ rb_cairo_font_face_to_ruby_object (cairo_font_face_t *face)
84
94
 
85
95
  switch (cairo_font_face_get_type (face))
86
96
  {
97
+ #ifdef CAIRO_HAS_FT_FONT
98
+ case CAIRO_FONT_TYPE_FT:
99
+ klass = rb_cCairo_FreeTypeFontFace;
100
+ break;
101
+ #endif
87
102
  #if CAIRO_CHECK_VERSION(1, 7, 6)
88
103
  case CAIRO_FONT_TYPE_TOY:
89
104
  klass = rb_cCairo_ToyFontFace;
@@ -121,6 +136,143 @@ cr_font_face_quartz_supported_p (VALUE klass)
121
136
  #endif
122
137
  }
123
138
 
139
+ static VALUE
140
+ cr_font_face_freetype_supported_p (VALUE klass)
141
+ {
142
+ #ifdef CAIRO_HAS_FT_FONT
143
+ return Qtrue;
144
+ #else
145
+ return Qfalse;
146
+ #endif
147
+ }
148
+
149
+ #ifdef CAIRO_HAS_FT_FONT
150
+ static VALUE
151
+ cr_freetype_done_library (VALUE data)
152
+ {
153
+ cr_freetype_finishing = CR_TRUE;
154
+ if (cr_freetype_n_faces == 0)
155
+ FT_Done_FreeType (cr_freetype_library);
156
+ return Qnil;
157
+ }
158
+
159
+ static void
160
+ cr_freetype_done_face (void *data)
161
+ {
162
+ FT_Face face = data;
163
+
164
+ FT_Done_Face (face);
165
+ cr_freetype_n_faces--;
166
+ if (cr_freetype_n_faces == 0 && cr_freetype_finishing)
167
+ FT_Done_FreeType (cr_freetype_library);
168
+ }
169
+
170
+ static cairo_bool_t
171
+ cr_freetype_error_detail (FT_Error error,
172
+ const char **name,
173
+ const char **message)
174
+ {
175
+ #undef __FTERRORS_H__
176
+ #define FT_STRINGIFY(v) #v
177
+ #define FT_ERRORDEF(e, v, s) {FT_STRINGIFY(e), v, s},
178
+ #define FT_ERROR_START_LIST {
179
+ #define FT_ERROR_END_LIST {NULL, 0, NULL}};
180
+ size_t i = 0;
181
+ static const struct {
182
+ const char *name;
183
+ FT_Error code;
184
+ const char *message;
185
+ } errors[] =
186
+ #include FT_ERRORS_H
187
+ for (i = 0; i < (sizeof (errors) / sizeof (errors[0])); i++)
188
+ {
189
+ if (errors[i].code == error)
190
+ {
191
+ *name = errors[i].name;
192
+ *message = errors[i].message;
193
+ return CR_TRUE;
194
+ }
195
+ }
196
+
197
+ return CR_FALSE;
198
+ }
199
+
200
+ static void
201
+ cr_freetype_error_check (FT_Error error,
202
+ const char *message,
203
+ VALUE related_object)
204
+ {
205
+ const char *name = NULL;
206
+ const char *system_message = NULL;
207
+ const char *error_class_name;
208
+ VALUE rb_eCairo_FreeTypeError;
209
+
210
+ if (error == FT_Err_Ok)
211
+ return;
212
+
213
+ cr_freetype_error_detail (error, &name, &system_message);
214
+ #if CAIRO_CHECK_VERSION(1, 15, 4)
215
+ error_class_name = "FreeTypeError";
216
+ #else
217
+ error_class_name = "Error";
218
+ #endif
219
+ rb_eCairo_FreeTypeError =
220
+ rb_const_get (rb_mCairo, rb_intern (error_class_name));
221
+ if (NIL_P (related_object))
222
+ {
223
+ rb_raise (rb_eCairo_FreeTypeError,
224
+ "%s: %s[%d]: %s",
225
+ message,
226
+ name ? name : "unknown",
227
+ error,
228
+ system_message ? system_message : "unknown");
229
+ }
230
+ else
231
+ {
232
+ rb_raise (rb_eCairo_FreeTypeError,
233
+ "%s: %s[%d]: %s: %+" PRIsVALUE,
234
+ message,
235
+ name ? name : "unknown",
236
+ error,
237
+ system_message ? system_message : "unknown",
238
+ related_object);
239
+ }
240
+ }
241
+
242
+ static VALUE
243
+ cr_freetype_font_face_initialize (VALUE self, VALUE path)
244
+ {
245
+ FT_Face freetype_face;
246
+ FT_Error error;
247
+ cairo_font_face_t *face;
248
+ cairo_status_t status;
249
+
250
+ error = FT_New_Face (cr_freetype_library,
251
+ StringValueCStr(path),
252
+ 0,
253
+ &freetype_face);
254
+ cr_freetype_error_check (error, "failed to open FreeType font", path);
255
+ cr_freetype_n_faces++;
256
+
257
+ face = cairo_ft_font_face_create_for_ft_face (freetype_face, 0);
258
+ cr_font_face_check_status (face);
259
+ status =
260
+ cairo_font_face_set_user_data (face,
261
+ &cr_freetype_face_key,
262
+ freetype_face,
263
+ (cairo_destroy_func_t) cr_freetype_done_face);
264
+ if (status != CAIRO_STATUS_SUCCESS) {
265
+ cairo_font_face_destroy (face);
266
+ FT_Done_Face (freetype_face);
267
+ rb_cairo_check_status (status);
268
+ }
269
+
270
+ DATA_PTR (self) = face;
271
+
272
+ return Qnil;
273
+ }
274
+ #endif
275
+
124
276
  #if CAIRO_CHECK_VERSION(1, 7, 6)
125
277
  static VALUE
126
278
  cr_toy_font_face_initialize (int argc, VALUE *argv, VALUE self)
@@ -664,6 +816,26 @@ Init_cairo_font (void)
664
816
 
665
817
  rb_define_singleton_method (rb_cCairo_FontFace, "quartz_supported?",
666
818
  cr_font_face_quartz_supported_p, 0);
819
+ rb_define_singleton_method (rb_cCairo_FontFace, "freetype_supported?",
820
+ cr_font_face_freetype_supported_p, 0);
821
+
822
+ #ifdef CAIRO_HAS_FT_FONT
823
+ rb_cCairo_FreeTypeFontFace =
824
+ rb_define_class_under (rb_mCairo, "FreeTypeFontFace", rb_cCairo_FontFace);
825
+
826
+ {
827
+ FT_Error error;
828
+
829
+ error = FT_Init_FreeType (&cr_freetype_library);
830
+ cr_freetype_error_check (error, "failed to initialize FreeType", Qnil);
831
+
832
+ rb_define_finalizer (rb_cCairo_FreeTypeFontFace,
833
+ rb_proc_new (cr_freetype_done_library, Qnil));
834
+ }
835
+
836
+ rb_define_method (rb_cCairo_FreeTypeFontFace, "initialize",
837
+ cr_freetype_font_face_initialize, 1);
838
+ #endif
667
839
 
668
840
  #if CAIRO_CHECK_VERSION(1, 7, 6)
669
841
  rb_cCairo_ToyFontFace =
data/lib/2.2/cairo.so CHANGED
Binary file
data/lib/2.3/cairo.so CHANGED
Binary file
data/lib/2.4/cairo.so CHANGED
Binary file
@@ -42,4 +42,8 @@ module CairoTestUtils
42
42
  omit("Only for #{name} device available")
43
43
  end
44
44
  end
45
+
46
+ def fixture_path(*components)
47
+ File.join(__dir__, "fixture", *components)
48
+ end
45
49
  end
@@ -3,6 +3,52 @@ require 'cairo'
3
3
  class FontFaceTest < Test::Unit::TestCase
4
4
  include CairoTestUtils
5
5
 
6
+ sub_test_case("FreeTypeFontFace") do
7
+ setup do
8
+ omit("Need FreeType support") unless Cairo::FontFace.freetype_supported?
9
+ end
10
+
11
+ sub_test_case("initialize") do
12
+ test("valid") do
13
+ assert_nothing_raised do
14
+ Cairo::FreeTypeFontFace.new(fixture_path("a.otf"))
15
+ end
16
+ end
17
+
18
+ sub_test_case("invalid") do
19
+ setup do
20
+ if Cairo.const_defined?(:FreeTypeError)
21
+ @error_class = Cairo::FreeTypeError
22
+ else
23
+ @error_class = Cairo::Error
24
+ end
25
+ end
26
+
27
+ test("broken") do
28
+ path = __FILE__
29
+ message = "failed to open FreeType font: "
30
+ message << "FT_Err_Unknown_File_Format[2]: "
31
+ message << "unknown file format: "
32
+ message << path.inspect
33
+ assert_raise(@error_class.new(message)) do
34
+ Cairo::FreeTypeFontFace.new(path)
35
+ end
36
+ end
37
+
38
+ test("nonexistent") do
39
+ path = fixture_path("nonexistent.otf")
40
+ message = "failed to open FreeType font: "
41
+ message << "FT_Err_Cannot_Open_Resource[1]: "
42
+ message << "cannot open resource: "
43
+ message << path.inspect
44
+ assert_raise(@error_class.new(message)) do
45
+ Cairo::FreeTypeFontFace.new(path)
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+
6
52
  def test_toy_font_face_new
7
53
  only_cairo_version(1, 7, 2)
8
54
 
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file