Fixing utf-8 bugs.
This commit is contained in:
parent
0164723fbf
commit
694063d5df
@ -116,7 +116,7 @@ sub get_script($self) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub set_script( $self, $script_contents ) {
|
sub set_script( $self, $script_contents ) {
|
||||||
return $self->dir->child('script.pl')->spew_raw($script_contents);
|
return $self->dir->child('script.pl')->spew_utf8($script_contents);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub to_zip($self) {
|
sub to_zip($self) {
|
||||||
|
@ -313,6 +313,8 @@ sub _daemon_script_runner($self) {
|
|||||||
my ( $read_from_parent, $write_to_script );
|
my ( $read_from_parent, $write_to_script );
|
||||||
pipe $read_from_script, $write_to_parent;
|
pipe $read_from_script, $write_to_parent;
|
||||||
pipe $read_from_parent, $write_to_script;
|
pipe $read_from_parent, $write_to_script;
|
||||||
|
binmode $write_to_parent, ':utf8';
|
||||||
|
binmode $write_to_script, ':utf8';
|
||||||
$self->_select->add($read_from_script);
|
$self->_select->add($read_from_script);
|
||||||
$self->_read_from_script($read_from_script);
|
$self->_read_from_script($read_from_script);
|
||||||
$self->_read_from_parent($read_from_parent);
|
$self->_read_from_parent($read_from_parent);
|
||||||
|
@ -276,9 +276,6 @@ sub _get_next_line($self, $lines) {
|
|||||||
sub print_text( $self, $text, $font_size ) {
|
sub print_text( $self, $text, $font_size ) {
|
||||||
my ($none, $file_code, $line) = caller(0);
|
my ($none, $file_code, $line) = caller(0);
|
||||||
die "The bare minimum for font size is 4 at $file_code line $line" if $font_size < 4;
|
die "The bare minimum for font size is 4 at $file_code line $line" if $font_size < 4;
|
||||||
if ( !( ref $text ) ) {
|
|
||||||
$text = $text;
|
|
||||||
}
|
|
||||||
my $tempdir = Path::Tiny->tempdir;
|
my $tempdir = Path::Tiny->tempdir;
|
||||||
my $file = $tempdir->child('result.png');
|
my $file = $tempdir->child('result.png');
|
||||||
my $font = Pango::FontDescription->from_string(
|
my $font = Pango::FontDescription->from_string(
|
||||||
@ -310,6 +307,7 @@ sub print_text( $self, $text, $font_size ) {
|
|||||||
my $context = $layout->get_context;
|
my $context = $layout->get_context;
|
||||||
my $metrics = $context->get_metrics($font, undef);
|
my $metrics = $context->get_metrics($font, undef);
|
||||||
if ( !ref $part ) {
|
if ( !ref $part ) {
|
||||||
|
$part = decode 'utf-8', $part;
|
||||||
Pango::Cairo::update_layout( $cr, $layout );
|
Pango::Cairo::update_layout( $cr, $layout );
|
||||||
$layout->set_text($part);
|
$layout->set_text($part);
|
||||||
$layout->set_font_description($font);
|
$layout->set_font_description($font);
|
||||||
|
Loading…
Reference in New Issue
Block a user