<commit_before>package Bio::EnsEMBL::Renderer;
use strict;
use Exporter;
use vars qw(@ISA);

@ISA = qw(Exporter);

sub new {
    my ($class, $config, $container, $glyphsets_ref) = @_;

    my $self = {
	'glyphsets' => $glyphsets_ref,
	'canvas'    => undef,
	'colourmap' => $config->colourmap(),
	'config'    => $config,
	'container' => $container,
	'spacing'   => 5,
    };

    bless($self, $class);

    $self->render();

    return $self;
}

sub render {
    my ($self) = @_;

    my $config = $self->{'config'};

    #########
    # now set all our labels up with scaled negative coords
    # and while we're looping, tot up the image height
    #
    my $spacing   = $self->{'spacing'};
    my $im_height = $spacing * 1.5;

    for my $glyphset (@{$self->{'glyphsets'}}) {
	next if (scalar @{$glyphset->{'glyphs'}} == 0);

	my $fntheight = (defined $glyphset->label())?$config->texthelper->height($glyphset->label->font()):0;
	my $gstheight = $glyphset->height();

	if($gstheight > $fntheight) {
	    $im_height += $gstheight + $spacing;
	} else {
	    $im_height += $fntheight + $spacing;
	}
    }

    my $im_width = $config->image_width();

    #########
    # create a fresh canvas
    #
    if($self->can('init_canvas')) {
	$self->init_canvas($config, $im_width, $im_height);
    }<commit_msg>uses image height from WebUserConfig.pm<commit_after>package Bio::EnsEMBL::Renderer;
use strict;
use Exporter;
use vars qw(@ISA);

@ISA = qw(Exporter);

sub new {
    my ($class, $config, $container, $glyphsets_ref) = @_;

    my $self = {
	'glyphsets' => $glyphsets_ref,
	'canvas'    => undef,
	'colourmap' => $config->colourmap(),
	'config'    => $config,
	'container' => $container,
	'spacing'   => 5,
    };

    bless($self, $class);

    $self->render();

    return $self;
}

sub render {
    my ($self) = @_;

    my $config = $self->{'config'};

    #########
    # now set all our labels up with scaled negative coords
    # and while we're looping, tot up the image height
    #
    my $spacing   = $self->{'spacing'};
    my $im_height = $spacing * 1.5;

    for my $glyphset (@{$self->{'glyphsets'}}) {
	next if (scalar @{$glyphset->{'glyphs'}} == 0);

	my $fntheight = (defined $glyphset->label())?$config->texthelper->height($glyphset->label->font()):0;
	my $gstheight = $glyphset->height();

	if($gstheight > $fntheight) {
	    $im_height += $gstheight + $spacing;
	} else {
	    $im_height += $fntheight + $spacing;
	}
    }
    $config->image_height($im_height);
    my $im_width = $config->image_width();

    #########
    # create a fresh canvas
    #
    if($self->can('init_canvas')) {
	$self->init_canvas($config, $im_width, $im_height);
    }
{'fraction_non_alphanumeric': 0.20149812734082398, 'fraction_numerical': 0.003745318352059925, 'mean_word_length': 3.3572593800978794, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 48, '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': '1984115', 'n_tokens_mistral': 1039, 'n_tokens_neox': 958, 'n_words': 217}