Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
dompdf#1502 | Added o_cidSystemInfo to encrypt fields in this prev co…
Browse files Browse the repository at this point in the history
…ntent block
  • Loading branch information
simonberger authored and bsweeney committed Sep 14, 2017
1 parent 83d5484 commit 05d60b2
Showing 1 changed file with 37 additions and 16 deletions.
53 changes: 37 additions & 16 deletions lib/Cpdf.php
Original file line number Diff line number Diff line change
Expand Up @@ -1142,24 +1142,9 @@ protected function o_fontDescendentCID($id, $action, $options = '')

// we need a CID system info section
$cidSystemInfoId = ++$this->numObj;
$this->o_contents($cidSystemInfoId, 'new', 'raw');
$this->o_cidSystemInfo($cidSystemInfoId, 'new');
$this->objects[$id]['info']['cidSystemInfo'] = $cidSystemInfoId;

$ordering = '(UCS)';
$registry = '(Adobe)';

if ($this->encrypted) {
$this->encryptInit($id);
$ordering = $this->ARC4($ordering);
$registry = $this->ARC4($registry);
}

$res = '<</Registry ' . $registry . "\n"; // A string identifying an issuer of character collections
$res .= '/Ordering ' . $ordering . "\n"; // A string that uniquely names a character collection issued by a specific registry
$res .= "/Supplement 0\n"; // The supplement number of the character collection.
$res .= ">>";
$this->objects[$cidSystemInfoId]['c'] = $res;

// and a CID to GID map
$cidToGidMapId = ++$this->numObj;
$this->o_fontGIDtoCIDMap($cidToGidMapId, 'new', $options);
Expand Down Expand Up @@ -1228,6 +1213,42 @@ protected function o_fontDescendentCID($id, $action, $options = '')
return null;
}

protected function o_cidSystemInfo($id, $action, $options = '')
{
switch ($action) {
case 'new':
$this->objects[$id] = array(
't' => 'cidSystemInfo'
);
break;
case 'add':
break;
case 'out':
$ordering = '(UCS)';
$registry = '(Adobe)';

if ($this->encrypted) {
$this->encryptInit($id);
$ordering = $this->ARC4($ordering);
$registry = $this->ARC4($registry);
}


$res = "\n$id 0 obj\n";

$res .= '<</Registry ' . $registry . "\n"; // A string identifying an issuer of character collections
$res .= '/Ordering ' . $ordering . "\n"; // A string that uniquely names a character collection issued by a specific registry
$res .= "/Supplement 0\n"; // The supplement number of the character collection.
$res .= ">>";

$res .= "\nendobj";;

return $res;
}

return null;
}

/**
* a font glyph to character map, needed for unicode fonts
*
Expand Down

0 comments on commit 05d60b2

Please sign in to comment.