Hello community,
here is the log from the commit of package perl-Font-FreeType for
openSUSE:Factory checked in at 2018-04-19 15:26:45
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Font-FreeType (Old)
and /work/SRC/openSUSE:Factory/.perl-Font-FreeType.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Font-FreeType"
Thu Apr 19 15:26:45 2018 rev:25 rq:593452 version:0.10
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Font-FreeType/perl-Font-FreeType.changes
2017-11-15 16:54:15.591816070 +0100
+++
/work/SRC/openSUSE:Factory/.perl-Font-FreeType.new/perl-Font-FreeType.changes
2018-04-19 15:26:49.853567131 +0200
@@ -1,0 +2,12 @@
+Mon Mar 19 06:20:56 UTC 2018 - [email protected]
+
+- updated to 0.10
+ see /usr/share/doc/packages/perl-Font-FreeType/Changes
+
+ 0.10_1 2018-03-18 [email protected]
+ - No changes since 0.10_1
+
+ 0.10_1 2018-03-17 [email protected]
+ - Allow to lookup glyphs by name (mauzo)
+
+-------------------------------------------------------------------
Old:
----
Font-FreeType-0.09.tar.gz
New:
----
Font-FreeType-0.10.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Font-FreeType.spec ++++++
--- /var/tmp/diff_new_pack.1ijUVO/_old 2018-04-19 15:26:50.409544489 +0200
+++ /var/tmp/diff_new_pack.1ijUVO/_new 2018-04-19 15:26:50.413544326 +0200
@@ -1,7 +1,7 @@
#
# spec file for package perl-Font-FreeType
#
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,11 +17,11 @@
Name: perl-Font-FreeType
-Version: 0.09
+Version: 0.10
Release: 0
%define cpan_name Font-FreeType
Summary: Read Font Files and Render Glyphs From Perl Using Freetype2
-License: Artistic-1.0 or GPL-1.0+
+License: Artistic-1.0 OR GPL-1.0-or-later
Group: Development/Libraries/Perl
Url: http://search.cpan.org/dist/Font-FreeType/
Source0:
https://cpan.metacpan.org/authors/id/D/DM/DMOL/%{cpan_name}-%{version}.tar.gz
++++++ Font-FreeType-0.09.tar.gz -> Font-FreeType-0.10.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Font-FreeType-0.09/Changes
new/Font-FreeType-0.10/Changes
--- old/Font-FreeType-0.09/Changes 2017-10-18 21:34:11.000000000 +0200
+++ new/Font-FreeType-0.10/Changes 2018-03-18 19:47:11.000000000 +0100
@@ -1,3 +1,9 @@
+0.10_1 2018-03-18 [email protected]
+ - No changes since 0.10_1
+
+0.10_1 2018-03-17 [email protected]
+ - Allow to lookup glyphs by name (mauzo)
+
0.09 2017-10-18 [email protected]
- Fallback to default charmap for 2.8.1 for backward-compatibility
for FNT-fonts
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Font-FreeType-0.09/FreeType.xs
new/Font-FreeType-0.10/FreeType.xs
--- old/Font-FreeType-0.09/FreeType.xs 2017-10-18 21:32:23.000000000 +0200
+++ new/Font-FreeType-0.10/FreeType.xs 2018-03-17 11:31:59.000000000 +0100
@@ -89,7 +89,8 @@
struct QefFT2_Glyph_
{
SV *face_sv;
- FT_ULong char_code; /* -1 if not yet known */
+ FT_ULong char_code; /* 0 if not yet known */
+ bool has_char_code;
FT_UInt index;
char *name;
};
@@ -198,7 +199,7 @@
}
static SV *
-make_glyph (SV *face_sv, FT_ULong char_code, FT_UInt index)
+make_glyph (SV *face_sv, FT_ULong char_code, bool has_cc, FT_UInt index)
{
Font_FreeType_Glyph glyph;
SV *sv;
@@ -208,6 +209,7 @@
SvREFCNT_inc(face_sv);
glyph->char_code = char_code;
+ glyph->has_char_code = has_cc;
glyph->index = index;
glyph->name = 0;
@@ -803,7 +805,7 @@
CODE:
glyph_idx = FT_Get_Char_Index(face, char_code);
if (glyph_idx || fallback)
- RETVAL = make_glyph(SvRV(ST(0)), char_code, glyph_idx);
+ RETVAL = make_glyph(SvRV(ST(0)), char_code, 1, glyph_idx);
else
RETVAL = &PL_sv_undef;
OUTPUT:
@@ -835,12 +837,43 @@
glyph_idx = FT_Get_Char_Index(face, char_code);
fallback = SvOK(ST(2)) ? SvIV(ST(2)) : 0;
if (glyph_idx || fallback)
- RETVAL = make_glyph(SvRV(ST(0)), char_code, glyph_idx);
+ RETVAL = make_glyph(SvRV(ST(0)), char_code, 1, glyph_idx);
else
RETVAL = &PL_sv_undef;
OUTPUT:
RETVAL
+FT_UInt
+qefft2_face_get_name_index (Font_FreeType_Face face, SV *sv)
+ PREINIT:
+ char *name;
+ CODE:
+ name = SvPV_nolen(sv);
+ RETVAL = FT_Get_Name_Index(face, name);
+ OUTPUT:
+ RETVAL
+
+SV *
+qefft2_face_glyph_from_index (Font_FreeType_Face face, FT_UInt ix)
+ CODE:
+ RETVAL = make_glyph(SvRV(ST(0)), 0, 0, ix);
+ OUTPUT:
+ RETVAL
+
+SV *
+qefft2_face_glyph_from_name (Font_FreeType_Face face, SV *sv, int fallback = 0)
+ PREINIT:
+ char *name;
+ FT_UInt ix;
+ CODE:
+ name = SvPV_nolen(sv);
+ ix = FT_Get_Name_Index(face, name);
+ if (ix || fallback)
+ RETVAL = make_glyph(SvRV(ST(0)), 0, 0, ix);
+ else
+ RETVAL = &PL_sv_undef;
+ OUTPUT:
+ RETVAL
void
qefft2_face_foreach_char (Font_FreeType_Face face, SV *code)
@@ -856,7 +889,7 @@
PUSHMARK(SP);
SAVESPTR(DEFSV);
- DEFSV = sv_2mortal(make_glyph(SvRV(ST(0)), char_code, glyph_idx));
+ DEFSV = sv_2mortal(make_glyph(SvRV(ST(0)), char_code, 1,
glyph_idx));
PUTBACK;
call_sv(code, G_VOID | G_DISCARD);
@@ -896,7 +929,7 @@
FT_ULong char_code;
FT_UInt glyph_idx;
CODE:
- if (glyph->char_code >= 0) {
+ if (glyph->has_char_code) {
RETVAL = newSVuv((UV) glyph->char_code);
}
else {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Font-FreeType-0.09/META.json
new/Font-FreeType-0.10/META.json
--- old/Font-FreeType-0.09/META.json 2017-10-18 21:35:34.000000000 +0200
+++ new/Font-FreeType-0.10/META.json 2018-03-18 19:55:59.000000000 +0100
@@ -10,7 +10,7 @@
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
- "version" : "2"
+ "version" : 2
},
"name" : "Font-FreeType",
"no_index" : {
@@ -49,6 +49,6 @@
"url" : "https://github.com/zmughal/p5-Font-FreeType"
}
},
- "version" : "0.09",
- "x_serialization_backend" : "JSON::PP version 2.27400"
+ "version" : "0.10",
+ "x_serialization_backend" : "JSON::PP version 2.97001"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Font-FreeType-0.09/META.yml
new/Font-FreeType-0.10/META.yml
--- old/Font-FreeType-0.09/META.yml 2017-10-18 21:35:34.000000000 +0200
+++ new/Font-FreeType-0.10/META.yml 2018-03-18 19:55:59.000000000 +0100
@@ -24,5 +24,5 @@
perl: '5.008001'
resources:
repository: https://github.com/zmughal/p5-Font-FreeType
-version: '0.09'
-x_serialization_backend: 'CPAN::Meta::YAML version 0.012'
+version: '0.10'
+x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Font-FreeType-0.09/lib/Font/FreeType/Face.pm
new/Font-FreeType-0.10/lib/Font/FreeType/Face.pm
--- old/Font-FreeType-0.09/lib/Font/FreeType/Face.pm 2017-10-18
21:32:23.000000000 +0200
+++ new/Font-FreeType-0.10/lib/Font/FreeType/Face.pm 2018-03-17
11:31:59.000000000 +0100
@@ -128,6 +128,25 @@
I<fallback> isn't defined; otherwise, i.e. if I<fallback = true>
returns fonts I<missing glyph>.
+=item get_name_index(I<name>)
+
+Looks up a glyph by name and returns the index for that glyph in the
+font. Returns 0 if the name is not found.
+
+=item glyph_from_index(I<index>)
+
+Returns a L<Font::FreeType::Glyph|Font::FreeType::Glyph> object for the
+glyph at the given index.
+
+=item glyph_from_name(I<name>, I<fallback = 0>)
+
+Looks up a glyph by name and returns a
+L<Font::FreeType::Glyph|Font::FreeType::Glyph> object.
+
+Returns I<undef> if the glyph is not available in the font and
+I<fallback> isn't defined; otherwise, i.e. if I<fallback = true>
+returns fonts I<missing glyph>.
+
=item has_glyph_names()
True if individual glyphs have names. If so, the names can be
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Font-FreeType-0.09/lib/Font/FreeType.pm
new/Font-FreeType-0.10/lib/Font/FreeType.pm
--- old/Font-FreeType-0.09/lib/Font/FreeType.pm 2017-10-18 21:34:34.000000000
+0200
+++ new/Font-FreeType-0.10/lib/Font/FreeType.pm 2018-03-18 19:55:37.000000000
+0100
@@ -2,7 +2,7 @@
use warnings;
use strict;
-our $VERSION = '0.09';
+our $VERSION = '0.10';
require DynaLoader;
our @ISA = qw( DynaLoader );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Font-FreeType-0.09/t/10metrics_verasans.t
new/Font-FreeType-0.10/t/10metrics_verasans.t
--- old/Font-FreeType-0.09/t/10metrics_verasans.t 2017-10-18
21:32:23.000000000 +0200
+++ new/Font-FreeType-0.10/t/10metrics_verasans.t 2018-03-17
11:31:59.000000000 +0100
@@ -9,13 +9,16 @@
use warnings;
use utf8;
-use Test::More tests => 78 + 5 * 2 + 256 * 2 + 5;
+use Test::More;
use File::Spec::Functions;
use Font::FreeType;
+my $Tests;
+
my $data_dir = catdir(qw( t data ));
# Load the Vera Sans face.
+BEGIN { $Tests = 2 }
my $ft = Font::FreeType->new;
my $vera = $ft->face(catfile($data_dir, 'Vera.ttf'));
ok($vera, 'FreeType->face() should return an object');
@@ -23,6 +26,7 @@
'FreeType->face() should return blessed ref');
# Test general properties of the face.
+BEGIN { $Tests += 5 }
is($vera->number_of_faces, 1, '$face->number_of_faces() is right');
is($vera->current_face_index, 0, '$face->current_face_index() is right');
@@ -47,6 +51,7 @@
is_sfnt => 1,
);
+BEGIN { $Tests += 10 }
foreach my $method (sort keys %expected_flags) {
my $expected = $expected_flags{$method};
my $got = $vera->$method();
@@ -59,6 +64,7 @@
}
# Some other general properties.
+BEGIN { $Tests += 8 }
is($vera->number_of_glyphs, 268, '$face->number_of_glyphs() is right');
is($vera->units_per_em, 2048, '$face->units_per_em() is right');
my $underline_position = $vera->underline_position;
@@ -74,6 +80,8 @@
my @fixed_sizes = $vera->fixed_sizes;
is(scalar @fixed_sizes, 0, 'Vera has no fixed sizes');
+BEGIN { $Tests += 3 }
+
subtest "charmaps" => sub {
subtest "default charmap" => sub {
my $default_cm = $vera->charmap;
@@ -122,6 +130,8 @@
my $glyph_list_filename = catfile($data_dir, 'vera_glyphs.txt');
open my $glyph_list, '<', $glyph_list_filename
or die "error opening file for list of glyphs: $!";
+
+BEGIN { $Tests += 256*2 + 1 }
$vera->foreach_char(sub {
die "shouldn't be any argumetns passed in" unless @_ == 0;
my $line = <$glyph_list>;
@@ -136,44 +146,65 @@
});
is(scalar <$glyph_list>, undef, "we aren't missing any glyphs");
-
# Test metrics on some particlar glyphs.
-my %glyph_metrics = (
- 'A' => { name => 'A', advance => 1401,
- LBearing => 16, RBearing => 17 },
- '_' => { name => 'underscore', advance => 1024,
- LBearing => -20, RBearing => -20 },
- '`' => { name => 'grave', advance => 1024,
- LBearing => 170, RBearing => 375 },
- 'g' => { name => 'g', advance => 1300,
- LBearing => 113, RBearing => 186 },
- '|' => { name => 'bar', advance => 690,
- LBearing => 260, RBearing => 260 },
+my @glyph_metrics = (
+ { name => 'A', char => 'A', ccode => 65, index => 36,
+ advance => 1401, LBearing => 16, RBearing => 17 },
+ { name => 'underscore', char => '_', ccode => 95, index => 66,
+ advance => 1024, LBearing => -20, RBearing => -20 },
+ { name => 'grave', char => '`', ccode => 96, index => 67,
+ advance => 1024, LBearing => 170, RBearing => 375 },
+ { name => 'g', char => 'g', ccode => 103, index => 74,
+ advance => 1300, LBearing => 113, RBearing => 186 },
+ { name => 'bar', char => '|', ccode => 124, index => 95,
+ advance => 690, LBearing => 260, RBearing => 260 },
);
# Set the size to match the em size, so that the values are in font units.
$vera->set_char_size(2048, 2048, 72, 72);
-# 5*2 tests.
-foreach my $get_by_code (0 .. 1) {
- foreach my $char (sort keys %glyph_metrics) {
- my $glyph = $get_by_code ? $vera->glyph_from_char_code(ord $char)
- : $vera->glyph_from_char($char);
+BEGIN { $Tests += 5*4*7 }
+foreach my $get_by (qw/char code index name/) {
+ foreach (@glyph_metrics) {
+ my $glyph;
+ if ($get_by eq "char") {
+ $glyph = $vera->glyph_from_char($_->{char});
+ }
+ elsif ($get_by eq "code") {
+ $glyph = $vera->glyph_from_char_code($_->{ccode});
+ }
+ elsif ($get_by eq "index") {
+ $glyph = $vera->glyph_from_index($_->{index});
+ }
+ elsif ($get_by eq "name") {
+ $glyph = $vera->glyph_from_name($_->{name});
+ }
+ my $char = $_->{char};
die "no glyph for character '$char'" unless $glyph;
- local $_ = $glyph_metrics{$char};
is($glyph->name, $_->{name},
- "name of glyph '$char'");
+ "name of glyph '$char', by $get_by");
+ is($glyph->index, $_->{index},
+ "index of glyph '$char', by $get_by");
+ is($glyph->char_code, $_->{ccode},
+ "char code of glyph '$char', by $get_by");
is($glyph->horizontal_advance, $_->{advance},
- "advance width of glyph '$char'");
+ "advance width of glyph '$char', by $get_by");
is($glyph->left_bearing, $_->{LBearing},
- "left bearing of glyph '$char'");
+ "left bearing of glyph '$char', by $get_by");
is($glyph->right_bearing, $_->{RBearing},
- "right bearing of glyph '$char'");
+ "right bearing of glyph '$char', by $get_by");
is($glyph->width, $_->{advance} - $_->{LBearing} - $_->{RBearing},
- "width of glyph '$char'");
+ "width of glyph '$char', by $get_by");
}
}
+BEGIN { $Tests += 5 }
+for (@glyph_metrics) {
+ my $ix = $vera->get_name_index($_->{name});
+ is($ix, $_->{index},
+ "get_name_index for glyph '$$_{char}'");
+}
+
# Test kerning.
my %kerning = (
__ => 0,
@@ -182,6 +213,7 @@
'T.' => -243,
);
+BEGIN { $Tests += 4*2 }
foreach my $pair (sort keys %kerning) {
my ($kern_x, $kern_y) = $vera->kerning(
map { $vera->glyph_from_char($_)->index } split //, $pair);
@@ -190,6 +222,7 @@
}
# Get just the horizontal kerning more conveniently.
+BEGIN { $Tests += 6 }
my $kern_x = $vera->kerning(
map { $vera->glyph_from_char($_)->index } 'A', 'V');
is($kern_x, -131, "horizontal kerning of 'AV' in scalar context");
@@ -204,4 +237,6 @@
is $vera->glyph_from_char_code(ord '˗', 0), undef, "no fallback glyph";
isnt $vera->glyph_from_char_code(ord '˗', 1), undef, "missing glyph is
defined";
+BEGIN { plan tests => $Tests }
+
# vim:ft=perl ts=4 sw=4 expandtab: