Sha256: fb803ca9b8b5bd489042fd41c5fc2532d0ed5d4b68bfefa9f6eeafb2e8a808eb

Contents?: true

Size: 1.51 KB

Versions: 2

Compression:

Stored size: 1.51 KB

Contents

#
# pango.rb
# Copyright(C) 2005, 2009 Ruby-GNOME2 Project.
#
# This program is licenced under the same
# license of Ruby-GNOME2.
#

require 'glib2'
begin
  begin
    require 'cairo'
  rescue LoadError
    require 'rubygems'
    require 'cairo'
  end
rescue LoadError
end
require 'pango.so'

module Pango
  LOG_DOMAIN = "Pango"

  class AttrList
    def each(text = nil)
      iter = iterator
      begin
        if text
          s, e = iter.range
          yield(iter, text[s, e - s], s, e)
        else
          yield(iter)
        end
      end while iter.next!
    end
  end

  # [[klass, prefix], ....]]
  targets = [[Layout::Alignment, "ALIGN_"], [AttrScale, "SCALE_"], 
    [Coverage::Level, "COVERAGE_"], [Context::Direction, "DIRECTION_"],
    [Layout::WrapMode, "WRAP_"], [FontDescription::FontMask, "FONT_MASK_"], 
    [FontDescription::Stretch, "STRETCH_"], [FontDescription::Style, "STYLE_"],
    [FontDescription::Variant, "VARIANT_"], [FontDescription::Weight, "WEIGHT_"], 
    [TabArray::TabAlign, "TAB_"],
    [AttrUnderline::Underline, "UNDERLINE_"]]

  targets << [Script, "SCRIPT_"] if defined? Script
  targets << [Layout::EllipsizeMode, "ELLIPSIZE_"] if defined? Layout::EllipsizeMode
  targets << [Renderer::Part, "PART_"] if defined? Renderer::Part

  targets.each do |klass, prefix|
    (klass.constants - klass.superclass.constants).each do |name|
      unless klass.const_get(name).is_a? Class
	const_set("#{prefix}#{name}", klass.const_get(name))
      end
    end
  end
end

GLib::Log.set_log_domain(Pango::LOG_DOMAIN)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pango-0.20.1 src/lib/pango.rb
pango-0.20.0 src/lib/pango.rb