Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions classes/otl.php
Original file line number Diff line number Diff line change
Expand Up @@ -832,8 +832,8 @@ function applyOTL($str, $useOTL) {
// so we will do one minor change here:
// From ICU: If the present character is a number, and the next character is a pre-number combining mark
// then the two characters are reordered
// From MS OTL spec the following are Digit modifiers (Md): 0F18�0F19, 0F3E�0F3F
// Digits: 0F20�0F33
// From MS OTL spec the following are Digit modifiers (Md): 0F18�0F19, 0F3E�0F3F
// Digits: 0F20�0F33
// On testing only 0x0F3F (pre-based mark) seems to need re-ordering
for($ptr=0; $ptr<count($this->OTLdata)-1; $ptr++) {
if (INDIC::in_range($this->OTLdata[$ptr]['uni'], 0x0F20, 0x0F33) && $this->OTLdata[$ptr+1]['uni'] == 0x0F3F ) {
Expand Down Expand Up @@ -4789,7 +4789,7 @@ function _bidiPrepare(&$para, $dir) {
$match = array_pop($remember);
}
}
// In all cases, set the PDI�s level to the embedding level of the last entry on the directional status stack left after the steps above.
// In all cases, set the PDI�s level to the embedding level of the last entry on the directional status stack left after the steps above.
// NB The level assigned to an isolate initiator is always the same as that assigned to the matching PDI.
if ($dos != -1) { $chardir = $dos; }
else { $chardir = $chunkOTLdata['char_data'][$i]['bidi_class']; }
Expand Down Expand Up @@ -5374,7 +5374,11 @@ function replaceSpace(&$txt, &$cOTLdata) {

function trimOTLdata(&$cOTLdata, $Left=true, $Right=true) {

$len = count($cOTLdata['char_data']);
$data = $cOTLdata['char_data'];
if(empty($data) || !is_array($data)){
$data = [];
}
$len = count($data);
$nLeft = 0;
$nRight = 0;
for($i=0;$i<$len;$i++) {
Expand Down
38 changes: 19 additions & 19 deletions classes/ttfontsuni.php
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ function extractInfo($debug=false, $BMPonly=false, $useOTL=0) {
$string_data_offset = $name_offset + $this->read_ushort();
$names = array(1=>'',2=>'',3=>'',4=>'',6=>'');
$K = array_keys($names);
$nameCount = count($names);
$nameCount = count(str_split($names));
for ($i=0;$i<$numRecords; $i++) {
$platformId = $this->read_ushort();
$encodingId = $this->read_ushort();
Expand Down Expand Up @@ -2424,7 +2424,7 @@ function _getGSUBarray(&$Lookup, &$lul, $scripttag) {
// then apply the substitution
if (strpos($inputGlyphs[$seqIndex],$lookupGlyphs[0])===false) { continue; }

// Returns e.g. �(0612)�(ignore) (0613)�(ignore) (0614)�
// Returns e.g. �(0612)�(ignore) (0613)�(ignore) (0614)�
$contextInputMatch = $this->_makeGSUBcontextInputMatch($inputGlyphs, $ignore, $lookupGlyphs, $seqIndex);
$REPL = implode(" ",$luss['substitute']);
// Returns e.g. "REPL\${6}\${8}" or "\${1}\${2} \${3} REPL\${4}\${6}\${8} \${9}"
Expand Down Expand Up @@ -2459,14 +2459,14 @@ function _getGSUBarray(&$Lookup, &$lul, $scripttag) {
$backtrackGlyphs = $Lookup[$i]['Subtable'][$c]['CoverageBacktrackGlyphs'];
}
else { $backtrackGlyphs = array(); }
// Returns e.g. �(FEEB|FEEC)(ignore) �(FD12|FD13)(ignore) �
// Returns e.g. �(FEEB|FEEC)(ignore) �(FD12|FD13)(ignore) �
$backtrackMatch = $this->_makeGSUBbacktrackMatch($backtrackGlyphs, $ignore);

if ($Lookup[$i]['Subtable'][$c]['LookaheadGlyphCount']) {
$lookaheadGlyphs = $Lookup[$i]['Subtable'][$c]['CoverageLookaheadGlyphs'];
}
else { $lookaheadGlyphs = array(); }
// Returns e.g. �(ignore) (FD12|FD13)�(ignore) (FEEB|FEEC)�
// Returns e.g. �(ignore) (FD12|FD13)�(ignore) (FEEB|FEEC)�
$lookaheadMatch = $this->_makeGSUBlookaheadMatch($lookaheadGlyphs, $ignore);

$nBsubs = 2*count($backtrackGlyphs);
Expand All @@ -2488,7 +2488,7 @@ function _getGSUBarray(&$Lookup, &$lul, $scripttag) {
// then apply the substitution
if (strpos($inputGlyphs[$seqIndex],$lookupGlyphs[0])===false) { continue; }

// Returns e.g. �(0612)�(ignore) (0613)�(ignore) (0614)�
// Returns e.g. �(0612)�(ignore) (0613)�(ignore) (0614)�
$contextInputMatch = $this->_makeGSUBcontextInputMatch($inputGlyphs, $ignore, $lookupGlyphs, $seqIndex);
$REPL = implode(" ",$luss['substitute']);

Expand Down Expand Up @@ -2560,7 +2560,7 @@ function _getGSUBarray(&$Lookup, &$lul, $scripttag) {
// then apply the substitution
if (strpos($inputGlyphs[$seqIndex],$lookupGlyphs[0])===false) { continue; }

// Returns e.g. �(0612)�(ignore) (0613)�(ignore) (0614)�
// Returns e.g. �(0612)�(ignore) (0613)�(ignore) (0614)�
$contextInputMatch = $this->_makeGSUBcontextInputMatch($inputGlyphs, $ignore, $lookupGlyphs, $seqIndex);

$REPL = implode(" ",$luss['substitute']);
Expand Down Expand Up @@ -2633,7 +2633,7 @@ function _getGSUBarray(&$Lookup, &$lul, $scripttag) {
}
}
else { $backtrackGlyphs = array(); }
// Returns e.g. �(FEEB|FEEC)(ignore) �(FD12|FD13)(ignore) �
// Returns e.g. �(FEEB|FEEC)(ignore) �(FD12|FD13)(ignore) �
$backtrackMatch = $this->_makeGSUBbacktrackMatch($backtrackGlyphs, $ignore);

if ($rule['LookaheadGlyphCount']) {
Expand All @@ -2648,7 +2648,7 @@ function _getGSUBarray(&$Lookup, &$lul, $scripttag) {
}
}
else { $lookaheadGlyphs = array(); }
// Returns e.g. �(ignore) (FD12|FD13)�(ignore) (FEEB|FEEC)�
// Returns e.g. �(ignore) (FD12|FD13)�(ignore) (FEEB|FEEC)�
$lookaheadMatch = $this->_makeGSUBlookaheadMatch($lookaheadGlyphs, $ignore);

$nBsubs = 2*count($backtrackGlyphs);
Expand All @@ -2674,7 +2674,7 @@ function _getGSUBarray(&$Lookup, &$lul, $scripttag) {
// then apply the substitution
if (strpos($inputGlyphs[$seqIndex],$lookupGlyphs[0])===false) { continue; }

// Returns e.g. �(0612)�(ignore) (0613)�(ignore) (0614)�
// Returns e.g. �(0612)�(ignore) (0613)�(ignore) (0614)�
$contextInputMatch = $this->_makeGSUBcontextInputMatch($inputGlyphs, $ignore, $lookupGlyphs, $seqIndex);
$REPL = implode(" ",$luss['substitute']);
// Returns e.g. "REPL\${6}\${8}" or "\${1}\${2} \${3} REPL\${4}\${6}\${8} \${9}"
Expand Down Expand Up @@ -2710,14 +2710,14 @@ function _getGSUBarray(&$Lookup, &$lul, $scripttag) {
$backtrackGlyphs = $Lookup[$i]['Subtable'][$c]['CoverageBacktrackGlyphs'];
}
else { $backtrackGlyphs = array(); }
// Returns e.g. �(FEEB|FEEC)(ignore) �(FD12|FD13)(ignore) �
// Returns e.g. �(FEEB|FEEC)(ignore) �(FD12|FD13)(ignore) �
$backtrackMatch = $this->_makeGSUBbacktrackMatch($backtrackGlyphs, $ignore);

if ($Lookup[$i]['Subtable'][$c]['LookaheadGlyphCount']) {
$lookaheadGlyphs = $Lookup[$i]['Subtable'][$c]['CoverageLookaheadGlyphs'];
}
else { $lookaheadGlyphs = array(); }
// Returns e.g. �(ignore) (FD12|FD13)�(ignore) (FEEB|FEEC)�
// Returns e.g. �(ignore) (FD12|FD13)�(ignore) (FEEB|FEEC)�
$lookaheadMatch = $this->_makeGSUBlookaheadMatch($lookaheadGlyphs, $ignore);

$nBsubs = 2*count($backtrackGlyphs);
Expand All @@ -2739,7 +2739,7 @@ function _getGSUBarray(&$Lookup, &$lul, $scripttag) {
// then apply the substitution
if (strpos($inputGlyphs[$seqIndex],$lookupGlyphs[0])===false) { continue; }

// Returns e.g. �(0612)�(ignore) (0613)�(ignore) (0614)�
// Returns e.g. �(0612)�(ignore) (0613)�(ignore) (0614)�
$contextInputMatch = $this->_makeGSUBcontextInputMatch($inputGlyphs, $ignore, $lookupGlyphs, $seqIndex);
$REPL = implode(" ",$luss['substitute']);

Expand Down Expand Up @@ -2848,7 +2848,7 @@ function _getGSUBignoreString($flag, $MarkFilteringSet) {
/*
BACKTRACK INPUT LOOKAHEAD
================================== ================== ==================================
(FEEB|FEEC)(ign) �(FD12|FD13)(ign) �(0612)�(ign) (0613)�(ign) (FD12|FD13)�(ign) (FEEB|FEEC)
(FEEB|FEEC)(ign) �(FD12|FD13)(ign) �(0612)�(ign) (0613)�(ign) (FD12|FD13)�(ign) (FEEB|FEEC)
---------------- ---------------- ----- ------------ --------------- ---------------
Backtrack 1 Backtrack 2 Input 1 Input 2 Lookahead 1 Lookahead 2
-------- --- --------- --- ---- --- ---- --- --------- --- -------
Expand All @@ -2860,12 +2860,12 @@ function _getGSUBignoreString($flag, $MarkFilteringSet) {
"\${1}\${2} " (nInput*2)-1 "\${5+} \${6+}"
"REPL"

�\${1}\${2} �\${3}\${4} �REPL�\${5+} \${6+}�\${7+} \${8+}�
�\${1}\${2} �\${3}\${4} �REPL�\${5+} \${6+}�\${7+} \${8+}�


INPUT nInput = 5
============================================================
�(0612)�(ign) (0613)�(ign) (0614)�(ign) (0615)�(ign) (0615)�
�(0612)�(ign) (0613)�(ign) (0614)�(ign) (0615)�(ign) (0615)�
\${1} \${2} \${3} \${4} \${5} \${6} \${7} \${8} \${9} (All backreference numbers are + nBsubs)
----- ------------ ------------ ------------ ------------
Input 1 Input 2 Input 3 Input 4 Input 5
Expand All @@ -2888,7 +2888,7 @@ function _getGSUBignoreString($flag, $MarkFilteringSet) {

function _makeGSUBcontextInputMatch($inputGlyphs, $ignore, $lookupGlyphs, $seqIndex) {
// $ignore = "((?:(?: FBA1| FBA2| FBA3))*)" or "()"
// Returns e.g. �(0612)�(ignore) (0613)�(ignore) (0614)�
// Returns e.g. �(0612)�(ignore) (0613)�(ignore) (0614)�
// $inputGlyphs = array of glyphs(glyphstrings) making up Input sequence in Context
// $lookupGlyphs = array of glyphs (single Glyphs) making up Lookup Input sequence
$mLen = count($lookupGlyphs); // nGlyphs in the secondary Lookup match
Expand All @@ -2904,7 +2904,7 @@ function _makeGSUBcontextInputMatch($inputGlyphs, $ignore, $lookupGlyphs, $seqIn

function _makeGSUBinputMatch($inputGlyphs, $ignore) {
// $ignore = "((?:(?: FBA1| FBA2| FBA3))*)" or "()"
// Returns e.g. �(0612)�(ignore) (0613)�(ignore) (0614)�
// Returns e.g. �(0612)�(ignore) (0613)�(ignore) (0614)�
// $inputGlyphs = array of glyphs(glyphstrings) making up Input sequence in Context
// $lookupGlyphs = array of glyphs making up Lookup Input sequence - if applicable
$str = "";
Expand All @@ -2917,7 +2917,7 @@ function _makeGSUBinputMatch($inputGlyphs, $ignore) {

function _makeGSUBbacktrackMatch($backtrackGlyphs, $ignore) {
// $ignore = "((?:(?: FBA1| FBA2| FBA3))*)" or "()"
// Returns e.g. �(FEEB|FEEC)(ignore) �(FD12|FD13)(ignore) �
// Returns e.g. �(FEEB|FEEC)(ignore) �(FD12|FD13)(ignore) �
// $backtrackGlyphs = array of glyphstrings making up Backtrack sequence
// 3 2 1 0
// each item being e.g. E0AD|E0AF|F1FD
Expand All @@ -2930,7 +2930,7 @@ function _makeGSUBbacktrackMatch($backtrackGlyphs, $ignore) {

function _makeGSUBlookaheadMatch($lookaheadGlyphs, $ignore) {
// $ignore = "((?:(?: FBA1| FBA2| FBA3))*)" or "()"
// Returns e.g. �(ignore) (FD12|FD13)�(ignore) (FEEB|FEEC)�
// Returns e.g. �(ignore) (FD12|FD13)�(ignore) (FEEB|FEEC)�
// $lookaheadGlyphs = array of glyphstrings making up Lookahead sequence
// 0 1 2 3
// each item being e.g. E0AD|E0AF|F1FD
Expand Down
4 changes: 3 additions & 1 deletion mpdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -31962,7 +31962,9 @@ function ConvertSize($size=5,$maxsize=0,$fontsize=false,$usefontsize=true){
if ($fontsize) { $size *= $fontsize*2; }
else { $size *= $maxsize*2; }
}
else $size *= (25.4/$this->dpi); //nothing == px
else{
$size = ((int)$size*(25.4/$this->dpi)); //nothing == px
}

return $size;
}
Expand Down