@@ -154,7 +154,7 @@ public static function addTTFfont($fontfile, $fonttype='', $enc='', $flags=32, $
154
154
$ enc_target = TCPDF_FONT_DATA ::$ encmap [$ enc ];
155
155
$ last = 0 ;
156
156
for ($ i = 32 ; $ i <= 255 ; ++$ i ) {
157
- if ($ enc_target != $ enc_ref [$ i ]) {
157
+ if ($ enc_target[ $ i ] != $ enc_ref [$ i ]) {
158
158
if ($ i != ($ last + 1 )) {
159
159
$ fmetric ['diff ' ] .= $ i .' ' ;
160
160
}
@@ -1490,6 +1490,171 @@ public static function _putfontwidths($font, $cidoffset=0) {
1490
1490
return '/W [ ' .$ w .' ] ' ;
1491
1491
}
1492
1492
1493
+
1494
+
1495
+
1496
+ /**
1497
+ * Update the CIDToGIDMap string with a new value.
1498
+ * @param $map (string) CIDToGIDMap.
1499
+ * @param $cid (int) CID value.
1500
+ * @param $gid (int) GID value.
1501
+ * @return (string) CIDToGIDMap.
1502
+ * @author Nicola Asuni
1503
+ * @since 5.9.123 (2011-09-29)
1504
+ * @public static
1505
+ */
1506
+ public static function updateCIDtoGIDmap ($ map , $ cid , $ gid ) {
1507
+ if (($ cid >= 0 ) AND ($ cid <= 0xFFFF ) AND ($ gid >= 0 )) {
1508
+ if ($ gid > 0xFFFF ) {
1509
+ $ gid -= 0x10000 ;
1510
+ }
1511
+ $ map [($ cid * 2 )] = chr ($ gid >> 8 );
1512
+ $ map [(($ cid * 2 ) + 1 )] = chr ($ gid & 0xFF );
1513
+ }
1514
+ return $ map ;
1515
+ }
1516
+
1517
+ /**
1518
+ * Return fonts path
1519
+ * @return string
1520
+ * @public static
1521
+ */
1522
+ public static function _getfontpath () {
1523
+ if (!defined ('K_PATH_FONTS ' ) AND is_dir ($ fdir = realpath (dirname (__FILE__ ).'/../fonts ' ))) {
1524
+ if (substr ($ fdir , -1 ) != '/ ' ) {
1525
+ $ fdir .= '/ ' ;
1526
+ }
1527
+ define ('K_PATH_FONTS ' , $ fdir );
1528
+ }
1529
+ return defined ('K_PATH_FONTS ' ) ? K_PATH_FONTS : '' ;
1530
+ }
1531
+
1532
+
1533
+
1534
+ /**
1535
+ * Return font full path
1536
+ * @param $file (string) Font file name.
1537
+ * @param $fontdir (string) Font directory (set to false fto search on default directories)
1538
+ * @return string Font full path or empty string
1539
+ * @author Nicola Asuni
1540
+ * @since 6.0.025
1541
+ * @public static
1542
+ */
1543
+ public static function getFontFullPath ($ file , $ fontdir =false ) {
1544
+ $ fontfile = '' ;
1545
+ // search files on various directories
1546
+ if (($ fontdir !== false ) AND @file_exists ($ fontdir .$ file )) {
1547
+ $ fontfile = $ fontdir .$ file ;
1548
+ } elseif (@file_exists (self ::_getfontpath ().$ file )) {
1549
+ $ fontfile = self ::_getfontpath ().$ file ;
1550
+ } elseif (@file_exists ($ file )) {
1551
+ $ fontfile = $ file ;
1552
+ }
1553
+ return $ fontfile ;
1554
+ }
1555
+
1556
+
1557
+
1558
+
1559
+ /**
1560
+ * Get a reference font size.
1561
+ * @param $size (string) String containing font size value.
1562
+ * @param $refsize (float) Reference font size in points.
1563
+ * @return float value in points
1564
+ * @public static
1565
+ */
1566
+ public static function getFontRefSize ($ size , $ refsize =12 ) {
1567
+ switch ($ size ) {
1568
+ case 'xx-small ' : {
1569
+ $ size = ($ refsize - 4 );
1570
+ break ;
1571
+ }
1572
+ case 'x-small ' : {
1573
+ $ size = ($ refsize - 3 );
1574
+ break ;
1575
+ }
1576
+ case 'small ' : {
1577
+ $ size = ($ refsize - 2 );
1578
+ break ;
1579
+ }
1580
+ case 'medium ' : {
1581
+ $ size = $ refsize ;
1582
+ break ;
1583
+ }
1584
+ case 'large ' : {
1585
+ $ size = ($ refsize + 2 );
1586
+ break ;
1587
+ }
1588
+ case 'x-large ' : {
1589
+ $ size = ($ refsize + 4 );
1590
+ break ;
1591
+ }
1592
+ case 'xx-large ' : {
1593
+ $ size = ($ refsize + 6 );
1594
+ break ;
1595
+ }
1596
+ case 'smaller ' : {
1597
+ $ size = ($ refsize - 3 );
1598
+ break ;
1599
+ }
1600
+ case 'larger ' : {
1601
+ $ size = ($ refsize + 3 );
1602
+ break ;
1603
+ }
1604
+ }
1605
+ return $ size ;
1606
+ }
1607
+
1608
+
1609
+
1610
+
1611
+
1612
+
1613
+
1614
+
1615
+
1616
+
1617
+
1618
+
1619
+
1620
+
1621
+
1622
+
1623
+
1624
+
1625
+
1626
+
1627
+
1628
+
1629
+
1630
+
1631
+
1632
+
1633
+
1634
+
1635
+
1636
+
1637
+
1638
+
1639
+
1640
+
1641
+
1642
+
1643
+
1644
+
1645
+
1646
+
1647
+ // ====================================================================================================================
1648
+ // REIMPLEMENTED
1649
+ // ====================================================================================================================
1650
+
1651
+
1652
+
1653
+
1654
+
1655
+
1656
+
1657
+
1493
1658
/**
1494
1659
* Returns the unicode caracter specified by the value
1495
1660
* @param $c (int) UTF-8 value
@@ -1663,64 +1828,6 @@ public static function UniArrSubString($uniarr, $start='', $end='') {
1663
1828
return $ string ;
1664
1829
}
1665
1830
1666
- /**
1667
- * Update the CIDToGIDMap string with a new value.
1668
- * @param $map (string) CIDToGIDMap.
1669
- * @param $cid (int) CID value.
1670
- * @param $gid (int) GID value.
1671
- * @return (string) CIDToGIDMap.
1672
- * @author Nicola Asuni
1673
- * @since 5.9.123 (2011-09-29)
1674
- * @public static
1675
- */
1676
- public static function updateCIDtoGIDmap ($ map , $ cid , $ gid ) {
1677
- if (($ cid >= 0 ) AND ($ cid <= 0xFFFF ) AND ($ gid >= 0 )) {
1678
- if ($ gid > 0xFFFF ) {
1679
- $ gid -= 0x10000 ;
1680
- }
1681
- $ map [($ cid * 2 )] = chr ($ gid >> 8 );
1682
- $ map [(($ cid * 2 ) + 1 )] = chr ($ gid & 0xFF );
1683
- }
1684
- return $ map ;
1685
- }
1686
-
1687
- /**
1688
- * Return fonts path
1689
- * @return string
1690
- * @public static
1691
- */
1692
- public static function _getfontpath () {
1693
- if (!defined ('K_PATH_FONTS ' ) AND is_dir ($ fdir = realpath (dirname (__FILE__ ).'/../fonts ' ))) {
1694
- if (substr ($ fdir , -1 ) != '/ ' ) {
1695
- $ fdir .= '/ ' ;
1696
- }
1697
- define ('K_PATH_FONTS ' , $ fdir );
1698
- }
1699
- return defined ('K_PATH_FONTS ' ) ? K_PATH_FONTS : '' ;
1700
- }
1701
-
1702
- /**
1703
- * Return font full path
1704
- * @param $file (string) Font file name.
1705
- * @param $fontdir (string) Font directory (set to false fto search on default directories)
1706
- * @return string Font full path or empty string
1707
- * @author Nicola Asuni
1708
- * @since 6.0.025
1709
- * @public static
1710
- */
1711
- public static function getFontFullPath ($ file , $ fontdir =false ) {
1712
- $ fontfile = '' ;
1713
- // search files on various directories
1714
- if (($ fontdir !== false ) AND @file_exists ($ fontdir .$ file )) {
1715
- $ fontfile = $ fontdir .$ file ;
1716
- } elseif (@file_exists (self ::_getfontpath ().$ file )) {
1717
- $ fontfile = self ::_getfontpath ().$ file ;
1718
- } elseif (@file_exists ($ file )) {
1719
- $ fontfile = $ file ;
1720
- }
1721
- return $ fontfile ;
1722
- }
1723
-
1724
1831
/**
1725
1832
* Converts UTF-8 characters array to array of Latin1 characters array<br>
1726
1833
* @param $unicode (array) array containing UTF-8 unicode values
@@ -2535,55 +2642,6 @@ public static function utf8Bidi($ta, $str='', $forcertl=false, $isunicode=true,
2535
2642
return $ ordarray ;
2536
2643
}
2537
2644
2538
- /**
2539
- * Get a reference font size.
2540
- * @param $size (string) String containing font size value.
2541
- * @param $refsize (float) Reference font size in points.
2542
- * @return float value in points
2543
- * @public static
2544
- */
2545
- public static function getFontRefSize ($ size , $ refsize =12 ) {
2546
- switch ($ size ) {
2547
- case 'xx-small ' : {
2548
- $ size = ($ refsize - 4 );
2549
- break ;
2550
- }
2551
- case 'x-small ' : {
2552
- $ size = ($ refsize - 3 );
2553
- break ;
2554
- }
2555
- case 'small ' : {
2556
- $ size = ($ refsize - 2 );
2557
- break ;
2558
- }
2559
- case 'medium ' : {
2560
- $ size = $ refsize ;
2561
- break ;
2562
- }
2563
- case 'large ' : {
2564
- $ size = ($ refsize + 2 );
2565
- break ;
2566
- }
2567
- case 'x-large ' : {
2568
- $ size = ($ refsize + 4 );
2569
- break ;
2570
- }
2571
- case 'xx-large ' : {
2572
- $ size = ($ refsize + 6 );
2573
- break ;
2574
- }
2575
- case 'smaller ' : {
2576
- $ size = ($ refsize - 3 );
2577
- break ;
2578
- }
2579
- case 'larger ' : {
2580
- $ size = ($ refsize + 3 );
2581
- break ;
2582
- }
2583
- }
2584
- return $ size ;
2585
- }
2586
-
2587
2645
} // END OF TCPDF_FONTS CLASS
2588
2646
2589
2647
//============================================================+
0 commit comments