Skip to content

Commit 401ec47

Browse files
committed
Prevent recursion in font glyphs (Fixes #38)
1 parent 9d8473e commit 401ec47

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/FontLib/Glyph/OutlineComposite.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ function getGlyphIDs() {
4141
$glyphIDs[] = $_component->glyphIndex;
4242

4343
$_glyph = $this->table->data[$_component->glyphIndex];
44-
$glyphIDs = array_merge($glyphIDs, $_glyph->getGlyphIDs());
44+
45+
if ($_glyph !== $this) {
46+
$glyphIDs = array_merge($glyphIDs, $_glyph->getGlyphIDs());
47+
}
4548
}
4649

4750
return $glyphIDs;
@@ -224,10 +227,14 @@ public function getSVGContours() {
224227
$glyphs = $glyph_data->data;
225228

226229
foreach ($this->components as $component) {
227-
$contours[] = array(
228-
"contours" => $glyphs[$component->glyphIndex]->getSVGContours(),
229-
"transform" => $component->getMatrix(),
230-
);
230+
$_glyph = $glyphs[$component->glyphIndex];
231+
232+
if ($_glyph !== $this) {
233+
$contours[] = array(
234+
"contours" => $_glyph->getSVGContours(),
235+
"transform" => $component->getMatrix(),
236+
);
237+
}
231238
}
232239

233240
return $contours;

0 commit comments

Comments
 (0)