pango 3.1.1 → 3.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +27 -5
  3. data/ext/pango/depend +2 -2
  4. data/ext/pango/extconf.rb +32 -28
  5. data/ext/pango/pango.def +0 -16
  6. data/ext/pango/rb-pango-attr-list.c +64 -0
  7. data/ext/pango/rb-pango-attribute.c +147 -0
  8. data/ext/pango/rb-pango-context.c +79 -0
  9. data/ext/pango/{rbpangoconversions.h → rb-pango-conversions.h} +4 -6
  10. data/ext/pango/rb-pango-private.h +27 -0
  11. data/ext/pango/rb-pango.c +32 -0
  12. data/ext/pango/rb-pango.h +29 -0
  13. data/extconf.rb +25 -9
  14. data/lib/pango.rb +24 -68
  15. data/lib/pango/cairo-loader.rb +63 -0
  16. data/lib/pango/color.rb +31 -0
  17. data/lib/pango/deprecated.rb +37 -0
  18. data/lib/pango/font-description.rb +29 -0
  19. data/lib/pango/language.rb +29 -0
  20. data/lib/pango/layout.rb +41 -0
  21. data/lib/pango/loader.rb +87 -0
  22. data/lib/pango/markup.rb +31 -0
  23. data/lib/pango/matrix.rb +64 -0
  24. data/lib/pango/rectangle.rb +28 -0
  25. data/lib/pango/version.rb +30 -0
  26. data/test/pango-test-utils.rb +7 -7
  27. data/test/run-test.rb +34 -8
  28. data/test/test-attr-list.rb +28 -0
  29. data/test/test-color.rb +1 -3
  30. data/test/test-context.rb +4 -4
  31. data/test/test-enum.rb +37 -0
  32. data/test/test-font-description.rb +31 -0
  33. data/test/test-language.rb +2 -1
  34. data/test/test-layout.rb +12 -0
  35. data/test/test-markup.rb +30 -0
  36. data/test/test-matrix.rb +131 -5
  37. data/test/test-rectangle.rb +16 -3
  38. metadata +42 -56
  39. data/README +0 -32
  40. data/ext/pango/rbpango.c +0 -356
  41. data/ext/pango/rbpango.h +0 -95
  42. data/ext/pango/rbpangoanalysis.c +0 -218
  43. data/ext/pango/rbpangoattribute.c +0 -506
  44. data/ext/pango/rbpangoattriterator.c +0 -141
  45. data/ext/pango/rbpangoattrlist.c +0 -101
  46. data/ext/pango/rbpangocairo.c +0 -122
  47. data/ext/pango/rbpangocairocontext.c +0 -131
  48. data/ext/pango/rbpangocolor.c +0 -120
  49. data/ext/pango/rbpangocontext.c +0 -344
  50. data/ext/pango/rbpangocoverage.c +0 -106
  51. data/ext/pango/rbpangoengine.c +0 -73
  52. data/ext/pango/rbpangofont.c +0 -110
  53. data/ext/pango/rbpangofontdescription.c +0 -282
  54. data/ext/pango/rbpangofontface.c +0 -73
  55. data/ext/pango/rbpangofontfamily.c +0 -79
  56. data/ext/pango/rbpangofontmap.c +0 -102
  57. data/ext/pango/rbpangofontmetrics.c +0 -85
  58. data/ext/pango/rbpangofontset.c +0 -69
  59. data/ext/pango/rbpangofontsetsimple.c +0 -60
  60. data/ext/pango/rbpangoglyphinfo.c +0 -123
  61. data/ext/pango/rbpangoglyphitem.c +0 -125
  62. data/ext/pango/rbpangoglyphstring.c +0 -151
  63. data/ext/pango/rbpangogravity.c +0 -54
  64. data/ext/pango/rbpangoitem.c +0 -95
  65. data/ext/pango/rbpangolanguage.c +0 -94
  66. data/ext/pango/rbpangolayout.c +0 -583
  67. data/ext/pango/rbpangolayoutiter.c +0 -189
  68. data/ext/pango/rbpangolayoutline.c +0 -243
  69. data/ext/pango/rbpangologattr.c +0 -109
  70. data/ext/pango/rbpangomatrix.c +0 -143
  71. data/ext/pango/rbpangoprivate.h +0 -49
  72. data/ext/pango/rbpangorectangle.c +0 -170
  73. data/ext/pango/rbpangorenderer.c +0 -193
  74. data/ext/pango/rbpangoscript.c +0 -84
  75. data/ext/pango/rbpangoscriptiter.c +0 -92
  76. data/ext/pango/rbpangotabarray.c +0 -128
  77. data/sample/attribute.rb +0 -82
  78. data/sample/break.rb +0 -28
  79. data/sample/gdk_layout.rb +0 -27
  80. data/sample/glyphstring.rb +0 -61
  81. data/sample/item.rb +0 -37
  82. data/sample/label.rb +0 -23
  83. data/sample/layout.rb +0 -102
  84. data/sample/pango_cairo.rb +0 -66
  85. data/sample/parse.rb +0 -33
  86. data/sample/sample.txt +0 -10
  87. data/sample/script.rb +0 -23
@@ -0,0 +1,29 @@
1
+ # Copyright (C) 2017 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
+ module Pango
18
+ class Language
19
+ class << self
20
+ def new(name=nil)
21
+ if name
22
+ from_string(name)
23
+ else
24
+ super
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,41 @@
1
+ # Copyright (C) 2017 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
+ module Pango
18
+ class Layout
19
+ alias_method :set_font_description_raw, :set_font_description
20
+ def set_font_description(description)
21
+ unless description.is_a?(FontDescription)
22
+ description = FontDescription.new(description)
23
+ end
24
+ set_font_description_raw(description)
25
+ end
26
+ remove_method :font_description=
27
+ alias_method :font_description=, :set_font_description
28
+
29
+ alias_method :set_text_raw, :set_text
30
+ def set_text(text)
31
+ set_text_raw(text, text.length)
32
+ end
33
+ alias_method :text=, :set_text
34
+
35
+ alias_method :set_markup_raw, :set_markup
36
+ def set_markup(markup)
37
+ set_markup_raw(markup, markup.length)
38
+ end
39
+ alias_method :markup=, :set_markup
40
+ end
41
+ end
@@ -0,0 +1,87 @@
1
+ # Copyright (C) 2017 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
+ module Pango
18
+ class Loader < GObjectIntrospection::Loader
19
+ private
20
+ def pre_load(repository, namespace)
21
+ @pending_attribute_infos = []
22
+ end
23
+
24
+ def post_load(repository, namespace)
25
+ require_extension
26
+ @pending_attribute_infos.each do |info|
27
+ name = rubyish_class_name(info)
28
+ klass = @base_module.const_get(name)
29
+ load_fields(info, klass)
30
+ load_methods(info, klass)
31
+ end
32
+ require_libraries
33
+ end
34
+
35
+ def load_struct_info(info)
36
+ case info.name
37
+ when /Class\z/
38
+ super
39
+ when "Attribute"
40
+ @pending_attribute_infos << info
41
+ when /\AAttr[A-Z]/
42
+ if info.name == "AttrIterator"
43
+ super
44
+ else
45
+ @pending_attribute_infos << info
46
+ end
47
+ else
48
+ super
49
+ end
50
+ end
51
+
52
+ def load_method_info(info, klass, method_name)
53
+ case klass.name
54
+ when "Pango::Matrix"
55
+ case method_name
56
+ when "translate", "scale", "rotate", "concat"
57
+ method_name += "!"
58
+ end
59
+ when "Pango::AttrList"
60
+ return if klass.method_defined?(method_name)
61
+ end
62
+ super(info, klass, method_name)
63
+ end
64
+
65
+ def require_extension
66
+ begin
67
+ major, minor, _ = RUBY_VERSION.split(/\./)
68
+ require "#{major}.#{minor}/pango.so"
69
+ rescue LoadError
70
+ require "pango.so"
71
+ end
72
+ end
73
+
74
+ def require_libraries
75
+ require "pango/color"
76
+ require "pango/font-description"
77
+ require "pango/language"
78
+ require "pango/layout"
79
+ require "pango/rectangle"
80
+ require "pango/markup"
81
+ require "pango/matrix"
82
+ require "pango/version"
83
+
84
+ require "pango/deprecated"
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,31 @@
1
+ # Copyright (C) 2017 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
+ module Pango
18
+ class << self
19
+ alias_method :parse_markup_raw, :parse_markup
20
+ def parse_markup(markup_text, accel_marker=nil)
21
+ success, attr_list, text, accel_char =
22
+ parse_markup_raw(markup_text,
23
+ markup_text.bytesize,
24
+ accel_marker)
25
+ return nil unless success
26
+
27
+ accel_char = nil if accel_char.empty?
28
+ [attr_list, text, accel_char]
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,64 @@
1
+ # Copyright (C) 2017 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
+ module Pango
18
+ class Matrix
19
+ alias_method :initialize_raw, :initialize
20
+ def initialize(xx=nil, xy=nil, yx=nil, yy=nil, x0=nil, y0=nil)
21
+ initialize_raw
22
+ self.xx = xx || 1.0
23
+ self.xy = xy || 0.0
24
+ self.yx = yx || 0.0
25
+ self.yy = yy || 1.0
26
+ self.x0 = x0 || 0.0
27
+ self.y0 = y0 || 0.0
28
+ end
29
+
30
+ def to_a
31
+ [
32
+ xx, xy,
33
+ yx, yy,
34
+ x0,
35
+ y0,
36
+ ]
37
+ end
38
+
39
+ def translate(tx, ty)
40
+ copied_matrix = dup
41
+ copied_matrix.translate!(tx, ty)
42
+ copied_matrix
43
+ end
44
+
45
+ def scale(scale_x, scale_y)
46
+ copied_matrix = dup
47
+ copied_matrix.scale!(scale_x, scale_y)
48
+ copied_matrix
49
+ end
50
+
51
+ def rotate(degree)
52
+ copied_matrix = dup
53
+ copied_matrix.rotate!(degree)
54
+ copied_matrix
55
+ end
56
+
57
+ def concat(matrix)
58
+ copied_matrix = dup
59
+ copied_matrix.concat!(matrix)
60
+ copied_matrix
61
+ end
62
+ alias_method :+, :concat
63
+ end
64
+ end
@@ -0,0 +1,28 @@
1
+ # Copyright (C) 2017 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
+ module Pango
18
+ class Rectangle
19
+ alias_method :initialize_raw, :initialize
20
+ def initialize(x, y, width, height)
21
+ initialize_raw
22
+ self.x = x
23
+ self.y = y
24
+ self.width = width
25
+ self.height = height
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,30 @@
1
+ # Copyright (C) 2017 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
+ module Pango
18
+ module Version
19
+ STRING = Pango.version_string
20
+ MAJOR, MINOR, MICRO = STRING.split(".").collect(&:to_i)
21
+
22
+ class << self
23
+ def or_later?(major, minor, micro=nil)
24
+ micro ||= 0
25
+ message = Pango.version_check(major, minor, micro)
26
+ message.nil?
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,9 +1,9 @@
1
1
  module PangoTestUtils
2
- private
3
- def only_pango_version(major, minor, micro=nil)
4
- micro ||= 0
5
- unless Pango.check_version?(major, minor, micro)
6
- omit("Require Pango >= #{major}.#{minor}.#{micro}")
7
- end
8
- end
2
+ private
3
+ def only_pango_version(major, minor, micro=nil)
4
+ micro ||= 0
5
+ unless Pango::Version.or_later?(major, minor, micro)
6
+ omit("Require Pango >= #{major}.#{minor}.#{micro}")
7
+ end
8
+ end
9
9
  end
data/test/run-test.rb CHANGED
@@ -1,4 +1,20 @@
1
1
  #!/usr/bin/env ruby
2
+ #
3
+ # Copyright (C) 2017 Ruby-GNOME2 Project Team
4
+ #
5
+ # This library is free software; you can redistribute it and/or
6
+ # modify it under the terms of the GNU Lesser General Public
7
+ # License as published by the Free Software Foundation; either
8
+ # version 2.1 of the License, or (at your option) any later version.
9
+ #
10
+ # This library is distributed in the hope that it will be useful,
11
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
+ # Lesser General Public License for more details.
14
+ #
15
+ # You should have received a copy of the GNU Lesser General Public
16
+ # License along with this library; if not, write to the Free Software
17
+ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
2
18
 
3
19
  $VERBOSE = true
4
20
 
@@ -6,23 +22,33 @@ ruby_gnome2_base = File.join(File.dirname(__FILE__), "..", "..")
6
22
  ruby_gnome2_base = File.expand_path(ruby_gnome2_base)
7
23
 
8
24
  glib_base = File.join(ruby_gnome2_base, "glib2")
25
+ gobject_introspection_base = File.join(ruby_gnome2_base, "gobject-introspection")
26
+ cairo_gobject_base = File.join(ruby_gnome2_base, "cairo-gobject")
9
27
  pango_base = File.join(ruby_gnome2_base, "pango")
10
28
 
11
29
  $LOAD_PATH.unshift(File.join(glib_base, "test"))
12
- require 'glib-test-init'
13
30
 
14
- [[glib_base, "glib2"],
15
- [pango_base, "pango"]].each do |target, module_name|
16
- if system("which make > /dev/null")
17
- `make -C #{target.dump} > /dev/null` or exit(1)
31
+ modules = [
32
+ [glib_base, "glib2"],
33
+ [gobject_introspection_base, "gobject-introspection"],
34
+ [cairo_gobject_base, "cairo-gobject"],
35
+ [pango_base, "pango"],
36
+ ]
37
+ modules.each do |target, module_name|
38
+ makefile = File.join(target, "Makefile")
39
+ if File.exist?(makefile) and system("which make > /dev/null")
40
+ `make -C #{target.dump} > /dev/null` or exit(false)
41
+ $LOAD_PATH.unshift(File.join(target, "ext", module_name))
18
42
  end
19
- $LOAD_PATH.unshift(File.join(target, "ext", module_name))
20
43
  $LOAD_PATH.unshift(File.join(target, "lib"))
21
44
  end
22
45
 
46
+ $LOAD_PATH.unshift(File.join(glib_base, "test"))
47
+ require "glib-test-init"
48
+
23
49
  $LOAD_PATH.unshift(File.join(pango_base, "test"))
24
- require 'pango-test-utils'
50
+ require "pango-test-utils"
25
51
 
26
- require 'pango'
52
+ require "pango"
27
53
 
28
54
  exit Test::Unit::AutoRunner.run(true, File.join(pango_base, "test"))
@@ -0,0 +1,28 @@
1
+ # Copyright (C) 2017 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 TestAttrList < Test::Unit::TestCase
18
+ include PangoTestUtils
19
+
20
+ def setup
21
+ @attrs = Pango::AttrList.new
22
+ end
23
+
24
+ def test_insert
25
+ attribute = Pango::AttrLanguage.new(Pango::Language.default)
26
+ @attrs.insert(attribute)
27
+ end
28
+ end
data/test/test-color.rb CHANGED
@@ -1,6 +1,4 @@
1
- # -*- coding: utf-8 -*-
2
- #
3
- # Copyright (C) 2013 Ruby-GNOME2 Project Team
1
+ # Copyright (C) 2013-2017 Ruby-GNOME2 Project Team
4
2
  #
5
3
  # This library is free software; you can redistribute it and/or
6
4
  # modify it under the terms of the GNU Lesser General Public
data/test/test-context.rb CHANGED
@@ -41,13 +41,13 @@ class TestContext < Test::Unit::TestCase
41
41
  end
42
42
 
43
43
  def test_set_base_dir
44
- @context.base_dir = Pango::Context::DIRECTION_LTR
45
- assert_equal(Pango::Context::DIRECTION_LTR, @context.base_dir)
44
+ @context.base_dir = :ltr
45
+ assert_equal(Pango::Direction::LTR, @context.base_dir)
46
46
  end
47
47
 
48
48
  def test_set_gravity
49
- @context.gravity_hint = Pango::Gravity::HINT_STRONG
50
- assert_equal(Pango::Gravity::HINT_STRONG, @context.gravity_hint)
49
+ @context.gravity_hint = :strong
50
+ assert_equal(Pango::GravityHint::STRONG, @context.gravity_hint)
51
51
  end
52
52
 
53
53
  def test_set_matrix