Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-47333

$CFG->dataroot/fonts folder no longer overrides ./lib/tcpdf/fonts folder

    XMLWordPrintable

Details

    • MOODLE_26_STABLE, MOODLE_27_STABLE
    • MOODLE_26_STABLE, MOODLE_27_STABLE
    • wip_MDL-47333_m28_fonts
    • Hide

      Add your custom fonts to the lib/tcpdf/fonts/ directory instead.

      Show
      Add your custom fonts to the lib/tcpdf/fonts/ directory instead.
    • Hide

      1/ install several language packs with different alphabets - de, zh_cn, ja, ar for example
      2/ open http://yourserver.local/moodle/lib/tests/other/pdflibtestpage.php and try
      different font families by modifying the URL (use some of the font families listed in the pdf itself) and verify there are no errors - missing chars are OK because not all fonts support all languages
      3/ download the fonts zip from http://sourceforge.net/projects/tcpdf/files/ and extract it into your dataroot/fonts/ directory
      4/ try the test page again - verify there are a lot more fonts, try several fonts including the new ones again
      5/ install certificate module and verify there are no regressions when printing both embedded and non-embedded certificates
      6/ hack mod/certificate/type/A4_embedded/certificate.php to use dejavusans and verify it still works

      Show
      1/ install several language packs with different alphabets - de, zh_cn, ja, ar for example 2/ open http://yourserver.local/moodle/lib/tests/other/pdflibtestpage.php and try different font families by modifying the URL (use some of the font families listed in the pdf itself) and verify there are no errors - missing chars are OK because not all fonts support all languages 3/ download the fonts zip from http://sourceforge.net/projects/tcpdf/files/ and extract it into your dataroot/fonts/ directory 4/ try the test page again - verify there are a lot more fonts, try several fonts including the new ones again 5/ install certificate module and verify there are no regressions when printing both embedded and non-embedded certificates 6/ hack mod/certificate/type/A4_embedded/certificate.php to use dejavusans and verify it still works

    Description

      When the tcpdf library was last upgraded, in MDL-40107, it introduced a bug that prevents the default font folder from being replaced by a fonts folder in dataroot. This prevents using custom / additional fonts in custom certificate types (unless you place the font files in lib/tcpdf/fonts).

      pdflib.php defines the pdf class which overides the TCPDF class. Support for custom font folders is introduce by overiding the _getfontpath() member function. However in the new version of TCPDF this function has been moved into a new class TCPDF_FONTS causing the Moodle version of _getfontpath() to no longer be called.

      I haven't confirmed that Moodle 2.5 works. But I had M22, M26, and M27 test sites that I tested the bug against. M22 worked, but M26 and M27 sites were both broken.

      Attachments

        Issue Links

          Activity

            People

              skodak Petr Skoda
              moorejon Jonathan Moore
              Sam Hemelryk Sam Hemelryk
              Dan Poltawski Dan Poltawski
              Mark Nelson Mark Nelson
              Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Sara Arjona (@sarjona)
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                10/Nov/14