Uploaded image for project: 'PDFBox'
  1. PDFBox
  2. PDFBOX-3759

TTFSubsetter scrambles OpenType ligature and kerning tables (and probably others as well)

    Details

    • Type: Bug
    • Status: Open
    • Priority: Critical
    • Resolution: Unresolved
    • Affects Version/s: 2.0.5
    • Fix Version/s: None
    • Component/s: FontBox
    • Labels:
      None

      Description

      When using the TTFSubsetter as standalone software and subsetting an OpenType/TrueType font, the liga OpenType ligature table gets scrambled "randomly".

      E.g. when viewing the source font "DejaVuSans.ttf" in FontLab Studio, the OpenType liga table is shown as follows:

      feature liga {
       script arab;
      lookup liga33 {
      lookupflag IgnoreMarks RightToLeft;
          sub uniFEDF uniFE88 by uniFEF9;
          sub uniFEDF uniFE84 by uniFEF7;
          sub uniFEDF uniFE82 by uniFEF5;
          sub uniFEE0 uniFE88 by uniFEFA;
          sub uniFEE0 uniFE84 by uniFEF8;
          sub uniFEE0 uniFE82 by uniFEF6;
      } liga33;
      lookup liga35 {
      lookupflag RightToLeft;
          sub space uni0652 by uniFE7E;
          sub space uni0651 by uniFE7C;
          sub space uni0650 by uniFE7A;
          sub space uni064F by uniFE78;
          sub space uni064E by uniFE76;
          sub space uni064D by uniFE74;
          sub space uni064C by uniFE72;
          sub space uni064B by uniFE70;
          sub uni0627 uni0655 by uni0625;
          sub uni0627 uni0654 by uni0623;
          sub uni0627 uni0653 by uni0622;
          sub uni0640 uni0652 by uniFE7F;
          sub uni0640 uni0651 by uniFE7D;
          sub uni0640 uni0650 by uniFE7B;
          sub uni0640 uni064F by uniFE79;
          sub uni0640 uni064E by uniFE77;
          sub uni0640 uni064B by uniFE71;
          sub uni0648 uni0654 by uni0624;
          sub uni064A uni0654 by uni0626;
      } liga35;
       language SND ;
       language URD ;
       language KUR ;
       script latn;
          sub f f l by uniFB04;
          sub f f i by uniFB03;
          sub f l by fl;
          sub f i by fi;
          sub f f by uniFB00;
       language MOL ;
       language ROM ;
       language ISM ;
       language KSM ;
       language LSM ;
       language NSM ;
       language SSM ;
       language SKS ;
      } liga;
      

      This ligature table shows for example, in the latn section, the ffl substitution with the ffl ligature \uFB04.

      However, when viewing a subsetted version of the font (like the one attached), the liga table is scrambled:

      feature liga {
       script arab;
      lookup liga33 {
      lookupflag IgnoreMarks RightToLeft;
          sub _5337 _5250 by _5363;
          sub _5337 _5246 by _5361;
          sub _5337 _5244 by _5359;
          sub _5338 _5250 by _5364;
          sub _5338 _5246 by _5362;
          sub _5338 _5244 by _5360;
      } liga33;
      lookup liga35 {
      lookupflag RightToLeft;
          sub numbersign _1403 by _5240;
          sub numbersign _1402 by _5238;
          sub numbersign _1401 by _5236;
          sub numbersign _1400 by _5234;
          sub numbersign _1399 by _5232;
          sub numbersign _1398 by _5231;
          sub numbersign _1397 by _5229;
          sub numbersign _1396 by _5227;
          sub _1365 _1406 by _1363;
          sub _1365 _1405 by _1361;
          sub _1365 _1404 by _1360;
          sub _1385 _1403 by _5241;
          sub _1385 _1402 by _5239;
          sub _1385 _1401 by _5237;
          sub _1385 _1400 by _5235;
          sub _1385 _1399 by _5233;
          sub _1385 _1396 by _5228;
          sub _1393 _1405 by _1362;
          sub _1395 _1405 by _1364;
      } liga35;
       language SND ;
       language URD ;
       language KUR ;
       script latn;
          sub o o u by _5045;
          sub o o r by _5044;
          sub o u by _5043;
          sub o r by _5042;
          sub o o by _5041;
       language MOL ;
       language ROM ;
       language ISM ;
       language KSM ;
       language LSM ;
       language NSM ;
       language SSM ;
       language SKS ;
      } liga;
      

      The liga table of the subsetted font now want's to replace "oou" instead of "ffl".

      The result, for example in InDesign, is devastating:

      The subsetted font indeed tries to replace "oou" with a non-existing glyph and scrambles the whole text in the rendering. The font subset is unusable.

      I know that it's hard to maintain OpenType features in a font subset, but I would at least expect that the OpenType tables are kept "as-is"...

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              tofi86 Tobias Fischer
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: