dk / Prima

prima.eu.org
Other
108 stars 27 forks source link

Failure of t/Object/Fonts.t on MacOS at Apple Color Emoji font #56

Closed d-lamb closed 6 years ago

d-lamb commented 6 years ago

Hi Dmitry,

I am unable to install Prima from CPAN due a test failure. This does not appear to be a serious failure that should prevent me from force-installing Prima. But it does seem to be the source of most of the Darwin install failures that are reported for recent Perl versions on CPAN Testers. The test failure is of t/Object/Fonts.t for the "Apple Color Emoji" font, and it looks like the following. I'm not too familiar with Prima, but am happy to help debug. I am running perl 5.26.2 on MacOS 10.12.6 (Sierra). perl -V follows the test output.

ok 2339 - height / Copperplate
ok 2340 - size / Copperplate
ok 2341 - direction / Copperplate
ok 2342 - width by height / Copperplate
ok 2343 - width by size / Copperplate
ok 2344 - style / Copperplate
ok 2345 - text wrap Copperplate
ok 2346 - height / Apple Color Emoji
not ok 2347 - size / Apple Color Emoji
#   Failed test 'size / Apple Color Emoji'
#   at t/Object/Fonts.t line 33.
#          got: '15'
#     expected: '12'
ok 2348 - direction / Apple Color Emoji
not ok 2349 - width by height / Apple Color Emoji
#   Failed test 'width by height / Apple Color Emoji'
#   at t/Object/Fonts.t line 51.
#          got: '18'
#     expected: '15'
ok 2350 - width by size / Apple Color Emoji
ok 2351 - style / Apple Color Emoji
ok 2352 # skip text wrap Apple Color Emoji
xft: want 20x0.0.fixed.Apple Color Emoji/fontspecific^0
xft: want 72x0.0.fixed.Apple Color Emoji/fontspecific^0
xft: want 20x0.0.fixed.Apple Color Emoji/fontspecific^0
ok 2353 - height / Apple Color Emoji
xft: want -48x0.0.fixed.Apple Color Emoji/fontspecific^0
xft: want -12x0.0.fixed.Apple Color Emoji/fontspecific^0
not ok 2354 - size / Apple Color Emoji
#   Failed test 'size / Apple Color Emoji'
#   at t/Object/Fonts.t line 33.
#          got: '15'
#     expected: '12'
xft: want 20x0.0.default.Apple Color Emoji/fontspecific^12
xft: want 20x0.0.default.Apple Color Emoji/fontspecific^0
ok 2355 - direction / Apple Color Emoji
xft: want 20x0.0.fixed.Apple Color Emoji/fontspecific^0
xft: want 20x57.0.default.Apple Color Emoji/fontspecific^0
xft: want 20x15.0.default.Apple Color Emoji/fontspecific^0
not ok 2356 - width by height / Apple Color Emoji
#   Failed test 'width by height / Apple Color Emoji'
#   at t/Object/Fonts.t line 51.
#          got: '18'
#     expected: '15'
xft: want -15x0.0.fixed.Apple Color Emoji/fontspecific^0
xft: want -15x69.0.default.Apple Color Emoji/fontspecific^0
xft: want -15x19.0.default.Apple Color Emoji/fontspecific^0
ok 2357 - width by size / Apple Color Emoji
xft: want 26x0.BTI.default.Apple Color Emoji/fontspecific^0
xft: want 26x0.0.default.Apple Color Emoji/fontspecific^0
ok 2358 - style / Apple Color Emoji
xft: want 16x0.0.fixed.Apple Color Emoji/fontspecific^0
ok 2359 # skip text wrap Apple Color Emoji
ok 2360 - height / FreeSerif
ok 2361 - size / FreeSerif
ok 2362 - direction / FreeSerif
ok 2363 - width by height / FreeSerif
ok 2364 - width by size / FreeSerif
ok 2365 - style / FreeSerif
ok 2366 - text wrap FreeSerif

$ perl -V
Summary of my perl5 (revision 5 version 26 subversion 2) configuration:

  Platform:
    osname=darwin
    osvers=16.7.0
    archname=darwin-thread-multi-2level
    uname='darwin sierra.internal.macports.net 16.7.0 darwin kernel version 16.7.0: tue jan 30 11:27:06 pst 2018; root:xnu-3789.73.11~1release_x86_64 x86_64 '
    config_args='-des -Dprefix=/opt/local -Dscriptdir=/opt/local/bin -Dvendorprefix=/opt/local -Dusemultiplicity=y -Dusethreads -Duseshrplib -Dcc=/usr/bin/clang -Dman1ext=1pm -Dman3ext=3pm -Dinstallstyle=lib/perl5 -Dman1dir=/opt/local/share/man/man1p -Dman3dir=/opt/local/share/man/man3p -Dsitebin=/opt/local/libexec/perl5.26/sitebin -Dsiteman1dir=/opt/local/share/perl5.26/siteman/man1 -Dsiteman3dir=/opt/local/share/perl5.26/siteman/man3 -Dvendorbin=/opt/local/libexec/perl5.26 -Dvendorman1dir=/opt/local/share/perl5.26/man/man1 -Dvendorman3dir=/opt/local/share/perl5.26/man/man3 -Dpager=/usr/bin/less -sR -Dperlpath=/opt/local/bin/perl5.26 -Dstartperl=#!/opt/local/bin/perl5.26 -Acppflags=-I/opt/local/include -Accflags=-pipe -Os  -Alddlflags=-L/opt/local/lib -Wl,-headerpad_max_install_names  -Aldflags=-L/opt/local/lib -Wl,-headerpad_max_install_names '
    hint=recommended
    useposix=true
    d_sigaction=define
    useithreads=define
    usemultiplicity=define
    use64bitint=define
    use64bitall=define
    uselongdouble=undef
    usemymalloc=n
    default_inc_excludes_dot=define
    bincompat5005=undef
  Compiler:
    cc='/usr/bin/clang'
    ccflags ='-fno-common -DPERL_DARWIN -mmacosx-version-min=10.12 -pipe -Os  -fno-strict-aliasing -fstack-protector-strong -I/opt/local/include -DPERL_USE_SAFE_PUTENV'
    optimize='-O3'
    cppflags='-I/opt/local/include -fno-common -DPERL_DARWIN -mmacosx-version-min=10.12 -pipe -Os  -fno-strict-aliasing -fstack-protector-strong -I/opt/local/include'
    ccversion=''
    gccversion='4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.39.2)'
    gccosandvers=''
    intsize=4
    longsize=8
    ptrsize=8
    doublesize=8
    byteorder=12345678
    doublekind=3
    d_longlong=define
    longlongsize=8
    d_longdbl=define
    longdblsize=16
    longdblkind=3
    ivtype='long'
    ivsize=8
    nvtype='double'
    nvsize=8
    Off_t='off_t'
    lseeksize=8
    alignbytes=8
    prototype=define
  Linker and Libraries:
    ld='/usr/bin/clang'
    ldflags =' -mmacosx-version-min=10.12 -L/opt/local/lib -Wl,-headerpad_max_install_names  -fstack-protector-strong'
    libpth=/opt/local/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/9.0.0/lib /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib /usr/lib
    libs=-lpthread -lgdbm -ldbm -ldl -lm -lutil -lc
    perllibs=-lpthread -ldl -lm -lutil -lc
    libc=
    so=dylib
    useshrplib=true
    libperl=libperl.dylib
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_dlopen.xs
    dlext=bundle
    d_dlsymun=undef
    ccdlflags=' '
    cccdlflags=' '
    lddlflags=' -mmacosx-version-min=10.12 -bundle -undefined dynamic_lookup -L/opt/local/lib -Wl,-headerpad_max_install_names  -fstack-protector-strong'

Characteristics of this binary (from libperl): 
  Compile-time options:
    HAS_TIMES
    MULTIPLICITY
    PERLIO_LAYERS
    PERL_COPY_ON_WRITE
    PERL_DONT_CREATE_GVSV
    PERL_IMPLICIT_CONTEXT
    PERL_MALLOC_WRAP
    PERL_OP_PARENT
    PERL_PRESERVE_IVUV
    PERL_USE_SAFE_PUTENV
    USE_64_BIT_ALL
    USE_64_BIT_INT
    USE_ITHREADS
    USE_LARGE_FILES
    USE_LOCALE
    USE_LOCALE_COLLATE
    USE_LOCALE_CTYPE
    USE_LOCALE_NUMERIC
    USE_LOCALE_TIME
    USE_PERLIO
    USE_PERL_ATOF
    USE_REENTRANT_API
  Built under darwin
  Compiled at Apr 23 2018 05:20:45
  %ENV:
    PERL5LIB="/Users/derek/local/lib/perl5"
  @INC:
    /Users/derek/local/lib/perl5/darwin-thread-multi-2level
    /Users/derek/local/lib/perl5
    /opt/local/lib/perl5/site_perl/5.26/darwin-thread-multi-2level
    /opt/local/lib/perl5/site_perl/5.26
    /opt/local/lib/perl5/vendor_perl/5.26/darwin-thread-multi-2level
    /opt/local/lib/perl5/vendor_perl/5.26
    /opt/local/lib/perl5/5.26/darwin-thread-multi-2level
    /opt/local/lib/perl5/5.26
dk commented 6 years ago

Hi

Indeed the issue is microscopic, so if you can ignore it please do. I tried to reproduce it on my virtual machine, but it just works, also with Apple Color Emoji font. I got it from https://github.com/potyt/fonts/raw/master/macfonts/Apple%20Color%20Emoji/Apple%20Color%20Emoji.ttf because my MacOS didn't have it, but it might be the wrong one. I wonder if you could end me your font file?

Dmitry

d-lamb commented 6 years ago

Sure, will send you a link via email.

dk commented 6 years ago

Also, just in case could you run this in your Prima build directory and send me the output?

perl -Iblib/arch -Iblib/lib t/Objects/Fonts.t --debug=F 'Apple Color Emoji'

d-lamb commented 6 years ago

AppleColorEmoji_Font_Test.txt

dk commented 6 years ago

Hi, this font does all sort of crazy things if I load it on my linux. I guess fontconfig just cannot do much with it. So I just ignore it explicitly in tests. Not the best practice, but let's give fontconfig a chance , probably they fix it later

/dk

d-lamb commented 6 years ago

Thanks for checking on this. With 8d24a73 all tests pass.

Unrelated to that commit, there are warning messages from t/Object/Fonts.t of the form:

X Error: BadValue (integer parameter out of range for operation), request: 45(X_OpenFont), after unix/apc_font.c:1822
X Error: BadValue (integer parameter out of range for operation), request: 45(X_OpenFont), after unix/apc_font.c:1161

and

Wide character in print at /opt/local/lib/perl5/vendor_perl/5.26/Test2/Formatter/TAP.pm line 113.
Wide character in print at /opt/local/lib/perl5/vendor_perl/5.26/Test2/Formatter/TAP.pm line 144.

But they are just noisy and do not appear to be causing any problems.

dk commented 6 years ago

Hi,

The first one I have no control over - I've seen this before and that happens when XQuartz tries to load an already installed font that it has trouble reading.

The second one looks like coming from a malformed font name, which unicode name or something similar. If you could trace the font and send me the font file I might fix it.

/dk

d-lamb commented 6 years ago

Almost certainly a unicode font name issue. The 14 (I think) fonts that cause that TAP.pm warning are:

ديوان كوفي فارسي ديوان ثلث النيل التاريخ منى صنعاء مِصحفي ذهبي وسيم فرح مِصحفي بغداد نسخ بيروت

I'll leave it up to you whether and how to fix that!

dk commented 6 years ago

Wow, that's impressive :) Do you think you can send me one of those?

vrurg commented 6 years ago

Have similar problem with a couple of Japanese fonts slipped in with don't know what application. Unfortunately, can't trace down to the file name of the font (Prima's font structure doesn't seem to include that information). But the problem could easily be reproduced with the following line of code:

diag "Font: 苹方-繁";

Guess that

diag "А що за дідко тут коїться?";

would server the purpose too.

I have recently had similar issue on my hands with Test2 framework. Simply include 'use Test2::Plugin::UTF8' in a test file. I have tried it on my side with the recent 'git pull' – it works:

Font: 苹方-繁

ok 4383 # skip height ok 4384 # skip size ok 4385 # skip direction ok 4386 # skip width / 苹方-繁 ok 4387 # skip width / 苹方-繁 ok 4388 # skip style ok 4389 - text wrap 苹方-繁

3 трав. 2018 р. о 13:45 Dmitry Karasik notifications@github.com написав(ла):

Wow, that's impressive :) Do you think you can send me one of those?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/dk/Prima/issues/56#issuecomment-386378802, or mute the thread https://github.com/notifications/unsubscribe-auth/ABg3MDVIZ3BOQ8tTnbqbTq6V1dqflwJvks5tu0I2gaJpZM4TtMS-.

Best regards, Vadim Belman