<commit_before>#
# 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

base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path
vendor_dir = base_dir + "vendor" + "local"
vendor_bin_dir = vendor_dir + "bin"
GLib.prepend_dll_path(vendor_bin_dir)
if vendor_dir.exist?
  begin
    require "gobject-introspection"
    vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0"
    GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir)
  rescue LoadError
  end
end
begin
  major, minor, _ = RUBY_VERSION.split(/\./)
  require "#{major}.#{minor}/pango.so"
rescue LoadError
  require "pango.so"
end

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<commit_msg>pango windows: set typelib path after require pango.so<commit_after>#
# 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

base_dir = Pathname.new(__FILE__).dirname.dirname.expand_path
vendor_dir = base_dir + "vendor" + "local"
vendor_bin_dir = vendor_dir + "bin"
GLib.prepend_dll_path(vendor_bin_dir)
begin
  major, minor, _ = RUBY_VERSION.split(/\./)
  require "#{major}.#{minor}/pango.so"
rescue LoadError
  require "pango.so"
end

if vendor_dir.exist?
  begin
    require "gobject-introspection"
    vendor_girepository_dir = vendor_dir + "lib" + "girepository-1.0"
    GObjectIntrospection.prepend_typelib_path(vendor_girepository_dir)
  rescue LoadError
  end
end

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
{'fraction_non_alphanumeric': 0.1362162162162162, 'fraction_numerical': 0.007027027027027027, 'mean_word_length': 3.8955026455026456, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3579661', 'n_tokens_mistral': 1334, 'n_tokens_neox': 1293, 'n_words': 294}