pango 3.0.8 → 3.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 54f4aa7420dec1d60f1f3bdd7d101827f8c1667e
4
- data.tar.gz: 2e7c60821dc91347286182908a1f170df35d8e32
3
+ metadata.gz: 511180db9799f946c4a9662318093d662e099876
4
+ data.tar.gz: 7f213c633a383ba61bd139f634adbeb3c74caa0c
5
5
  SHA512:
6
- metadata.gz: 339c2e74af470ea2150a3f3e2c966854ff4bf97e11c86d0201a8f5de12ea26137500d894fb7fc94e1fa5853ad454d2e9b7460eb09c3dbbaddd404a9c7bb1ea52
7
- data.tar.gz: b0e969276075c7b20c443a1d657d4998610e8558da447b0b7c85e9f97b894f0323b4d36ae2a59c8fee38e13e67c5c8beb6b397fc3c73d792c7de6090460503cb
6
+ metadata.gz: 96e4cdbdd2cf927f4c29882047d0f84cc729d6e15f78163949b41c4b8f6fa2b3ec4c5408cc45f807ebb38aed032283ea9f68d5c9aa394e2352f88bf73b31a1ca
7
+ data.tar.gz: 0011b70b858328b54735d5905e83f9a47029bfd806c58e5ce7e3b6e0e36bf5498842ab104cd1ee98113f23e7902e71b41d67c9675b488e1c8963ed1da047bf30
data/Rakefile CHANGED
@@ -48,9 +48,9 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
48
48
  },
49
49
  {
50
50
  :name => "harfbuzz",
51
- :download_base_url => "https://www.freedesktop.org/software/harfbuzz/release",
51
+ :download_site => :freedesktop,
52
52
  :label => "HarfBuzz",
53
- :version => "1.2.4",
53
+ :version => "1.3.0",
54
54
  :compression_method => "bz2",
55
55
  :windows => {
56
56
  :configure_args => [
@@ -64,7 +64,7 @@ package_task = GNOME2::Rake::PackageTask.new do |package|
64
64
  :name => "pango",
65
65
  :download_site => :gnome,
66
66
  :label => "pango",
67
- :version => "1.40.0",
67
+ :version => "1.40.1",
68
68
  :compression_method => "xz",
69
69
  :windows => {
70
70
  :configure_args => [
@@ -229,6 +229,12 @@ attr_shape_value(VALUE self)
229
229
  return rb_ary_new3(2, attr_shape_ink_rect(self), attr_shape_logical_rect(self));
230
230
  }
231
231
 
232
+ static VALUE
233
+ attr_shape_data(VALUE self)
234
+ {
235
+ return (VALUE)(((PangoAttrShape *)RVAL2ATTR(self))->data);
236
+ }
237
+
232
238
  /*
233
239
  * Initialize methods
234
240
  */
@@ -464,6 +470,7 @@ Init_pango_attribute(VALUE mPango)
464
470
  rbg_define_method(tmpklass, "ink_rect", attr_shape_ink_rect, 0);
465
471
  rbg_define_method(tmpklass, "logical_rect", attr_shape_logical_rect, 0);
466
472
  rbg_define_method(tmpklass, "value", attr_shape_value, 0);
473
+ rbg_define_method(tmpklass, "data", attr_shape_data, 0);
467
474
  MAKE_ATTR(PANGO_ATTR_SCALE, AttrScale, pattrfloat, 1);
468
475
  /* PangoScale */
469
476
  rb_define_const(tmpklass, "XX_SMALL", rb_float_new(PANGO_SCALE_XX_SMALL));
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011-2016 Ruby-GNOME2 Project Team
4
4
  * Copyright (C) 2002-2005 Masao Mutoh
5
5
  *
6
6
  * This library is free software; you can redistribute it and/or
@@ -64,7 +64,7 @@ rg_splice(VALUE self, VALUE other, VALUE pos, VALUE len)
64
64
  static gboolean
65
65
  filter_func(PangoAttribute *attr, gpointer data)
66
66
  {
67
- return CBOOL2RVAL(rb_funcall((VALUE)data, id_call, 1, ATTR2RVAL(attr)));
67
+ return RVAL2CBOOL(rb_funcall((VALUE)data, id_call, 1, ATTR2RVAL(attr)));
68
68
  }
69
69
 
70
70
  static VALUE
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011-2016 Ruby-GNOME2 Project Team
4
4
  * Copyright (C) 2002-2005 Masao Mutoh
5
5
  *
6
6
  * This library is free software; you can redistribute it and/or
@@ -21,6 +21,8 @@
21
21
 
22
22
  #include "rbpangoprivate.h"
23
23
 
24
+ static ID id_call;
25
+
24
26
  #define RG_TARGET_NAMESPACE cContext
25
27
  #define _SELF(self) (RVAL2PANGOCONTEXT(self))
26
28
 
@@ -33,26 +35,26 @@ rg_itemize(int argc, VALUE *argv, VALUE self)
33
35
  rb_scan_args(argc, argv, "42", &arg1, &arg2, &arg3, &arg4, &arg5, &arg6);
34
36
 
35
37
  if (TYPE(arg1) == T_STRING) {
36
- list = pango_itemize(_SELF(self),
37
- RVAL2CSTR(arg1), /* text */
38
- NUM2INT(arg2), /* start_index */
38
+ list = pango_itemize(_SELF(self),
39
+ RVAL2CSTR(arg1), /* text */
40
+ NUM2INT(arg2), /* start_index */
39
41
  NUM2INT(arg3), /* length */
40
42
  RVAL2PANGOATTRLIST(arg4), /* attrs */
41
43
  NIL_P(arg5) ? NULL : RVAL2PANGOATTRITERATOR(arg5)); /* cached_iter */
42
44
  } else {
43
45
  #ifdef HAVE_PANGO_ITEMIZE_WITH_BASE_DIR
44
- list = pango_itemize_with_base_dir(_SELF(self),
46
+ list = pango_itemize_with_base_dir(_SELF(self),
45
47
  RVAL2PANGODIRECTION(arg1), /* base_dir */
46
- RVAL2CSTR(arg2), /* text */
47
- NUM2INT(arg3), /* start_index */
48
+ RVAL2CSTR(arg2), /* text */
49
+ NUM2INT(arg3), /* start_index */
48
50
  NUM2INT(arg4), /* length */
49
51
  RVAL2PANGOATTRLIST(arg5), /* attrs */
50
52
  NIL_P(arg6) ? NULL : RVAL2PANGOATTRITERATOR(arg6)); /* cached_iter */
51
53
  #else
52
54
  rb_warn("Pango::Context#itemize(base_dir, text, start_index, length, attrs, cached_iter) isn't supported on this environment.");
53
- list = pango_itemize(_SELF(self),
54
- RVAL2CSTR(arg1), /* text */
55
- NUM2INT(arg2), /* start_index */
55
+ list = pango_itemize(_SELF(self),
56
+ RVAL2CSTR(arg1), /* text */
57
+ NUM2INT(arg2), /* start_index */
56
58
  NUM2INT(arg3), /* length */
57
59
  RVAL2PANGOATTRLIST(arg4), /* attrs */
58
60
  NIL_P(arg5) ? NULL : RVAL2PANGOATTRITERATOR(arg5)); /* cached_iter */
@@ -111,7 +113,7 @@ rg_language(VALUE self)
111
113
  static VALUE
112
114
  rg_set_language(VALUE self, VALUE lang)
113
115
  {
114
- pango_context_set_language(_SELF(self),
116
+ pango_context_set_language(_SELF(self),
115
117
  RVAL2PANGOLANGUAGE(lang));
116
118
  return self;
117
119
  }
@@ -167,7 +169,7 @@ rg_matrix(VALUE self)
167
169
  static VALUE
168
170
  rg_set_matrix(VALUE self, VALUE matrix)
169
171
  {
170
- pango_context_set_matrix(_SELF(self),
172
+ pango_context_set_matrix(_SELF(self),
171
173
  RVAL2PANGOMATRIX(matrix));
172
174
  return self;
173
175
  }
@@ -192,8 +194,8 @@ rg_get_metrics(int argc, VALUE *argv, VALUE self)
192
194
 
193
195
  rb_scan_args(argc, argv, "11", &desc, &lang);
194
196
 
195
- return PANGOFONTMETRICS2RVAL(pango_context_get_metrics(_SELF(self),
196
- RVAL2PANGOFONTDESCRIPTION(desc),
197
+ return PANGOFONTMETRICS2RVAL(pango_context_get_metrics(_SELF(self),
198
+ RVAL2PANGOFONTDESCRIPTION(desc),
197
199
  NIL_P(lang) ? NULL : RVAL2PANGOLANGUAGE(lang)));
198
200
  }
199
201
 
@@ -253,6 +255,36 @@ rg_resolution(VALUE self)
253
255
  {
254
256
  return rb_float_new(pango_cairo_context_get_resolution(_SELF(self)));
255
257
  }
258
+
259
+ static void
260
+ shape_renderer_callback(cairo_t *cr,
261
+ PangoAttrShape *attr,
262
+ gboolean do_path,
263
+ gpointer data)
264
+ {
265
+ VALUE rb_cr;
266
+ VALUE rb_attr;
267
+ VALUE rb_do_path;
268
+ VALUE rb_callback;
269
+
270
+ rb_cr = CRCONTEXT2RVAL(cr);
271
+ rb_attr = ATTR2RVAL((PangoAttribute *)attr);
272
+ rb_do_path = CBOOL2RVAL(do_path);
273
+ rb_callback = (VALUE)data;
274
+ rb_funcall(rb_callback, id_call, 3, rb_cr, rb_attr, rb_do_path);
275
+ }
276
+
277
+ static VALUE
278
+ rg_set_shape_renderer(VALUE self)
279
+ {
280
+ VALUE func = rb_block_proc();
281
+ rb_iv_set(self, "@shape_renderer", func);
282
+ pango_cairo_context_set_shape_renderer(_SELF(self),
283
+ shape_renderer_callback,
284
+ (gpointer)func,
285
+ NULL);
286
+ return self;
287
+ }
256
288
  #endif
257
289
 
258
290
  static VALUE
@@ -267,6 +299,8 @@ Init_pango_context(VALUE mPango)
267
299
  {
268
300
  VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(PANGO_TYPE_CONTEXT, "Context", mPango);
269
301
 
302
+ id_call = rb_intern("call");
303
+
270
304
  RG_DEF_METHOD(itemize, -1);
271
305
 
272
306
  #ifdef PANGO_ENABLE_BACKEND
@@ -298,6 +332,7 @@ Init_pango_context(VALUE mPango)
298
332
  RG_DEF_METHOD(font_options, 0);
299
333
  RG_DEF_METHOD(set_resolution, 1);
300
334
  RG_DEF_METHOD(resolution, 0);
335
+ RG_DEF_METHOD(set_shape_renderer, 0);
301
336
  #endif
302
337
 
303
338
  /* This will remove 2 or 3 releases later since 0.14.0. */
@@ -1,6 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2011-2016 Ruby-GNOME2 Project Team
4
4
  * Copyright (C) 2005 Masao Mutoh
5
5
  *
6
6
  * This library is free software; you can redistribute it and/or
@@ -83,11 +83,11 @@ rg_geometry(VALUE self)
83
83
  static VALUE
84
84
  rg_set_geometry(VALUE self, VALUE width, VALUE x_offset, VALUE y_offset)
85
85
  {
86
- PangoGlyphGeometry geo = _SELF(self)->geometry;
86
+ PangoGlyphGeometry *geo = &(_SELF(self)->geometry);
87
87
 
88
- geo.width = NUM2INT(width);
89
- geo.x_offset = NUM2INT(x_offset);
90
- geo.y_offset = NUM2INT(y_offset);
88
+ geo->width = NUM2INT(width);
89
+ geo->x_offset = NUM2INT(x_offset);
90
+ geo->y_offset = NUM2INT(y_offset);
91
91
 
92
92
  return self;
93
93
  }
@@ -0,0 +1,113 @@
1
+ # Copyright (C) 2016 Ruby-GNOME2 Project Team
2
+ #
3
+ # This library is free software; you can redistribute it and/or
4
+ # modify it under the terms of the GNU Lesser General Public
5
+ # License as published by the Free Software Foundation; either
6
+ # version 2.1 of the License, or (at your option) any later version.
7
+ #
8
+ # This library is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
+ # Lesser General Public License for more details.
12
+ #
13
+ # You should have received a copy of the GNU Lesser General Public
14
+ # License along with this library; if not, write to the Free Software
15
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
+
17
+ class TestContext < Test::Unit::TestCase
18
+ include PangoTestUtils
19
+
20
+ def setup
21
+ font_map = Pango::CairoFontMap.default
22
+ @context = font_map.create_context
23
+ end
24
+
25
+ def test_set_font_map
26
+ font_map = Pango::CairoFontMap.default
27
+ @context.font_map = font_map
28
+ assert_equal(font_map, @context.font_map)
29
+ end
30
+
31
+ def test_set_font_description
32
+ description = Pango::FontDescription.new("monospace")
33
+ description.size = 10 * Pango::SCALE
34
+ @context.font_description = description
35
+ assert_equal("monospace 10", @context.font_description.to_s)
36
+ end
37
+
38
+ def test_set_language
39
+ @context.language = Pango::Language.new("fr")
40
+ assert_equal("fr", @context.language.to_s)
41
+ end
42
+
43
+ def test_set_base_dir
44
+ @context.base_dir = Pango::Context::DIRECTION_LTR
45
+ assert_equal(Pango::Context::DIRECTION_LTR, @context.base_dir)
46
+ end
47
+
48
+ def test_set_gravity
49
+ @context.gravity_hint = Pango::Gravity::HINT_STRONG
50
+ assert_equal(Pango::Gravity::HINT_STRONG, @context.gravity_hint)
51
+ end
52
+
53
+ def test_set_matrix
54
+ matrix = Pango::Matrix.new(0.1, 0.2, 0.3, 0.4, 0.5, 0.6)
55
+ @context.matrix = matrix
56
+ assert_equal(0.1, @context.matrix.xx)
57
+ assert_equal(0.2, @context.matrix.xy)
58
+ assert_equal(0.3, @context.matrix.yx)
59
+ assert_equal(0.4, @context.matrix.yy)
60
+ assert_equal(0.5, @context.matrix.x0)
61
+ assert_equal(0.6, @context.matrix.y0)
62
+ end
63
+
64
+ def test_load_font
65
+ description = Pango::FontDescription.new("monospace")
66
+ description.size = 10 * Pango::SCALE
67
+ font = @context.load_font(description)
68
+ assert_equal(10,
69
+ (font.describe.size.to_f / Pango::SCALE).round)
70
+ end
71
+
72
+ def test_load_fontset
73
+ description = Pango::FontDescription.new("monospace")
74
+ description.size = 10 * Pango::SCALE
75
+ language = Pango::Language.new("fr")
76
+ fontset = @context.load_fontset(description, language)
77
+ a_unicode = GLib::UTF8.get_char("a")
78
+ font = fontset.get_font(a_unicode)
79
+ assert_equal(10,
80
+ (font.describe.size.to_f / Pango::SCALE).round)
81
+ end
82
+
83
+ def test_get_metrics
84
+ description = Pango::FontDescription.new("monospace")
85
+ description.size = 10 * Pango::SCALE
86
+ language = Pango::Language.new("fr")
87
+ metrics = @context.get_metrics(description, language)
88
+ assert do
89
+ metrics.ascent > metrics.descent
90
+ end
91
+ end
92
+
93
+ def test_families
94
+ family_names = @context.families.collect(&:name)
95
+ assert do
96
+ family_names.include?("Monospace")
97
+ end
98
+ end
99
+
100
+ def test_font_options
101
+ options = Cairo::FontOptions.new
102
+ options.antialias = Cairo::Antialias::BEST
103
+ @context.font_options = options
104
+ assert_equal(Cairo::Antialias::BEST,
105
+ @context.font_options.antialias)
106
+ end
107
+
108
+ def test_resolution
109
+ dpi = 72
110
+ @context.resolution = dpi
111
+ assert_equal(dpi, @context.resolution)
112
+ end
113
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pango
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.8
4
+ version: 3.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - The Ruby-GNOME2 Project Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-03 00:00:00.000000000 Z
11
+ date: 2016-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cairo
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 3.0.8
33
+ version: 3.0.9
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: 3.0.8
40
+ version: 3.0.9
41
41
  description: Ruby/Pango is a Ruby binding of pango-1.x.
42
42
  email: ruby-gnome2-devel-en@lists.sourceforge.net
43
43
  executables: []
@@ -106,6 +106,7 @@ files:
106
106
  - test/test-analysis.rb
107
107
  - test/test-attribute.rb
108
108
  - test/test-color.rb
109
+ - test/test-context.rb
109
110
  - test/test-language.rb
110
111
  - test/test-layout.rb
111
112
  - test/test-log-attr.rb
@@ -124,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
124
125
  requirements:
125
126
  - - ">="
126
127
  - !ruby/object:Gem::Version
127
- version: 1.9.3
128
+ version: 2.1.0
128
129
  required_rubygems_version: !ruby/object:Gem::Requirement
129
130
  requirements:
130
131
  - - ">="