Skip to content

Commit 05d60b2

Browse files
simonbergerbsweeney
authored andcommitted
dompdf#1502 | Added o_cidSystemInfo to encrypt fields in this prev content block
1 parent 83d5484 commit 05d60b2

File tree

1 file changed

+37
-16
lines changed

1 file changed

+37
-16
lines changed

lib/Cpdf.php

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,24 +1142,9 @@ protected function o_fontDescendentCID($id, $action, $options = '')
11421142

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

1148-
$ordering = '(UCS)';
1149-
$registry = '(Adobe)';
1150-
1151-
if ($this->encrypted) {
1152-
$this->encryptInit($id);
1153-
$ordering = $this->ARC4($ordering);
1154-
$registry = $this->ARC4($registry);
1155-
}
1156-
1157-
$res = '<</Registry ' . $registry . "\n"; // A string identifying an issuer of character collections
1158-
$res .= '/Ordering ' . $ordering . "\n"; // A string that uniquely names a character collection issued by a specific registry
1159-
$res .= "/Supplement 0\n"; // The supplement number of the character collection.
1160-
$res .= ">>";
1161-
$this->objects[$cidSystemInfoId]['c'] = $res;
1162-
11631148
// and a CID to GID map
11641149
$cidToGidMapId = ++$this->numObj;
11651150
$this->o_fontGIDtoCIDMap($cidToGidMapId, 'new', $options);
@@ -1228,6 +1213,42 @@ protected function o_fontDescendentCID($id, $action, $options = '')
12281213
return null;
12291214
}
12301215

1216+
protected function o_cidSystemInfo($id, $action, $options = '')
1217+
{
1218+
switch ($action) {
1219+
case 'new':
1220+
$this->objects[$id] = array(
1221+
't' => 'cidSystemInfo'
1222+
);
1223+
break;
1224+
case 'add':
1225+
break;
1226+
case 'out':
1227+
$ordering = '(UCS)';
1228+
$registry = '(Adobe)';
1229+
1230+
if ($this->encrypted) {
1231+
$this->encryptInit($id);
1232+
$ordering = $this->ARC4($ordering);
1233+
$registry = $this->ARC4($registry);
1234+
}
1235+
1236+
1237+
$res = "\n$id 0 obj\n";
1238+
1239+
$res .= '<</Registry ' . $registry . "\n"; // A string identifying an issuer of character collections
1240+
$res .= '/Ordering ' . $ordering . "\n"; // A string that uniquely names a character collection issued by a specific registry
1241+
$res .= "/Supplement 0\n"; // The supplement number of the character collection.
1242+
$res .= ">>";
1243+
1244+
$res .= "\nendobj";;
1245+
1246+
return $res;
1247+
}
1248+
1249+
return null;
1250+
}
1251+
12311252
/**
12321253
* a font glyph to character map, needed for unicode fonts
12331254
*

0 commit comments

Comments
 (0)