makeallttffonts.php 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <?php
  2. //============================================================+
  3. // File name : makeallttffonts.php
  4. // Begin : 2008-12-07
  5. // Last Update : 2010-12-03
  6. //
  7. // Description : Process all TTF files on current directory to
  8. // build TCPDF compatible font files.
  9. //
  10. // Author: Nicola Asuni
  11. //
  12. // (c) Copyright:
  13. // Nicola Asuni
  14. // Tecnick.com S.r.l.
  15. // Via della Pace, 11
  16. // 09044 Quartucciu (CA)
  17. // ITALY
  18. // www.tecnick.com
  19. // info@tecnick.com
  20. //
  21. // License:
  22. // Copyright (C) 2004-2010 Nicola Asuni - Tecnick.com S.r.l.
  23. //
  24. // This file is part of TCPDF software library.
  25. //
  26. // TCPDF is free software: you can redistribute it and/or modify it
  27. // under the terms of the GNU Lesser General Public License as
  28. // published by the Free Software Foundation, either version 3 of the
  29. // License, or (at your option) any later version.
  30. //
  31. // TCPDF is distributed in the hope that it will be useful, but
  32. // WITHOUT ANY WARRANTY; without even the implied warranty of
  33. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  34. // See the GNU Lesser General Public License for more details.
  35. //
  36. // You should have received a copy of the GNU Lesser General Public License
  37. // along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
  38. //
  39. // See LICENSE.TXT file for more information.
  40. //============================================================+
  41. /**
  42. * @file
  43. * Process all TTF files on current directory to build TCPDF compatible font files.
  44. * @package com.tecnick.tcpdf
  45. * @author Nicola Asuni
  46. * @since 2008-12-07
  47. */
  48. // read directory for files (only TTF files).
  49. $handle = opendir('.');
  50. while ($file = readdir($handle)) {
  51. $path_parts = pathinfo($file);
  52. if (isset($path_parts['extension']) AND (strtoupper($path_parts['extension']) === 'TTF')) {
  53. if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
  54. // windows
  55. exec('ttf2ufm.exe -a -F '.$path_parts['basename']);
  56. } else {
  57. // linux
  58. exec('./ttf2ufm -a -F '.$path_parts['basename']);
  59. }
  60. exec('php -q makefont.php '.$path_parts['basename'].' '.$path_parts['filename'].'.ufm');
  61. }
  62. }
  63. closedir($handle);
  64. //============================================================+
  65. // END OF FILE
  66. //============================================================+