Bug#989626: diffoscope: when comparing fonts with .ttx files, convert the font to .ttx first

Paul Wise pabs at debian.org
Wed Jun 9 02:13:39 BST 2021


Package: diffoscope
Version: 177
Severity: wishlist

diffoscope currently prints a hex dump when comparing a TTF font with a
.ttx XML dump of a TTF font. If it used ttx (from fonttools) to convert
that TTF font to .ttx instead, then the comparison would become an XML
diff, which diffoscope treats as a text diff, which is better than hex.

   $ git clone -q https://gitlab.gnome.org/GNOME/gtksourceview
   
   $ diffoscope gtksourceview/data/fonts/BuilderBlocks.tt{f,x}
   --- gtksourceview/data/fonts/BuilderBlocks.ttf
   +++ gtksourceview/data/fonts/BuilderBlocks.ttx
   @@ -1,28 +1,259 @@
   -00000000: 0001 0000 0008 0080 0003 0000 636d 6170  ............cmap
   -00000010: 0021 0258 0000 0114 0000 004c 676c 7966  .!.X.......Lglyf
   -00000020: 2644 7e48 0000 016c 0000 0030 6865 6164  &D~H...l...0head
   -00000030: 0733 9950 0000 008c 0000 0036 6868 6561  .3.P.......6hhea
   -00000040: 0c01 0402 0000 00c4 0000 0024 686d 7478  ...........$hmtx
   -00000050: 0400 0000 0000 0108 0000 000a 6c6f 6361  ............loca
   -00000060: 0024 000c 0000 0160 0000 000a 6d61 7870  .$.....`....maxp
   -00000070: 0006 0005 0000 00e8 0000 0020 6e61 6d65  ........... name
   ...
   +00000000: 3c3f 786d 6c20 7665 7273 696f 6e3d 2231  <?xml version="1
   +00000010: 2e30 2220 656e 636f 6469 6e67 3d22 7574  .0" encoding="ut
   +00000020: 662d 3822 3f3e 0a3c 7474 466f 6e74 2073  f-8"?>.<ttFont s
   +00000030: 666e 7456 6572 7369 6f6e 3d22 5c78 3030  fntVersion="\x00
   +00000040: 5c78 3031 5c78 3030 5c78 3030 2220 7474  \x01\x00\x00" tt
   +00000050: 4c69 6256 6572 7369 6f6e 3d22 322e 3422  LibVersion="2.4"
   +00000060: 3e0a 0a20 203c 476c 7970 684f 7264 6572  >..  <GlyphOrder
   +00000070: 3e0a 2020 2020 3c21 2d2d 2054 6865 2027  >.    <!-- The '
   ...
   
   $ dpkg -S `which ttx`
   fonttools: /usr/bin/ttx
   
   $ ttx -o gtksourceview/data/fonts/BuilderBlocks.ttf.ttx gtksourceview/data/fonts/BuilderBlocks.ttf
   Dumping "gtksourceview/data/fonts/BuilderBlocks.ttf" to "gtksourceview/data/fonts/BuilderBlocks.ttf.ttx"...
   Dumping 'GlyphOrder' table...
   Dumping 'head' table...
   Dumping 'hhea' table...
   Dumping 'maxp' table...
   Dumping 'hmtx' table...
   Dumping 'cmap' table...
   Dumping 'loca' table...
   Dumping 'glyf' table...
   Dumping 'name' table...
   
   $ diffoscope gtksourceview/data/fonts/BuilderBlocks{,.ttf}.ttx
   --- gtksourceview/data/fonts/BuilderBlocks.ttx
   +++ gtksourceview/data/fonts/BuilderBlocks.ttf.ttx
   @@ -1,65 +1,65 @@
   -<?xml version="1.0" encoding="utf-8"?>
   -<ttFont sfntVersion="\x00\x01\x00\x00" ttLibVersion="2.4">
   +<?xml version="1.0" encoding="UTF-8"?>
   +<ttFont sfntVersion="\x00\x01\x00\x00" ttLibVersion="4.19">
    
      <GlyphOrder>
        <!-- The 'id' attribute is only for humans; it is ignored when parsed. -->
        <GlyphID id="0" name=".notdef"/>
   -    <GlyphID id="1" name="block"/>
   -    <GlyphID id="2" name="empty"/>
   -    <GlyphID id="3" name="smallblock"/>
   +    <GlyphID id="1" name="exclam"/>
   +    <GlyphID id="2" name="uni0001"/>
   +    <GlyphID id="3" name="a"/>
      </GlyphOrder>
    
      <head>
        <!-- Most of this table will be recalculated by the compiler -->
        <tableVersion value="1.0"/>
        <fontRevision value="1.0"/>
   -    <checkSumAdjustment value="0x2a3f4cae"/>
   +    <checkSumAdjustment value="0x6b7bfd56"/>
        <magicNumber value="0x5f0f3cf5"/>
        <flags value="00000000 00000010"/>
        <unitsPerEm value="2048"/>
        <created value="Mon Oct  7 00:00:00 2013"/>
   -    <modified value="Fri Jan 31 15:45:50 2014"/>
   +    <modified value="Tue Aug  1 21:25:46 2017"/>
        <xMin value="0"/>
        <yMin value="0"/>
   -    <xMax value="0"/>
   -    <yMax value="0"/>
   +    <xMax value="1024"/>
   +    <yMax value="2048"/>
        <macStyle value="00000000 00000000"/>
        <lowestRecPPEM value="1"/>
        <fontDirectionHint value="2"/>
        <indexToLocFormat value="0"/>
        <glyphDataFormat value="0"/>
      </head>
   ...

-- System Information:
Debian Release: 11.0
  APT prefers testing-debug
  APT policy: (900, 'testing-debug'), (900, 'testing'), (800, 'unstable-debug'), (800, 'unstable'), (790, 'buildd-unstable'), (700, 'experimental-debug'), (700, 'experimental'), (690, 'buildd-experimental'), (500, 'testing-security')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.0-7-amd64 (SMP w/8 CPU threads)
Kernel taint flags: TAINT_OOT_MODULE, TAINT_UNSIGNED_MODULE
Locale: LANG=en_AU.utf8, LC_CTYPE=en_AU.utf8 (charmap=UTF-8), LANGUAGE=en_AU:en
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages diffoscope depends on:
ii  diffoscope-minimal  177

Versions of packages diffoscope recommends:
ii  abootimg                         0.6-1+b2
ii  acl                              2.2.53-10
ii  apksigner                        30.0.3-4
ii  apktool                          2.5.0+dfsg.1-2
ii  binutils-multiarch               2.35.2-2
ii  bzip2                            1.0.8-4
ii  caca-utils                       0.99.beta19-2.2
ii  colord                           1.4.5-3
ii  db-util                          5.3.1+nmu1
ii  default-jdk [java-sdk]           2:1.11-72
ii  default-jdk-headless             2:1.11-72
pn  device-tree-compiler             <none>
pn  docx2txt                         <none>
ii  e2fsprogs                        1.46.2-1
ii  enjarify                         1:1.0.3-5
ii  ffmpeg                           7:4.3.2-0+deb11u2
ii  fontforge-extras                 1:20201107~dfsg-4
pn  fp-utils                         <none>
ii  genisoimage                      9:1.1.11-3.2
ii  gettext                          0.21-4
ii  ghc                              8.8.4-2
ii  ghostscript                      9.53.3~dfsg-7
ii  giflib-tools                     5.1.9-2
ii  gnumeric                         1.12.48-1+b2
ii  gnupg                            2.2.27-2
ii  gnupg-utils                      2.2.27-2
pn  hdf5-tools                       <none>
ii  imagemagick                      8:6.9.11.60+dfsg-1.3
ii  imagemagick-6.q16 [imagemagick]  8:6.9.11.60+dfsg-1.3
ii  jsbeautifier                     1.13.0-1
ii  libarchive-tools                 3.4.3-2+b1
ii  llvm                             1:11.0-51+nmu5
ii  lz4 [liblz4-tool]                1.9.3-2
pn  mono-utils                       <none>
ii  ocaml-nox                        4.11.1-4
pn  odt2txt                          <none>
pn  oggvideotools                    <none>
ii  openjdk-11-jdk [java-sdk]        11.0.11+9-1
ii  openssh-client                   1:8.4p1-5
ii  openssl                          1.1.1k-1
ii  pgpdump                          0.33-2
ii  poppler-utils                    20.09.0-3.1
pn  procyon-decompiler               <none>
ii  python3-argcomplete              1.8.1-1.5
ii  python3-binwalk                  2.3.1+dfsg1-1
ii  python3-debian                   0.1.39
ii  python3-defusedxml               0.6.0-2
ii  python3-guestfs                  1:1.44.0-2
ii  python3-jsondiff                 1.1.1-4
ii  python3-pdfminer                 20200726-1
ii  python3-progressbar              2.5-2
ii  python3-pypdf2                   1.26.0-4
ii  python3-pyxattr                  0.7.2-1+b1
ii  python3-rpm                      4.16.1.2+dfsg1-0.4
ii  python3-tlsh                     3.4.4+20151206-1.3+b4
pn  r-base-core                      <none>
pn  radare2                          <none>
ii  rpm2cpio                         4.16.1.2+dfsg1-0.4
ii  sng                              1.1.0-4
ii  sqlite3                          3.34.1-3
ii  squashfs-tools                   1:4.4-2
ii  tcpdump                          4.99.0-2
ii  u-boot-tools                     2021.01+dfsg-5
ii  unzip                            6.0-26
ii  vim-common                       2:8.2.2434-3
pn  wabt                             <none>
pn  xmlbeans                         <none>
ii  xxd                              2:8.2.2434-3
ii  xz-utils                         5.2.5-2
ii  zip                              3.0-12
ii  zstd                             1.4.8+dfsg-2.1

Versions of packages diffoscope suggests:
ii  libjs-jquery  3.5.1+dfsg+~3.5.5-7

-- no debconf information

-- 
bye,
pabs

https://wiki.debian.org/PaulWise
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: This is a digitally signed message part
URL: <http://alioth-lists.debian.net/pipermail/reproducible-builds/attachments/20210609/c58838f6/attachment.sig>


More information about the Reproducible-builds mailing list